/* ============================================
   PAGE: SCHEDULER
   ============================================ */
.page-scheduler {
    padding: 20px;
}

.page-scheduler h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.8em;
    color: var(--accent-purple);
}

.scheduler-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 1em;
}

.scheduler-info {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95em;
}

.server-time-label {
    color: var(--accent-purple);
    font-weight: 600;
}

.user-time-label {
    color: #a8e063;
    font-weight: 600;
}

.schedule-table-wrapper {
    max-width: 900px;
    margin: 0 auto 30px;
}

.schedule-table {
    width: 100%;
    background: var(--bg-panel-solid);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-dim);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.schedule-table th {
    background: #23233a;
    color: var(--accent-purple);
    padding: 15px;
    text-align: left;
    font-size: 1.1em;
    border-bottom: 2px solid var(--border-dim);
}

.schedule-table td {
    padding: 15px;
    border-bottom: 1px solid #29293a;
    color: var(--text-primary);
}

.schedule-table tr:last-child td {
    border-bottom: none;
}

.schedule-table tr:hover {
    background: rgba(181, 101, 245, 0.05);
    transition: background 0.2s;
}

.schedule-day {
    font-weight: bold;
    color: var(--accent-purple);
    width: 120px;
    white-space: nowrap;
    vertical-align: top;
}

.schedule-events {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.event-time {
    font-weight: bold;
    color: var(--accent-purple);
    min-width: 60px;
}

.event-name {
    color: var(--text-primary);
    flex: 1;
    min-width: 200px;
}

.event-local {
    color: #a8e063;
    font-size: 0.95em;
    white-space: nowrap;
}

.schedule-notes {
    text-align: center;
    font-size: 0.78em;
    color: #8a8a8a;
    width: min(1000px, 96%);
    line-height: 1.45;
    margin: 10px auto 0;
    font-style: italic;
}

.is-hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .page-scheduler h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }

    .scheduler-subtitle {
        font-size: 0.9em;
        margin-bottom: 15px;
    }

    .scheduler-info {
        font-size: 0.85em;
        margin-bottom: 20px;
    }

    .schedule-table {
        font-size: 0.9em;
    }

    .schedule-table th,
    .schedule-table td {
        padding: 10px;
    }

    .schedule-day {
        width: 90px;
        font-size: 0.9em;
    }

    .event-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .event-name {
        min-width: auto;
        font-size: 0.9em;
    }

    .event-local {
        font-size: 0.85em;
    }
}

.scheduler-controls {
    display: flex;
    justify-content: flex-start;
    margin: 12px 0 6px 0;
}

#toggleEmptyHoursBtn,
.plain-button {
    background: rgba(30, 30, 40, 0.6);
    backdrop-filter: blur(5px);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

#toggleEmptyHoursBtn:hover,
.plain-button:hover {
    background: rgba(181, 101, 245, 0.12);
    border-color: var(--accent-purple);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 15px rgba(181, 101, 245, 0.16);
}

#toggleEmptyHoursBtn[aria-pressed="true"] {
    background: linear-gradient(90deg, rgba(181,101,245,0.12), rgba(77,184,255,0.06));
    border-color: var(--accent-purple);
    box-shadow: 0 6px 18px rgba(181,101,245,0.12);
    color: #fff;
}

@media (max-width: 480px) {
    .page-scheduler h1 {
        font-size: 1.5em;
    }

    .scheduler-subtitle,
    .scheduler-info {
        font-size: 0.8em;
    }

    .schedule-table {
        font-size: 0.8em;
    }

    .schedule-table th,
    .schedule-table td {
        padding: 8px;
    }

    .schedule-day {
        width: 70px;
        font-size: 0.85em;
    }

    .event-time {
        min-width: 50px;
        font-size: 0.9em;
    }

    .event-name {
        font-size: 0.85em;
    }
}/* ============================================
   PAGE: SCHEDULER (UPDATED GRID VERSION)
   ============================================ */

