/* ============================================================
   ASIDE MENU POPUPS (EVENTS & CASTLE SIEGE)
   Independent Styles - No Global Dependencies
   ============================================================ */

/* --- 1. OVERLAY --- */
.aside-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(5, 7, 10, 0.31);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    justify-content: center;
    align-items: center; /* Centered vertically */
    padding: 20px;
}

.aside-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* --- 2. CARD --- */
.aside-popup-card {
    position: relative;
    width: 73%;
    max-width: 1200px;
    min-width: 320px;
    /* CHANGED: Use auto height to fit content, but max-height to fit screen */
    height: auto; 
    max-height: 95vh; /* Use almost full screen height */
    display: flex;
    flex-direction: column;
    background: rgba(6, 9, 12, 0.95); /* Slightly less transparent for readability */
    border: 1px solid rgba(255, 173, 51, 0.3);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(255, 173, 51, 0.05);
    border-radius: 8px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.aside-modal-overlay.active .aside-popup-card {
    transform: scale(1);
}

/* --- 3. CLOSE BUTTON --- */
.aside-close-btn {
    position: absolute;
    top: 15px; right: 15px; /* Tighter positioning */
    background: none;
    border: none;
    color: #5d6f85;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: 0.3s;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
}

.aside-close-btn:hover {
    color: #FFAD33;
    background: rgba(255, 173, 51, 0.1);
    transform: rotate(90deg);
}

/* --- 4. CONTENT WRAPPER --- */
.aside-content-wrapper {
    padding: 30px 40px; /* Reduced padding */
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent double scrollbars */
}

/* --- 5. HEADER --- */
.aside-header {
    border-bottom: 2px solid rgba(255, 173, 51, 0.15);
    padding-bottom: 15px; /* Reduced */
    margin-bottom: 15px; /* Reduced */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aside-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem; /* Slightly smaller */
    font-weight: 700;
    color: white;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 173, 51, 0.4);
    background: linear-gradient(to bottom, #fff, #aebfd6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.aside-subtitle {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    color: #FFAD33;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- 6. LIST --- */

/* Header Row */
.list-header-row {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px; /* Reduced padding */
    border-radius: 4px;
    margin-bottom: 5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0; /* Don't shrink header */
}

.list-col-name   { flex: 4; }
.list-col-time   { flex: 2; text-align: center; }
.list-col-timer  { flex: 2; text-align: center; }
.list-col-status { flex: 2; text-align: center; }

.list-header-row div {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    color: #5d6f85;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Scroll Area - Modified to fit */
.aside-scroll-area {
    flex-grow: 1;
    overflow-y: auto; /* Keep scroll just in case, but try to fit */
    padding-right: 5px;
}

/* Scrollbar */
.aside-scroll-area::-webkit-scrollbar { width: 4px; }
.aside-scroll-area::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.aside-scroll-area::-webkit-scrollbar-thumb { background: #FFAD33; border-radius: 3px; }

/* Event Item - Compact */
.ev-item {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
}

.ev-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.ev-item.active {
    background: rgba(255, 173, 51, 0.03);
    border-bottom: 1px solid rgba(255, 173, 51, 0.3);
}

/* Event Summary - Compact Padding */
.ev-summary {
    display: flex;
    align-items: center;
    padding: 12px 15px; /* Much reduced padding to fit more items */
    cursor: pointer;
}

.ev-name {
    flex: 4;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem; /* Slightly smaller font */
    font-weight: 600;
    color: #e0e6ed;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ev-arrow {
    font-size: 0.7rem;
    color: #444;
    transition: 0.3s;
}
.ev-item.active .ev-arrow { transform: rotate(90deg); color: #FFAD33; }

/* Timers */
.ev-time, .ev-timer {
    flex: 2; text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem; /* Slightly smaller */
    font-weight: 500;
    color: #8faab9;
}
.ev-timer span { font-weight: 700; text-shadow: 0 0 10px rgba(255, 173, 51, 0.5); }

.ev-status { flex: 2; text-align: center; }

/* Details */
.ev-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}
.ev-item.active .ev-details { max-height: 400px; }

.ev-details-inner {
    padding: 15px 20px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* Info Groups */
.as-info-group { display: flex; flex-direction: column; gap: 5px; }
.as-label { font-size: 0.65rem; color: #5d6f85; text-transform: uppercase; font-weight: 700; }
.as-value { font-size: 0.9rem; color: white; display: flex; align-items: center; gap: 8px; font-weight: 500; font-family: 'Montserrat', sans-serif;}

/* Drops */
.as-drops { display: flex; flex-wrap: wrap; gap: 6px; }
.as-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    color: #FFAD33;
    font-weight: 600;
    display: flex; align-items: center; gap: 6px;
    font-family: 'Montserrat', sans-serif;
}

/* Badges - Compact */
.as-badge { 
    padding: 4px 8px; 
    border-radius: 3px; 
    font-size: 0.7rem; 
    font-weight: 800; 
    font-family: 'Montserrat', sans-serif; 
    letter-spacing: 0.5px; 
    min-width: 70px; 
    display: inline-block;
}
.as-badge.open { color: #00e676; background: rgba(0, 230, 118, 0.1); border: 1px solid rgba(0, 230, 118, 0.2); box-shadow: 0 0 10px rgba(0,230,118,0.2); }
.as-badge.soon { color: #FFAD33; background: rgba(255, 173, 51, 0.1); border: 1px solid rgba(255, 173, 51, 0.2); }
.as-badge.closed { color: #5d6f85; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); }

/* --- MOBILE --- */
@media (max-width: 991px) {
    .aside-popup-card { width: 95%; height: 90vh; }
    .ev-details-inner { flex-direction: column; gap: 15px; }
}
@media (max-width: 600px) {
    .list-header-row { display: none; }
    .ev-summary { flex-wrap: wrap; gap: 5px; padding: 10px; }
    .ev-name { flex: 100%; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 5px; }
    .ev-time, .ev-timer, .ev-status { flex: 1; font-size: 0.9rem; }
    .aside-content-wrapper { padding: 15px; }
    .aside-title { font-size: 1.3rem; }
}
/* ============================================================
   CASTLE SIEGE SPECIFIC STYLES (Original Layout + Event Typography)
   ============================================================ */

/* Загальний контейнер (Дві колонки) */
.siege-layout {
    display: flex;
    height: 100%;
    gap: 30px;
    align-items: stretch; /* Однакова висота колонок */
    padding: 10px 0;
}

/* --- ЛІВА КОЛОНКА (ГІЛЬДІЯ) --- */
.siege-guild-section {
    flex: 1; /* Займає менше місця, ніж права частина */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    /* Стиль блоку (як у івентів, прозорий) */
    background: rgba(255, 255, 255, 0.01); 
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 30px;
    position: relative;
}

/* Логотип */
.guild-crest-glow {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
}

/* Світіння за логотипом (м'яке) */
.guild-crest-glow::before {
    content: '';
    position: absolute;
    width: 120%; height: 120%;
    background: radial-gradient(circle, rgba(255, 173, 51, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: 0;
}

.siege-guild-img {
    width: 100%; height: 100%;
    object-fit: contain;
    z-index: 1;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.5));
}

/* Інфо про гільдію */
.siege-guild-info { 
    text-align: center; 
    z-index: 2; 
    width: 100%; 
}

/* Label (Точно як .as-label в Event Timer) */
.siege-label {
    display: block;
    font-size: 0.7rem;          /* Розмір як в івентах */
    color: #5d6f85;             /* Колір як в івентах */
    text-transform: uppercase; 
    font-weight: 700; 
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* Назва гільдії (Стиль заголовків) */
.siege-guild-name {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 2.5rem;          /* Велика, солідна */
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(255, 173, 51, 0.2);
}

/* Рядок Майстра */
.siege-master-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 20px; /* Закруглені краї, як у тегів дропу */
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.siege-master-label {
    font-size: 0.7rem;
    color: #5d6f85;
    font-weight: 700;
    text-transform: uppercase;
}

.siege-master-val {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    color: #FFAD33;
    font-weight: 600;
}


/* --- ПРАВА КОЛОНКА (СТАТИСТИКА) --- */
.siege-stats-section {
    flex: 1.4; /* Права частина ширша */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Сітка карток */
.siege-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Дві колонки */
    gap: 10px;
    flex-grow: 1; /* Займає доступне місце */
}

/* Картка статистики (Стиль як рядки Event Item) */
.siege-stat-card {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: 0.2s;
}

.siege-stat-card:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 173, 51, 0.2);
}

/* Label (Точно як .as-label) */
.siege-stat-label {
    font-size: 0.7rem;
    color: #5d6f85;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Value (Точно як .ev-timer - цифри) */
.siege-stat-val {
    font-family: 'Rajdhani', sans-serif; /* Цифровий шрифт */
    font-size: 1.5rem;
    font-weight: 600;
    color: #aebfd6;
}

/* Кольорові модифікатори */
.text-green { color: #00e676; text-shadow: 0 0 10px rgba(0, 230, 118, 0.15); }
.text-red { color: #ff3d00; text-shadow: 0 0 10px rgba(255, 61, 0, 0.15); }
.text-gold { color: #FFAD33; }


/* --- ТАЙМЕР (НИЖНІЙ БЛОК) --- */
.siege-timer-container {
    /* Стиль як активний рядок івенту (active event item) */
    background: rgba(255, 173, 51, 0.03);
    border: 1px solid rgba(255, 173, 51, 0.2);
    padding: 25px 30px;
    border-radius: 4px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.siege-timer-left {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.siege-timer-label {
    font-size: 0.7rem;
    color: #FFAD33;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.siege-timer-sub {
    font-size: 0.8rem;
    color: #5d6f85;
    font-family: 'Montserrat', sans-serif;
}

.siege-timer-display {
    font-family: 'Rajdhani', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(255, 173, 51, 0.2);
}
/* ============================================================
   MOBILE FIXES (RESPONSIVE)
   ============================================================ */

@media (max-width: 768px) {

    /* 1. Виправляємо позиціонування Оверлею */
    .aside-modal-overlay {
        padding-top: 0;          /* Прибираємо відступ зверху */
        align-items: center;     /* Повертаємо центрування по вертикалі */
        padding: 15px;           /* Маленький відступ від країв екрану */
    }

    /* 2. Картка вікна (Робимо її меншою) */
    .aside-popup-card {
        width: 100%;             /* Ширина на весь контейнер (мінус падінги оверлею) */
        max-width: 400px;        /* Але не ширше 400px */
        height: auto;            /* Висота авто (по контенту) */
        max-height: 85vh;        /* Не більше 85% висоти екрану */
        margin: 0;               /* Прибираємо зайві марджини */
        display: flex;
        flex-direction: column;
    }

    /* 3. Внутрішній контейнер (Скрол ТУТ) */
    .aside-content-wrapper {
        padding: 20px;           /* Менші відступи всередині */
        overflow-y: auto;        /* Вмикаємо скрол, якщо контент не влазить */
        height: auto;
        max-height: 100%;
    }

    /* 4. Адаптація макета ЗАМКУ (Castle Siege) */
    .siege-layout {
        flex-direction: column;  /* Одна колонка */
        gap: 15px;
        padding: 0;
        height: auto;            /* Дозволяємо рости у висоту */
    }

    .siege-guild-section {
        padding: 20px;           /* Компактніше */
        min-height: auto;        /* Прибираємо мінімальну висоту */
    }

    .siege-guild-name {
        font-size: 1.8rem;       /* Менший шрифт назви */
    }

    .guild-crest-glow {
        width: 100px;            /* Менший логотип */
        height: 100px;
        margin-bottom: 15px;
    }

    /* 5. Адаптація макета ІВЕНТІВ (Event Timer) */
    .list-header-row {
        display: none;           /* Ховаємо шапку таблиці */
    }
    
    .ev-summary {
        padding: 12px 5px;       /* Щільніше */
        flex-wrap: wrap;         /* Перенос рядків */
        gap: 5px;
    }
    
    .ev-name {
        flex: 100%;              /* Назва на всю ширину */
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding-bottom: 5px;
        margin-bottom: 5px;
    }
    
    .ev-time, .ev-timer, .ev-status {
        flex: 1;                 /* Інші колонки рівномірно */
        font-size: 0.9rem;       /* Менший шрифт */
        text-align: left;        /* Вирівнювання зліва для читабельності */
    }
    
    /* Таймер вирівнюємо по центру або справа */
    .ev-timer { text-align: center; }
    .ev-status { text-align: right; }

    /* Деталі івенту */
    .ev-details-inner {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    /* 6. Кнопка закриття */
    .aside-close-btn {
        top: 10px; 
        right: 10px;
        width: 30px; 
        height: 30px;
        font-size: 1rem;
        background: rgba(0,0,0,0.5); /* Темніший фон, щоб було видно */
    }
    
    .aside-header {
        margin-right: 20px; /* Щоб текст не наліз на кнопку закриття */
    }
    .aside-title { font-size: 1.5rem; }
}