/* ═══════════════════════════════════════════
   Opening Explorer Panel — Aura Chess
   Premium glassmorphism design
   ═══════════════════════════════════════════ */

/* ── Container (.explorer-section integrated in data-panel) ── */
.explorer-section {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    transition: opacity 0.3s ease;
}

.explorer-section.hidden {
    display: none;
}

/* ── Header ── */
.explorer-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(0, 200, 255, 0.04) 0%, transparent 100%);
}

.explorer-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #00C8FF;
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    text-shadow: 0 0 12px rgba(0, 200, 255, 0.3);
}

.explorer-title i {
    font-size: 0.85rem;
    filter: drop-shadow(0 0 4px rgba(0, 200, 255, 0.4));
}

.explorer-opening-name {
    flex: 1;
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: end;
    direction: ltr;
    transition: color 0.3s ease;
}

.explorer-opening-name .eco-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    color: #00C8FF;
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.15), rgba(0, 200, 255, 0.08));
    padding: 2px 6px;
    border-radius: 4px;
    margin-inline-end: 5px;
    letter-spacing: 0.6px;
    border: 1px solid rgba(0, 200, 255, 0.15);
}

.explorer-close {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #64748b;
    cursor: pointer;
    font-size: 0.75rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.explorer-close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    transform: scale(1.05);
}

/* ── Table ── */
.explorer-table-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 0;
}

.explorer-table-wrapper::-webkit-scrollbar {
    width: 3px;
}

.explorer-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.explorer-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 200, 255, 0.15);
    border-radius: 4px;
}

.explorer-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 200, 255, 0.3);
}

.explorer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.explorer-table thead th {
    font-size: 0.62rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    background: rgba(8, 12, 20, 0.98);
    z-index: 2;
}

.explorer-table thead th:first-child {
    text-align: start;
    padding-inline-start: 16px;
}

.explorer-table tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
    animation: exp-fade-in 0.35s ease forwards;
    opacity: 0;
}

.explorer-table tbody tr:nth-child(1) {
    animation-delay: 0.00s;
}

.explorer-table tbody tr:nth-child(2) {
    animation-delay: 0.04s;
}

.explorer-table tbody tr:nth-child(3) {
    animation-delay: 0.07s;
}

.explorer-table tbody tr:nth-child(4) {
    animation-delay: 0.10s;
}

.explorer-table tbody tr:nth-child(5) {
    animation-delay: 0.13s;
}

.explorer-table tbody tr:nth-child(6) {
    animation-delay: 0.15s;
}

.explorer-table tbody tr:nth-child(7) {
    animation-delay: 0.17s;
}

.explorer-table tbody tr:nth-child(8) {
    animation-delay: 0.19s;
}

.explorer-table tbody tr:nth-child(9) {
    animation-delay: 0.21s;
}

.explorer-table tbody tr:nth-child(10) {
    animation-delay: 0.23s;
}

@keyframes exp-fade-in {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.explorer-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(0, 200, 255, 0.06), rgba(0, 200, 255, 0.02));
}

.explorer-table tbody tr:active {
    background: rgba(0, 200, 255, 0.12);
}

.explorer-table tbody td {
    padding: 9px 6px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
    color: #94a3b8;
    font-size: 0.78rem;
    transition: all 0.2s ease;
}

.explorer-table tbody td:first-child {
    text-align: start;
    padding-inline-start: 16px;
}

.explorer-table tbody tr:hover td {
    color: #cbd5e1;
}

/* ── Move SAN styling ── */
.explorer-move-san {
    color: #00C8FF;
    font-weight: 700;
    font-family: 'Montserrat', 'Consolas', monospace;
    letter-spacing: 0.3px;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.explorer-table tbody tr:hover .explorer-move-san {
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.35);
    color: #33d6ff;
}

/* ── Top Move (best move) ── */
.explorer-top-move td {
    background: linear-gradient(90deg, rgba(214, 78, 219, 0.05), transparent);
}

.explorer-top-move .explorer-move-san {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
}

