/* --- ГЛОБАЛЬНЫЕ НАСТРОЙКИ --- */
.battle-cup-container,
.battle-cup-container * {
    font-family: 'CustomFont', sans-serif !important;
}

.battle-cup-container *, 
.battle-cup-container *::before, 
.battle-cup-container *::after {
    box-sizing: border-box;
}

/* Иконки используют свой шрифт */
.battle-cup-container .fas,
.battle-cup-container .far,
.battle-cup-container .fab,
.battle-cup-container i {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome", sans-serif !important;
    font-weight: 900;
}

.battle-cup-container {
    max-width: 90%;
    margin: 60px auto; 
    padding: 0 30px; 
    animation: fadeIn 0.5s ease-in-out;
}

/* --- ШАПКА СТРАНИЦЫ --- */
.games-header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
    padding-bottom: 10px;
}

.games-header-text h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-color, #2C8FFF);
    margin: 0 0 5px 0;
    letter-spacing: 0.5px;
}

.games-header-text p {
    font-size: 16px;
    color: #ffffff;
    margin: 5px 0 0 0;
    line-height: 1.5;
}

/* --- ВЕРХНЯЯ СЕКЦИЯ (ТАЙМЕР И НАГРАДЫ) --- */
.cup-top-section {
    display: grid;
    /* Финальная оптимизация: 320px | гибкий центр | 320px */
    grid-template-columns: 320px 1fr 320px; 
    gap: 15px;
    margin-bottom: 30px;
    align-items: stretch;
}

/* КАРТОЧКА ТАЙМЕРА */
.cup-timer-card {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #303050);
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    height: 100%;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.cup-timer-card::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.main-cup-image {
    width: 160px; /* Финальный размер */
    height: auto;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.4));
    transition: transform 0.3s ease;
    margin-top: 5px;
    margin-bottom: 10px;
}

.cup-timer-card:hover .main-cup-image { transform: scale(1.05); }

.cup-title { 
    font-size: 1.4rem; 
    font-weight: 700; 
    margin-bottom: 2px; 
    color: #fff; 
}

.timer-label { 
    font-size: 1.1rem; 
    color: rgba(255,255,255,0.6); 
    margin-bottom: 10px; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

.timer-display { 
    font-size: 1.8rem; /* Компактный шрифт */
    font-weight: 800; 
    color: #ffd700; 
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.4); 
    white-space: nowrap; 
    letter-spacing: -1px;
}
.timer-display span { 
    color: #fff; 
    font-size: 0.8em;
    margin-right: 4px;
}

/* --- НАГРАДЫ (СЕТКА 3x3) --- */
.cup-rewards-container { display: flex; flex-direction: column; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color, #303050);
    padding-bottom: 10px;
}
.section-title { font-size: 1.3rem; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 10px; }

.rewards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 в ряд */
    gap: 10px;
}

