/**
 * Keirin Event Suite Components
 * --------------------------------------------------
 * このファイルには、プラグイン全体で再利用されるUIコンポーネントのスタイルを定義します。
 * - 記事カード
 * - カテゴリバッジ
 * - アニメーション
 * - タブコンポーネント
 * - 最終結果セクション (背景色修正済み)
 */

/* ==========================================================================
   1. Article Card Components (記事カード)
   ========================================================================== */

.kes-related-news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding-top: 20px;
}

.kes-card {
    background: rgba(255, 255, 255, 0.05); /* グラスモーフィズムの背景 */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.kes-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.kes-card__thumbnail {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.kes-card__content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.kes-card__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.kes-card__meta {
    margin-top: auto; /* メタ情報をカード下部に配置 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #adb5bd; /* 少し明るいグレー */
}

.kes-card__date {
    font-weight: 500;
}


/* ==========================================================================
   2. Category Badge Styles (カテゴリバッジ)
   ========================================================================== */

.kes-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 20px; /* 角丸を強くする */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* イベントカテゴリ用のスタイル */
.kes-badge--event {
    color: #fff;
    background: linear-gradient(45deg, #f76b1c, #f9a825);
}

/* その他のニュース用のスタイル */
.kes-badge--news {
    color: #e9ecef;
    background-color: rgba(255, 255, 255, 0.15);
}


/* ==========================================================================
   3. Animation Definitions (アニメーション)
   ========================================================================== */

/* フェードインアニメーションの定義 */
@keyframes kes-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* アニメーション適用のためのクラス */
.kes-fade-in {
    opacity: 0;
}

/* JavaScriptによって付与され、アニメーションを開始するクラス */
.kes-visible {
    animation: kes-fade-in-up 0.8s ease forwards;
}

/* ==========================================================================
   4. Tab Component (タブコンポーネント)
   ========================================================================== */

.kes-article-tabs-container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    color: #e9ecef;
}

.kes-tabs-nav {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.kes-tabs-nav__item {
    flex: 1;
}

.kes-tabs-nav__link {
    display: block;
    padding: 14px 10px;
    text-align: center;
    text-decoration: none;
    color: #adb5bd;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.kes-tabs-nav__link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.kes-tabs-nav__link.is-active {
    color: #fff;
    border-bottom-color: #f76b1c; /* テーマカラーのオレンジ */
}

.kes-tabs-content {
    padding: 20px;
}

.kes-tab-pane {
    display: none;
}

.kes-tab-pane.is-active {
    display: block;
    animation: kes-fade-in-up 0.5s ease;
}

/* ==========================================================================
   5. Shortcode Article List Styles (ショートコード用記事リスト)
   ========================================================================== */

.kes-article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kes-article-list__item:not(:last-child) {
    margin-bottom: 15px;
}

.kes-article-card {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.3s ease;
    border: 1px solid transparent;
}

.kes-article-card:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.kes-article-card__thumbnail {
    width: 100px;
    height: 75px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 16px;
    flex-shrink: 0;
}

.kes-article-card__body {
    flex: 1;
}

.kes-article-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
    color: #fff;
}

.kes-article-card__meta {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: #adb5bd;
}

.kes-article-card__date {
    margin-left: auto;
}

/* ==========================================================================
   6. New Badge Styles (新しいバッジ)
   ========================================================================== */

.kes-badge-important {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(45deg, #e74c3c, #c0392b); /* 赤系のグラデーション */
    margin-right: 8px;
}
/**
 * =================================================================
 * Final Results Section Styles (v1.8.1 - 背景色修正版)
 * =================================================================
 *
 * `single-league.php`で挿入される最終結果ショートコードの表示を調整
 *
 * @since 1.8.0
 * @updated 1.8.1
 */

/* 最終結果セクションのラッパー */
.kes-final-results-wrapper {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* ショートコードが出力するコンテンツのラッパー (グラスモーフィズム適用) */
.kes-final-results-wrapper .pist6-results-wrapper {
    background: rgba(30, 30, 40, 0.75); /* 半透明の濃い背景 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: #e9ecef;
    max-width: 100%;
}

/* 見出し (H3) - グラデーションボーダー */
.kes-final-results-wrapper .pist6-results-wrapper h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    border-bottom: 2px solid;
    border-image: linear-gradient(90deg, #f76b1c, #f9a825) 1;
}

/* --- 1. 着順リスト --- */
.kes-final-results-wrapper .pist6-ranking-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.kes-final-results-wrapper .pist6-ranking-list li {
    display: flex;
    align-items: center;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    transition: background-color 0.3s ease;
    border-radius: 8px;
}

.kes-final-results-wrapper .pist6-ranking-list li:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.kes-final-results-wrapper .pist6-ranking-list li:last-child {
    border-bottom: none;
}

.kes-final-results-wrapper .rank {
    font-weight: 700;
    font-size: 1.1rem;
    color: #ffffff;
    width: 60px;
    flex-shrink: 0;
    text-align: center;
}

.kes-final-results-wrapper li:nth-child(1) .rank { color: #ffd700; } /* 1位: ゴールド */
.kes-final-results-wrapper li:nth-child(2) .rank { color: #c0c0c0; } /* 2位: シルバー */
.kes-final-results-wrapper li:nth-child(3) .rank { color: #cd7f32; } /* 3位: ブロンズ */

.kes-final-results-wrapper .name {
    font-weight: 600;
    font-size: 1.05rem;
}

/* --- 2. 払戻金情報 (背景を白に変更) --- */
.kes-final-results-wrapper .pist6-refund-info {
    background: #ffffff; /* 背景を白に変更 */
    border-radius: 8px;
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid #e0e0e0; /* 枠線を薄いグレーに変更 */
}

.kes-final-results-wrapper .pist6-refund-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kes-final-results-wrapper .pist6-refund-item .type {
    font-weight: 700;
    font-size: 0.9rem;
    background: linear-gradient(45deg, #f76b1c, #f9a825);
    color: #fff; /* グラデーション背景なので白文字のまま */
    padding: 4px 10px;
    border-radius: 20px;
}

.kes-final-results-wrapper .pist6-refund-item .combo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333333; /* 文字色を黒に変更 */
    letter-spacing: 1px;
}

.kes-final-results-wrapper .pist6-refund-item .refund {
    font-size: 1.2rem;
    font-weight: 700;
    color: #c0392b; /* 払戻金の色を濃い赤に変更して視認性を確保 */
}

/* --- 3. 出走表テーブル (背景を白に変更) --- */
.kes-final-results-wrapper .pist6-roster-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.kes-final-results-wrapper .pist6-roster-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background-color: #ffffff; /* 背景を白に変更 */
    color: #333333; /* デフォルトの文字色を黒に変更 */
    border-radius: 8px; /* 角丸を追加 */
    overflow: hidden; /* 角丸を適用するため */
}

.kes-final-results-wrapper .pist6-roster-table th,
.kes-final-results-wrapper .pist6-roster-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0; /* 罫線を薄いグレーに変更 */
}

.kes-final-results-wrapper .pist6-roster-table tr:last-child td {
    border-bottom: none; /* 最後の行の罫線を削除 */
}

.kes-final-results-wrapper .pist6-roster-table th {
    font-weight: 600;
    color: #666666; /* ヘッダーの文字色をグレーに変更 */
    background-color: #f9f9f9; /* ヘッダー背景を薄いグレーに */
}

.kes-final-results-wrapper .pist6-roster-table td:first-child {
    width: 80px; /* 車番カラムの幅を固定 */
    text-align: center;
}

/* 出走表内の選手名の色を調整 */
.kes-final-results-wrapper .pist6-roster-table .name {
    color: #333333;
    font-weight: 600;
}


/* --- 4. 詳細リンク --- */
.kes-final-results-wrapper .pist6-link-wrapper {
    text-align: center;
    margin-top: 2rem;
}

.kes-final-results-wrapper .pist6-details-link {
    display: inline-block;
    background: linear-gradient(90deg, #f76b1c, #f9a825);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kes-final-results-wrapper .pist6-details-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(249, 168, 37, 0.3);
}


/* =================================================================
 * 共通: 競輪の車番カラー
 * ================================================================= */

/* 共通の車番スタイル */
.kes-final-results-wrapper .number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    margin-right: 1rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid transparent;
}

/* テーブル内の車番は右マージン不要 */
.kes-final-results-wrapper .pist6-roster-table .number {
    margin-right: 0;
}

/* 1番車: 白地に黒文字 */
.kes-final-results-wrapper .number.car-1 { background-color: #ffffff; color: #1a202c; border-color: #cccccc; }
/* 2番車: 黒地に白文字 */
.kes-final-results-wrapper .number.car-2 { background-color: #1a202c; color: #ffffff; border-color: #4a5568; }
/* 3番車: 赤地に白文字 */
.kes-final-results-wrapper .number.car-3 { background-color: #e53e3e; color: #ffffff; border-color: #c53030; }
/* 4番車: 青地に白文字 */
.kes-final-results-wrapper .number.car-4 { background-color: #3182ce; color: #ffffff; border-color: #2b6cb0; }
/* 5番車: 黄色地に黒文字 */
.kes-final-results-wrapper .number.car-5 { background-color: #ecc94b; color: #1a202c; border-color: #d69e2e; }
/* 6番車: 緑地に白文字 */
.kes-final-results-wrapper .number.car-6 { background-color: #38a169; color: #ffffff; border-color: #2f855a; }

/* =================================================================
 * 7. Race Selection Carousel & Navigation (v1.9.0)
 * ================================================================= */

.kes-carousel-container {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.kes-carousel-track-container {
    overflow: hidden;
    flex-grow: 1;
}

.kes-carousel-track {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    margin: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.kes-carousel-track::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.kes-carousel-nav {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

.kes-carousel-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.kes-carousel-nav.prev {
    margin-right: 8px;
}

.kes-carousel-nav.next {
    margin-left: 8px;
}

.kes-race-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.kes-race-navigation {
    display: flex;
    gap: 10px;
}

.kes-race-nav-btn {
    background-color: #444;
    color: #fff;
    border: 1px solid #666;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.kes-race-nav-btn:hover:not(:disabled) {
    background-color: #555;
}

.kes-race-nav-btn:disabled {
    background-color: #333;
    color: #777;
    cursor: not-allowed;
    border-color: #444;
}

/* =================================================================
 * 8. Race Result Table Layout (v1.9.1)
 * ================================================================= */

.kes-result-table {
    table-layout: fixed;
    width: 100%;
}

.kes-result-table th,
.kes-result-table td {
    white-space: nowrap; /* ヘッダーとセルの改行を禁止 */
}

.kes-result-table th:nth-child(1), .kes-result-table td:nth-child(1) { width: 10%; } /* 着順 */
.kes-result-table th:nth-child(2), .kes-result-table td:nth-child(2) { width: 15%; } /* 車番 */
.kes-result-table th:nth-child(3), .kes-result-table td:nth-child(3) { width: 32%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 選手名 */
.kes-result-table th:nth-child(4), .kes-result-table td:nth-child(4) { width: 23%; } /* 上がり */
.kes-result-table th:nth-child(5), .kes-result-table td:nth-child(5) { width: 20%; } /* 着差 */



/*
 * =================================================================
 * 9. Main Header Title Styles (v1.9.2)
 * =================================================================
 */

.kes-header h1 {
    line-height: 1.3;
}

.kes-title-period,
.kes-title-round {
    display: block;
    text-align: center;
}

.kes-title-period {
    font-size: 0.6em;
    font-weight: 600;
    color: #a0aec0; /* Cool Gray */
    letter-spacing: 1px;
    text-transform: uppercase;
}

.kes-title-round {
    font-size: 1em;
    font-weight: 700;
    color: #ffffff;
}

/*
 * =================================================================
 * 10. Racer List Bottom Sheet (v2.2.0)
 * =================================================================
 */

.kes-racer-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: #ffffff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
}

.kes-racer-sheet__header {
    position: relative;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid transparent; /* Add border on expand */
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s;
}

.kes-racer-sheet__header:hover {
    background-color: #f7fafc;
}

.kes-racer-sheet__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kes-racer-sheet__icon {
    display: inline-block;
    margin-right: 8px;
    border: solid #2d3748;
    border-width: 0 2px 2px 0;
    padding: 3px;
    transform: rotate(-135deg); /* Pointing up */
    transition: transform 0.3s ease;
}

.kes-racer-sheet__body {
    max-height: 78px; /* Default: 2 rows height */
    overflow-y: hidden;
    transition: max-height 0.4s ease-in-out, padding 0.4s ease-in-out, border-top-width 0.4s ease-in-out;
}

.kes-racer-sheet__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3列表示 */
    gap: 8px 12px;
    padding: 12px 16px 16px 16px;
}

.kes-racer-sheet__item {
    font-size: 0.85rem;
    color: #4a5568;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px 0;
    opacity: 0; /* Hidden by default for animation */
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    transition-delay: 0s;
}

/* FIX: Make first 6 items (2 rows) visible in default state */
.kes-racer-sheet:not(.is-expanded):not(.is-minimized) .kes-racer-sheet__item:nth-child(-n+6) {
    opacity: 1;
    transform: translateY(0);
}

.kes-racer-sheet__number {
    color: #a0aec0;
    margin-right: 4px;
}

/* --- States --- */

/* Expanded State */
.kes-racer-sheet.is-expanded .kes-racer-sheet__body {
    max-height: 50vh;
    overflow-y: auto;
}

.kes-racer-sheet.is-expanded .kes-racer-sheet__header {
    border-bottom-color: #e2e8f0;
}

.kes-racer-sheet.is-expanded .kes-racer-sheet__icon {
    transform: rotate(45deg); /* Pointing down */
}

/* Staggered animation for all items on expand */
.kes-racer-sheet.is-expanded .kes-racer-sheet__item {
    opacity: 1;
    transform: translateY(0);
}
.kes-racer-sheet.is-expanded .kes-racer-sheet__item:nth-child(1) { transition-delay: 0.05s; }
.kes-racer-sheet.is-expanded .kes-racer-sheet__item:nth-child(2) { transition-delay: 0.07s; }
.kes-racer-sheet.is-expanded .kes-racer-sheet__item:nth-child(3) { transition-delay: 0.09s; }
.kes-racer-sheet.is-expanded .kes-racer-sheet__item:nth-child(4) { transition-delay: 0.11s; }
.kes-racer-sheet.is-expanded .kes-racer-sheet__item:nth-child(5) { transition-delay: 0.13s; }
.kes-racer-sheet.is-expanded .kes-racer-sheet__item:nth-child(6) { transition-delay: 0.15s; }


/* Minimized State */
.kes-racer-sheet.is-minimized .kes-racer-sheet__body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: 1px solid transparent;
}

.kes-racer-sheet.is-minimized .kes-racer-sheet__icon {
    transform: rotate(-135deg); /* Pointing up */
}

.kes-racer-sheet.is-minimized .kes-racer-sheet__minimize-btn::before {
    content: '+';
    font-weight: 300;
}


/* Minimize Button */
.kes-racer-sheet__minimize-btn {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 200;
    line-height: 1;
    color: #a0aec0;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.kes-racer-sheet__minimize-btn::before {
    content: '–'; /* Default is minus sign (em dash) */
}

.kes-racer-sheet__minimize-btn:hover {
    background-color: #e2e8f0;
    color: #4a5568;
}

/*
 * =================================================================
 * 11. Calendar View Styles (v2.0.0)
 * =================================================================
 */

#kes-calendar-container .fc-day-today {
    background-color: rgba(249, 168, 37, 0.1);
}


/*
 * =================================================================
 * 12. Calendar View Styles (v2.5.0) - Rich Dark Theme
 * =================================================================
 */

.kes-calendar-v2 {
    background: rgba(30, 30, 40, 0.75) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 1.5rem !important;
    border-radius: 16px !important;
}

/* -- Header Toolbar -- */
.kes-calendar-v2 .fc-header-toolbar {
    margin-bottom: 1.5rem !important;
    background-color: transparent !important;
}

.kes-calendar-v2 .fc-toolbar-title {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
}

.kes-calendar-v2 .fc-button {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #e5e7eb !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem !important;
    transition: all 0.2s ease-in-out !important;
    box-shadow: none !important;
    text-transform: capitalize !important;
}

.kes-calendar-v2 .fc-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

.kes-calendar-v2 .fc-button-primary:disabled {
    background: rgba(255, 255, 255, 0.05) !important;
    color: #6b7280 !important;
}

.kes-calendar-v2 .fc-today-button {
    font-weight: 700 !important;
    background: rgba(247, 107, 28, 0.25) !important;
    border-color: rgba(247, 107, 28, 0.5) !important;
    color: #f9fafb !important;
}

/* -- Calendar Grid -- */
.kes-calendar-v2 .fc-theme-standard .fc-scrollgrid {
    border: none !important;
}

.kes-calendar-v2 .fc-theme-standard th,
.kes-calendar-v2 .fc-theme-standard td {
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.kes-calendar-v2 .fc-col-header-cell {
    background-color: #ffffff !important;
    color: #333333 !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    padding: 0 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-left: 1px solid #f0f0f0 !important;
    border-right: 1px solid #f0f0f0 !important;
}

.kes-calendar-v2 .fc-col-header-cell.fc-day-sat {
    background-color: #e0f2fe !important;
    color: #0c4a6e !important;
}

.kes-calendar-v2 .fc-col-header-cell.fc-day-sun {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
}

.kes-calendar-v2 .fc-col-header-cell.fc-day-sat {
    background-color: rgba(59, 130, 246, 0.1) !important;
    color: #93c5fd !important;
}

.kes-calendar-v2 .fc-col-header-cell.fc-day-sun {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #fca5a5 !important;
}

.kes-calendar-v2 .fc-daygrid-day-number {
    padding: 0.5rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #d1d5db !important;
}

.kes-calendar-v2 .fc-day-today {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.kes-calendar-v2 .fc-day-today .fc-daygrid-day-number {
    color: #fb923c !important; /* Bright Orange */
}

/* -- Events -- */
.kes-calendar-v2 .fc-event {
    background-color: #d97706 !important;
    border: 1px solid #b45309 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    padding: 4px 6px !important;
    border-radius: 4px !important;
    transition: background-color 0.2s, border-color 0.2s !important;
}

.kes-calendar-v2 .fc-event .kes-event-day-number {
    color: #ffffff !important;
    font-weight: 700 !important;
}

.kes-calendar-v2 .fc-event:hover {
    background-color: #b45309 !important;
}

.kes-calendar-v2 .fc-daygrid-day-events {
    padding: 0 2px !important;
}

.kes-calendar-v2 .fc-daygrid-more-link {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: #fb923c !important;
    padding: 2px 4px !important;
}

/* PC Width Adjustment */
@media screen and (min-width: 992px) {
    .kes-calendar-v2 {
        max-width: 60% !important;
        margin: 2rem auto !important;
    }
}

/* =================================================================
 * 13. Video Container (v2.6.0)
 * ================================================================= */

.kes-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.kes-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}



/*
 * =================================================================
 * 14. Custom Calendar Controls (v2.x.x)
 * =================================================================
 */

/* --- Default (Light Theme) Styles --- */
#kes-calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
}

#kes-calendar-controls select,
#kes-calendar-controls button {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #888888 !important; /* 枠線を濃いグレーに変更 */
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

#kes-calendar-controls select:hover,
#kes-calendar-controls button:hover {
    background-color: #f0f0f0;
    border-color: #aaaaaa;
}

#kes-calendar-controls select option {
    color: #000000;
}

#kes-calendar-controls button {
    width: 40px;
    text-align: center;
}


/* --- Dark Theme Overrides (inside .kes-calendar-v2) --- */
.kes-calendar-v2 #kes-calendar-controls select,
.kes-calendar-v2 #kes-calendar-controls button {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

.kes-calendar-v2 #kes-calendar-controls select:hover,
.kes-calendar-v2 #kes-calendar-controls button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}


/* --- PC Layout --- */
@media screen and (min-width: 992px) {
    #kes-calendar-wrapper {
        position: relative;
    }

    #kes-calendar-controls {
        position: absolute;
        top: 1.5rem; /* .kes-calendar-v2 の padding に合わせる */
        left: 50%;
        transform: translateX(-50%);
        z-index: 2; /* カレンダー本体より手前に表示 */
        margin-bottom: 0; /* 不要になるのでリセット */
    }
    
    .kes-calendar-v2 #kes-calendar-controls {
        background: rgba(40, 40, 50, 0.75); /* 背景を少しつけて見やすくする */
        padding: 8px;
        border-radius: 0.5rem;
    }

    .kes-calendar-v2 {
        /* コントロール分のスペースを確保 */
        padding-top: 6rem !important; 
    }
}