.explorer-top-move td:first-child::after {
    content: ' ★';
    color: #D64EDB;
    font-size: 0.6rem;
    filter: drop-shadow(0 0 3px rgba(214, 78, 219, 0.5));
    animation: star-pulse 2s ease infinite;
}

@keyframes star-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ── Win/Draw/Loss Bar ── */
.win-bar {
    display: flex;
    height: 4px;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 5px;
    min-width: 55px;
    background: rgba(255, 255, 255, 0.03);
}

.win-bar-white {
    background: linear-gradient(90deg, #f0f0f0, #d4d4d4);
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 3px 0 0 3px;
}

.win-bar-draw {
    background: #64748b;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.win-bar-black {
    background: linear-gradient(90deg, #334155, #1e293b);
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 0 3px 3px 0;
}

/* ── Result Legend Icons ── */
.explorer-king-icon {
    width: 10px;
    height: 10px;
    vertical-align: middle;
    margin-inline-end: 2px;
    opacity: 0.9;
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.05));
}

.explorer-draw-icon {
    font-size: 9px;
    color: #94a3b8;
    vertical-align: middle;
    margin-inline-end: 2px;
    display: inline-block;
}

/* ── Loading State ── */
.explorer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 35px 16px;
    gap: 12px;
    color: #475569;
    font-size: 0.78rem;
}

.explorer-loading .spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid rgba(0, 200, 255, 0.1);
    border-top-color: #00C8FF;
    border-radius: 50%;
    animation: exp-spin 0.7s linear infinite;
    filter: drop-shadow(0 0 6px rgba(0, 200, 255, 0.25));
}

@keyframes exp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Empty State ── */
.explorer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 35px 16px;
    gap: 8px;
    color: #334155;
    text-align: center;
}

.explorer-empty p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
}

.explorer-empty p:first-of-type {
    color: #475569;
}

.explorer-empty i {
    font-size: 1.6rem;
    color: #1e293b;
    margin-bottom: 4px;
    opacity: 0.6;
}

/* ── Source Footer ── */
.explorer-source {
    padding: 8px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.65rem;
    color: #334155;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.3px;
    transition: color 0.3s ease;
}

/* ── Toggle Button ── */
.btn-explorer {
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.08), rgba(0, 200, 255, 0.04));
    border: 1px solid rgba(0, 200, 255, 0.2);
    color: #00C8FF;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Cairo', sans-serif;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .btn-explorer .explorer-text {
        display: none;
    }
    .btn-explorer {
        padding: 8px;
        min-width: 40px;
        justify-content: center;
        font-size: 1rem;
    }
}

.btn-explorer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 0.08), transparent);
    transition: left 0.4s ease;
}

.btn-explorer:hover::before {
    left: 100%;
}

.btn-explorer:hover {
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.15), rgba(0, 200, 255, 0.08));
    border-color: rgba(0, 200, 255, 0.4);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.12);
    transform: translateY(-1px);
}

.btn-explorer.active {
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.18), rgba(0, 200, 255, 0.1));
    border-color: #00C8FF;
    box-shadow:
        0 0 20px rgba(0, 200, 255, 0.15),
        inset 0 0 8px rgba(0, 200, 255, 0.05);
    color: #fff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .explorer-panel {
        width: 280px;
        right: -300px;
        max-height: 65vh;
        border-radius: 14px;
    }

    .explorer-panel.open {
        right: 8px;
    }
}

/* ═══════════════════════════════════════════
   Create Course Page — Inline Explorer Panel
   Uses .opening-explorer and .oe-* classes
   ═══════════════════════════════════════════ */
.opening-explorer {
    display: flex;
    flex-direction: column;
    min-width: 240px;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.oe-header {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(0, 200, 255, 0.03) 0%, transparent 100%);
}

.oe-header-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #00C8FF;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 0 12px rgba(0, 200, 255, 0.3);
}

.oe-opening-name {
    padding: 6px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: color 0.3s ease;
}

.oe-opening-name.empty {
    color: #334155;
}

.oe-eco {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    color: #00C8FF;
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.15), rgba(0, 200, 255, 0.08));
    padding: 2px 6px;
    border-radius: 4px;
    margin-inline-end: 5px;
    border: 1px solid rgba(0, 200, 255, 0.12);
}