.reward-card {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #303050);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.reward-card.recurring-card { border-color: #ffd700; box-shadow: 0 0 15px rgba(255, 215, 0, 0.1); }
.reward-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.3); border-color: var(--accent-color, #5a67d8); }

.reward-main-content {
    padding: 10px;
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.reward-image { 
    width: 60px; 
    height: 60px; 
    object-fit: contain; 
    margin-bottom: 10px; 
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.2)); 
}
.reward-title { font-weight: 600; font-size: 0.9rem; color: #fff; line-height: 1.3; }

.reward-order-badge, .recurring-badge {
    position: absolute; top: 8px; left: 8px;
    padding: 3px 8px; border-radius: 6px; font-size: 0.75rem;
}
.reward-order-badge { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
.recurring-badge { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #000; font-weight: bold; box-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }

.reward-vimer-footer {
    background: rgba(44, 143, 255, 0.15);
    border-top: 1px solid rgba(44, 143, 255, 0.25);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.vimer-amount { font-weight: 800; color: #50c0ff; font-size: 1.2rem; }
.vimer-icon-small { width: 22px; height: 22px; filter: drop-shadow(0 0 5px rgba(44, 143, 255, 0.5)); }

/* БЛОК ПОБЕДИТЕЛЕЙ */
.cup-winners-sidebar {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #303050);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    max-height: 450px;
    height: 100%;
}

.winners-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 5px;
}

.sidebar-winner-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 5px;
}

/* --- ТАБЛИЦА ЛИДЕРОВ --- */
.leaders-table-container, .history-list-container {
    max-height: 650px;
    overflow-y: auto;
    position: relative;
    border-radius: 16px;
}

.history-list-container {
    max-height: none !important;
    overflow-y: visible !important;
}

/* ОБЪЕДИНЕННЫЕ СТИЛИ СКРОЛЛБАРА */
.leaders-table-container::-webkit-scrollbar,
.history-list-container::-webkit-scrollbar,
.winner-list::-webkit-scrollbar,
.winners-sidebar-list::-webkit-scrollbar,
.staff-list::-webkit-scrollbar {
    width: 8px; height: 8px;
}

.leaders-table-container::-webkit-scrollbar-track,
.history-list-container::-webkit-scrollbar-track {
    background: rgba(31, 31, 31, 0.5); border-radius: 4px;
}

.leaders-table-container::-webkit-scrollbar-thumb,
.history-list-container::-webkit-scrollbar-thumb {
    background: rgba(44, 143, 255, 0.5); border-radius: 4px;
}

.leaders-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.leaders-table th {
    position: sticky; top: 0; background: var(--card-bg, #1a1a2e); z-index: 10;
    text-align: left; padding: 15px; color: rgba(255, 255, 255, 0.5); font-weight: 600;
    text-transform: uppercase; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.leaders-table td { padding: 15px; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.leaders-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.rank-cell { font-weight: bold; width: 60px; text-align: center; }
.rank-1 { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.rank-2 { color: #c0c0c0; text-shadow: 0 0 10px rgba(192, 192, 192, 0.5); }
.rank-3 { color: #cd7f32; text-shadow: 0 0 10px rgba(205, 127, 50, 0.5); }

.player-cell { display: flex; align-items: center; gap: 12px; }
.leader-avatar { width: 32px; height: 32px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.leader-name { font-weight: 600; text-decoration: none; color: #fff; }
.leader-name:hover { color: var(--accent-color); }
.tickets-cell { font-weight: bold; color: #50c0ff; display: flex; align-items: center; gap: 8px; }

/* --- ИСТОРИЯ КУБКОВ --- */
.cup-history-section { margin-top: 50px; }

#cup-history-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 25px;
    margin-bottom: 30px;
}

.closed-cup-card {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid var(--border-color, #303050);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease;
    height: auto;
}

.closed-cup-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-color, #2C8FFF);
    box-shadow: 0 10px 30px rgba(44, 143, 255, 0.1);
}

.closed-cup-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.closed-cup-week-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.closed-cup-date {
    font-size: 0.8rem;
    opacity: 0.5;
    font-weight: 400;
}

.closed-cup-week { font-size: 1.1em; font-weight: bold; color: var(--accent-color); }
.closed-cup-status { background: rgba(40, 167, 69, 0.15); color: #28a745; padding: 2px 10px; border-radius: 4px; font-size: 0.75em; font-weight: bold; }

.closed-cup-winners {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.closed-winner-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
}

.closed-winner-place {
    font-size: 0.85rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
    min-width: 15px;
}

.winner-avatar-3d { width: 24px; height: 24px; object-fit: contain; }

.closed-winner-name {
    flex-grow: 1;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.85rem; /* Компактные ники */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.closed-winner-tickets {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #50c0ff;
    font-weight: 800;
    font-size: 0.9rem;
}

/* --- АДМИНИСТРИРОВАНИЕ --- */
.admin-reward-controls {
    position: absolute; top: 8px; right: 8px;
    display: flex; gap: 5px; opacity: 0; transition: opacity 0.2s ease; z-index: 2;
}
.reward-card:hover .admin-reward-controls { opacity: 1; }
.btn-icon-small { padding: 5px; border-radius: 4px; border: none; cursor: pointer; font-size: 0.8rem; color: white; }

/* МОДАЛЬНЫЕ ОКНА */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg, #1a1a2e);
    margin: auto;
    padding: 30px;
    border: 1px solid var(--border-color, #303050);
    border-radius: 16px;
    width: 90%;
    max-width: 550px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

.modal-content h2, 
.modal-content h3 {
    margin-top: 0;
    color: var(--accent-color, #2C8FFF);
    font-size: 24px;
    margin-bottom: 20px;
}

.close-modal {
    position: absolute; top: 20px; right: 20px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
}

.close-modal:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.form-group { margin-bottom: 15px; display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 700; color: #fff; opacity: 0.8; }

.form-input, 
.modal-content input[type="text"],
.modal-content input[type="number"],
.modal-content input[type="datetime-local"],
.modal-content select {
    width: 100%;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color, #303050);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: 'CustomFont', sans-serif;
    transition: all 0.2s ease;
    box-sizing: border-box;
    outline: none !important;
}

.form-input:focus {
    border-color: var(--accent-color, #2C8FFF);
    box-shadow: 0 0 10px rgba(44, 143, 255, 0.3);
}

.btn-primary {
    background: var(--accent-color, #2C8FFF);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-delete {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.2);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #e74c3c;
    color: #fff;
}

/* --- ТАБЫ --- */
.leaders-tabs { display: flex; justify-content: center; gap: 15px; margin-bottom: 25px; }
.tab-btn {
    background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color, #303050);
    color: rgba(255, 255, 255, 0.6); padding: 10px 24px; border-radius: 30px;
    cursor: pointer; font-size: 1rem; font-weight: 600; transition: all 0.3s ease;
}
.tab-btn.active { background: var(--accent-color, #5a67d8); border-color: var(--accent-color, #5a67d8); color: #fff; box-shadow: 0 0 15px rgba(90, 103, 216, 0.4); }

/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 1800px) {
    .rewards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1600px) {
    .cup-top-section { grid-template-columns: 320px 1fr; }
}

@media (max-width: 1400px) {
    #cup-history-list { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .battle-cup-container { max-width: 95%; padding: 0 15px; }
    #cup-history-list { grid-template-columns: 1fr; }
    .cup-top-section { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .rewards-grid { grid-template-columns: 1fr; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


.btn-remove-row {
    background: #ffffff; 
    border: none;
    color: #333; 
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; 
    height: 28px;
    border-radius: 4px;
    transition: all 0.2s ease;
    outline: none !important;
}

.btn-remove-row:hover {
    background: #e74c3c; 
    color: #fff;
    transform: scale(1.05);
}


.winner-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: center; 
}


.winner-input-row input {
    margin-bottom: 0 !important;
}

/* =========================================
   АДАПТАЦИЯ ПОД СВЕТЛУЮ ТЕМУ 
   ========================================= */


.light-theme .games-header-text h2 {
    color: #0056b3 !important; 
    text-shadow: none !important; 
    font-weight: 800; 
}
.light-theme .games-header-text p {
    color: #444444; 
}


.light-theme .cup-timer-card,
.light-theme .reward-card,
.light-theme .cup-winners-sidebar,
.light-theme .closed-cup-card {
    background: #ffffff;
    
    border-color: var(--accent-color); 
    box-shadow: 0 4px 15px rgba(44, 143, 255, 0.1); 
}

.light-theme .reward-card:hover,
.light-theme .closed-cup-card:hover {
    box-shadow: 0 8px 25px rgba(44, 143, 255, 0.25);
}


.light-theme .cup-timer-card::before {
    background: radial-gradient(circle, rgba(255, 165, 0, 0.1) 0%, transparent 60%);
}
.light-theme .cup-title { color: #333; }
.light-theme .timer-label { color: #666; }
.light-theme .timer-display {
    color: #ff8c00; 
    text-shadow: none; 
}
.light-theme .timer-display span { color: #444; }


.light-theme .section-title { color: #333; border-bottom-color: #eee; }
.light-theme .section-header { border-bottom-color: #eee; }
.light-theme .reward-title { color: #333; }
.light-theme .reward-order-badge {
    background: rgba(0,0,0,0.05);
    color: #666;
}
.light-theme .reward-vimer-footer {
    background: rgba(44, 143, 255, 0.08);
    border-top-color: rgba(44, 143, 255, 0.15);
}


.light-theme .sidebar-winner-item,
.light-theme .closed-winner-item {
    background: #f5f7fa; 
    border-color: #e6e6e6;
}
.light-theme .closed-winner-name {
    color: #333 !important; 
}
.light-theme .closed-winner-place {
    color: #999;
}
.light-theme .closed-cup-header {
    border-bottom-color: #eee;
}
.light-theme .closed-cup-week { color: #333; }
.light-theme .closed-cup-date { color: #888; }


.light-theme .leaders-table th {
    background: #f0f2f5; 
    color: #555;
    border-bottom: 1px solid #ddd;
}
.light-theme .leaders-table td {
    color: #333;
    border-bottom: 1px solid #eee;
}
.light-theme .leaders-table tr:hover td {
    background: #eef6ff; 
}
.light-theme .leader-name { color: #333; }


.light-theme .tab-btn {
    background: #f0f0f0;
    color: #666;
    border-color: #ccc;
}
.light-theme .tab-btn.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}


.light-theme .modal-content {
    background-color: #ffffff;
    border-color: var(--accent-color); 
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
.light-theme .modal-content h3, 
.light-theme .modal-content h2 {
    color: #333;
}
.light-theme .form-group label {
    color: #555;
}
.light-theme .form-input,
.light-theme .modal-content input, 
.light-theme .modal-content select {
    background-color: #f9f9f9;
    border-color: #ccc;
    color: #333;
}
.light-theme .form-input:focus {
    background-color: #fff;
    border-color: var(--accent-color);
}
.light-theme .close-modal {
    color: #888;
}
.light-theme .close-modal:hover {
    background: #eee;
    color: #000;
}


.light-theme .btn-remove-row {
    background: #e0e0e0;
    color: #555;
}
.light-theme .btn-remove-row:hover {
    background: #e74c3c;
    color: #fff;
}


.light-theme .history-list-container,
.light-theme .leaders-table-container {
    background-color: transparent !important; 
    box-shadow: none !important;              
    border: none !important;                  
    padding: 0 !important;                    
}


.light-theme .section-title,
.light-theme .section-header,
.light-theme .closed-cup-header {
    border-bottom-color: var(--accent-color) !important; 
}

.light-theme .reward-card.recurring-card { border-color: #ffd700; box-shadow: 0 0 15px rgba(255, 215, 0, 0.1); }


.light-theme .reward-title,
.light-theme .section-title {
    color: #000 !important; 
}

/* СТИЛИ ДЛЯ ЗАГРУЗКИ ФАЙЛОВ */

input[type="file"] {
    font-size: 13px;
    color: #ccc; 
    background: rgba(0,0,0,0.2);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}


input[type="file"]::file-selector-button {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--accent-color);
    padding: 4px 10px;
    border-radius: 6px;
    margin-right: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s;
    font-family: inherit;
}


input[type="file"]::file-selector-button:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}



.light-theme input[type="file"] {
    color: #333 !important;       
    background: #f9f9f9 !important; 
    border-color: #ccc !important;
}