.page-scheduler {
    background: linear-gradient(135deg, var(--primary-gradient-1) 0%, var(--primary-gradient-2) 50%, var(--primary-gradient-3) 100%);
}

.page-scheduler h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.8em;
    color: var(--accent-purple);
    text-shadow: 0 0 20px rgba(181, 101, 245, 0.3);
}

/* Time Display Section */
.time-display-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.time-box {
    background: rgba(22, 22, 35, 0.8);
    backdrop-filter: blur(12px);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(181, 101, 245, 0.3);
    text-align: center;
    box-shadow: 0 8px 32px rgba(181, 101, 245, 0.15);
}

.time-box.server-time { border-color: rgba(196, 156, 58, 0.3); }
.time-box.game-time { border-color: rgba(66, 165, 245, 0.3); }
.time-box.local-time { border-color: rgba(168, 224, 99, 0.3); }

.time-label {
    font-size: 0.9em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.time-value {
    font-size: 2.2em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    margin-bottom: 8px;
}

.time-box.server-time .time-value { color: #c49c3a; }
.time-box.game-time .time-value { color: #42a5f5; }
.time-box.local-time .time-value { color: #a8e063; }

.time-date {
    font-size: 0.95em;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

/* Legend */
.page-scheduler .legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin-bottom: 30px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.page-scheduler .legend-item {
    background: rgba(22, 22, 35, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(181, 101, 245, 0.2);
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-scheduler .legend-item:hover {
    background: rgba(22, 22, 35, 0.9);
    border-color: rgba(181, 101, 245, 0.5);
}

.page-scheduler .legend-item.active { opacity: 1; }
/* Remove automatic dimming of legend items on click - keep full opacity */
.page-scheduler .legend-item:not(.active) { opacity: 1; }

.page-scheduler .legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.altar { background: linear-gradient(135deg, #c49c3a 0%, #8b6f1f 100%); }
.agent { background: linear-gradient(135deg, #42a5f5 0%, #0d47a1 100%); }
.npc { background: linear-gradient(135deg, #6a42f5 0%, #3a2bd8 100%); }
.fortress { background: linear-gradient(135deg, #ef5350 0%, #c62828 100%); }
.arena-chaos { background: linear-gradient(135deg, #ab47bc 0%, #6a1b9a 100%); }

/* Scheduler Grid */
.scheduler-grid-wrapper {
    max-width: 1400px;
    margin: 0 auto 40px;
    background: rgba(22, 22, 35, 0.7);
    backdrop-filter: blur(12px);
    border-radius: 15px;
    border: 1px solid rgba(181, 101, 245, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow-x: auto;
    overflow-y: auto;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: rgba(181, 101, 245, 0.6) rgba(181, 101, 245, 0.15);
}

.scheduler-grid-wrapper::-webkit-scrollbar {
    width: 10px;
}

.scheduler-grid-wrapper::-webkit-scrollbar-track {
    background: rgba(181, 101, 245, 0.08);
    border-radius: 10px;
}

.scheduler-grid-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(181, 101, 245, 0.5) 0%, rgba(181, 101, 245, 0.7) 100%);
    border-radius: 10px;
    border: 2px solid rgba(181, 101, 245, 0.08);
}

.scheduler-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(181, 101, 245, 0.7) 0%, rgba(181, 101, 245, 0.9) 100%);
}

.scheduler-header {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 8px;
    padding: 20px 20px 15px 20px;
    border-bottom: 2px solid rgba(181, 101, 245, 0.2);
    font-weight: 700;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    background: rgba(22, 22, 35, 0.95);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.day-header:first-child {
    grid-column: 1;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 10px;
    color: var(--text-muted);
    font-size: 0.85em;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.day-header {
    background: linear-gradient(135deg, rgba(181, 101, 245, 0.2) 0%, rgba(181, 101, 245, 0.05) 100%);
    border: 1px solid rgba(181, 101, 245, 0.3);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    color: var(--accent-purple);
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.day-header.today {
    background: rgba(181, 101, 245, 0.25);
    border: 2px solid #b565f5;
    color: #fff;
    font-weight: 700;
    box-shadow: none;
    position: relative;
}

.day-header.today::after {
    content: 'TODAY';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: #b565f5;
    color: white;
    font-size: 0.35em;
    padding: 3px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    font-weight: bold;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.current-day-cell {
    background: rgba(181, 101, 245, 0.06) !important;
}

.scheduler-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 8px;
    grid-auto-rows: minmax(35px, auto);
    box-sizing: border-box;
    padding: 0 20px 20px 20px;
}

.hour-label {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(181, 101, 245, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
    padding: 10px;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hour-label-empty {
    min-height: 2px;
    padding: 0;
    background: rgba(181, 101, 245, 0.1);
    border: none;
}

.current-hour-label {
    background: rgba(181, 101, 245, 0.35) !important;
    border-left: 3px solid #b565f5 !important;
    font-weight: 700;
    color: #dcb0ff !important;
}

.scheduler-cell {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(181, 101, 245, 0.1);
    border-radius: 8px;
    min-height: 35px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 2px;
    padding: 2px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.scheduler-cell-empty {
    min-height: 35px;
    border: none;
    background: transparent;
    border-bottom: 1px solid rgba(181, 101, 245, 0.05);
}

.current-day-cell {
    background: linear-gradient(to bottom, rgba(181, 101, 245, 0.08), rgba(181, 101, 245, 0.08)) !important;
    background-attachment: fixed;
}

.current-hour-cell {
    /* match day header 'today' border effect */
    background: rgba(181, 101, 245, 0.12);
    border: 2px solid #b565f5;
    color: #fff;
    font-weight: 700;
    min-height: 35px;
}

/* Halo glow for the current hour cell (applies to whole tile, not event) */

.scheduler-cell:hover {
    background: rgba(181, 101, 245, 0.08);
    border-color: rgba(181, 101, 245, 0.3);
}

.scheduler-event {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 600;
    font-size: 1.1em;
    padding: 4px 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex: 1;
    min-height: 0;
}

.scheduler-event:hover {
    filter: brightness(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.scheduler-event.event-altar {
    background: linear-gradient(135deg, #c49c3a 0%, #8b6f1f 100%);
    color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.55);
}

.scheduler-event.event-agent {
    background: linear-gradient(135deg, #42a5f5 0%, #1565c0 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.scheduler-event.event-npc {
    background: linear-gradient(135deg, #6a42f5 0%, #3a2bd8 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.scheduler-event.event-fortress {
    background: linear-gradient(135deg, #ef5350 0%, #c62828 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.scheduler-event.event-arena {
    background: linear-gradient(135deg, #ab47bc 0%, #6a1b9a 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

/* Continuation style for multi-hour events (same size, subtle visual cue) */
.scheduler-event.event-continuation {
    opacity: 0.7;
    border-style: dashed;
}

/* Row group for same-minute events (side-by-side) */
.event-row-group {
    display: flex;
    gap: 2px;
    flex: 1;
    min-height: 0;
}

.scheduler-cell-split {
    display: flex;
    gap: 2px;
    flex: 1;
    min-height: 0;
}

.scheduler-split-primary {
    flex: 7;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    min-height: 0;
}

.scheduler-split-secondary {
    flex: 3;
    display: flex;
    min-width: 0;
    min-height: 0;
}

.scheduler-split-secondary .scheduler-event {
    font-size: 0.82em;
}



/* Add a subtle outer stroke for non-event tiles to improve contrast against event gradients */
.scheduler-cell {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.01);
}

.event-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    font-size: 0.85em;
}

/* Events Section */
.event-section {
    max-width: 900px;
    margin: 30px auto;
    padding: 25px;
    background: rgba(22, 22, 35, 0.8);
    backdrop-filter: blur(12px);
    border-radius: 15px;
    border: 2px solid rgba(181, 101, 245, 0.4);
    text-align: center;
    box-shadow: 0 10px 30px rgba(181, 101, 245, 0.1);
}

.event-title {
    font-size: 1.1em;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.event-info {
    font-size: 2em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--accent-purple);
}

.event-info.event-type-altar {
    color: #c49c3a;
}

.event-info.event-type-agent {
    color: #42a5f5;
}

.event-info.event-type-npc {
    color: #5442f5;
}

.event-info.event-type-fortress {
    color: #ef5350;
}

.event-info.event-type-arena {
    color: #ab47bc;
}

.event-details-panel {
    max-width: 900px;
    margin: 0 auto 22px;
    padding: 18px 20px 20px;
    background: linear-gradient(180deg, rgba(22, 22, 35, 0.96) 0%, rgba(17, 17, 28, 0.92) 100%);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(181, 101, 245, 0.28);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.42), 0 0 24px rgba(181, 101, 245, 0.08);
}

.ed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.ed-title {
    font-size: 1.35em;
    font-weight: 700;
    color: #fff;
}

.ed-close {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(181, 101, 245, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ed-close:hover,
.ed-close:focus-visible {
    background: rgba(181, 101, 245, 0.16);
    border-color: rgba(181, 101, 245, 0.55);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
    outline: none;
}

.ed-meta {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(181, 101, 245, 0.12);
    color: #e5d6f8;
    font-size: 0.9em;
    letter-spacing: 0.02em;
}

.ed-body {
    display: grid;
    gap: 12px;
}

.event-detail-card {
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(181, 101, 245, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.event-detail-card:last-child {
    margin-bottom: 0;
}

.event-detail-name {
    font-size: 1.05em;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.event-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.event-detail-item {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(181, 101, 245, 0.06);
    color: var(--text-primary);
    line-height: 1.4;
}

.event-detail-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.event-detail-copy {
    color: #dcd5ea;
    line-height: 1.55;
}

/* Responsive */
@media (max-width: 1200px) {
    .scheduler-grid-wrapper { margin-left: 5%; margin-right: 5%; padding: 15px; }
    .scheduler-header, .scheduler-grid { grid-template-columns: 60px repeat(7, 1fr); gap: 6px; }
    .hour-label { font-size: 0.7em; padding: 8px 4px; }
    .scheduler-cell { min-height: 35px; }
    .scheduler-event { font-size: 0.65em; }
    .day-header { font-size: 0.85em; padding: 8px 4px; }
    .day-header:first-child { padding: 8px 4px; }
}

@media (max-width: 768px) {
    .time-display-section { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 15px; }
    .page-scheduler h1 { font-size: 2em; margin-bottom: 20px; }
    .time-value { font-size: 0.8em; }
    .time-label { font-size: 0.5em; }
    .time-date { font-size: 0.65em; }
    .scheduler-grid-wrapper { margin-left: 0; margin-right: 0; border-radius: 10px; padding: 10px; max-height: 680px; }
    .scheduler-header, .scheduler-grid { grid-template-columns: 50px repeat(7, 1fr); gap: 4px; }
    .hour-label { font-size: 0.6em; padding: 6px 3px; }
    .scheduler-cell { min-height: 30px; }
    .scheduler-event { font-size: 0.6em; padding: 2px 4px; }
    .event-label { font-size: 0.7em; }
    .day-header { display: flex; align-items: center; justify-content: center; font-size: 0.75em; padding: 6px 3px; }
    .day-header:first-child { padding: 6px 3px; }
    .event-info { font-size: 1em; }
    .page-scheduler .legend { gap: 10px; margin-bottom: 20px; }
    .page-scheduler .legend-item { padding: 8px 12px; font-size: 0.85em; }
    .legend-color { width: 12px !important; height: 12px !important; }
    .scheduler-controls { justify-content: flex-start; }
    .event-details-panel { padding: 16px; }
    .ed-header { gap: 12px; }
    .ed-title { font-size: 1.15em; }
    .ed-close { width: 34px; height: 34px; }
    .ed-meta { display: flex; border-radius: 12px; }
    .event-detail-grid { grid-template-columns: 1fr; }
}