.oe-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.oe-table-container::-webkit-scrollbar {
    width: 3px;
}

.oe-table-container::-webkit-scrollbar-thumb {
    background: rgba(0, 200, 255, 0.15);
    border-radius: 4px;
}

.oe-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.oe-table thead th {
    font-size: 0.62rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    background: rgba(8, 12, 20, 0.98);
    z-index: 2;
}

.oe-table thead th:first-child {
    text-align: start;
    padding-inline-start: 14px;
}

.oe-table tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
    animation: exp-fade-in 0.35s ease forwards;
    opacity: 0;
}

.oe-table tbody tr:nth-child(1) {
    animation-delay: 0.00s;
}

.oe-table tbody tr:nth-child(2) {
    animation-delay: 0.04s;
}

.oe-table tbody tr:nth-child(3) {
    animation-delay: 0.07s;
}

.oe-table tbody tr:nth-child(4) {
    animation-delay: 0.10s;
}

.oe-table tbody tr:nth-child(5) {
    animation-delay: 0.13s;
}

.oe-table tbody tr:nth-child(6) {
    animation-delay: 0.15s;
}

.oe-table tbody tr:nth-child(7) {
    animation-delay: 0.17s;
}

.oe-table tbody tr:nth-child(8) {
    animation-delay: 0.19s;
}

.oe-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(0, 200, 255, 0.06), rgba(0, 200, 255, 0.02));
}

.oe-table tbody tr:active {
    background: rgba(0, 200, 255, 0.12);
}

.oe-table tbody td {
    padding: 7px 4px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.76rem;
    transition: all 0.2s ease;
}

.oe-table tbody td:first-child {
    text-align: start;
    padding-inline-start: 14px;
}

.oe-table tbody tr:hover td {
    color: #cbd5e1;
}

.oe-move-cell {
    color: #00C8FF;
    font-weight: 700;
    font-family: 'Montserrat', monospace;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.oe-table tbody tr:hover .oe-move-cell {
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.35);
    color: #33d6ff;
}

.oe-best-move td {
    background: linear-gradient(90deg, rgba(214, 78, 219, 0.05), transparent);
}

.oe-best-move .oe-move-cell {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
}

.oe-best-move .oe-move-cell::after {
    content: ' ★';
    color: #D64EDB;
    font-size: 0.55rem;
    filter: drop-shadow(0 0 3px rgba(214, 78, 219, 0.5));
}

.oe-games-cell {
    color: #64748b;
    font-size: 0.7rem;
}

.oe-wdl-bar {
    display: flex;
    height: 4px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
}

.oe-wdl-w {
    background: linear-gradient(90deg, #f0f0f0, #d4d4d4);
    transition: width 0.5s ease;
}

.oe-wdl-d {
    background: #64748b;
    transition: width 0.5s ease;
}

.oe-wdl-b {
    background: linear-gradient(90deg, #334155, #1e293b);
    transition: width 0.5s ease;
}

.oe-wdl-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.58rem;
    color: #475569;
    margin-top: 3px;
}

.oe-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 14px;
    gap: 10px;
    color: #475569;
    font-size: 0.78rem;
}

.oe-spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(0, 200, 255, 0.1);
    border-top-color: #00C8FF;
    border-radius: 50%;
    animation: exp-spin 0.7s linear infinite;
    filter: drop-shadow(0 0 4px rgba(0, 200, 255, 0.2));
}

.oe-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 14px;
    gap: 6px;
    color: #334155;
    text-align: center;
    font-size: 0.78rem;
}

.oe-empty i {
    font-size: 1.4rem;
    color: #1e293b;
    opacity: 0.6;
}

.oe-footer {
    padding: 7px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.6rem;
    color: #334155;
    text-align: center;
    flex-shrink: 0;
}

.oe-footer a {
    color: #00C8FF;
    text-decoration: none;
    transition: color 0.2s ease;
}

.oe-footer a:hover {
    color: #33d6ff;
}