﻿/* -- mobile.css -- Verdict Alpha -- */
/* ── Mobile Touch Feedback ── */
.square.touch-active {
    background: var(--square-selected) !important;
    opacity: 0.85;
}

/* ── Responsive Board Sizing ── */
.board-wrapper {
    position: relative;
    flex: 0 1 min(calc(100vw - 32px), calc(100vh - 220px), 600px);
    min-width: 0;
    aspect-ratio: 1 / 1;
    max-width: min(calc(100vw - 32px), calc(100vh - 220px), 600px);
    margin: 0;
}

/* ── Mobile Layout Improvements ── */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    .board-wrapper {
        max-width: min(calc(100vw - 24px), calc(100vh - 180px), 500px);
    }
    .board-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    .board-controls button {
        flex: 1;
        min-width: 80px;
        min-height: 44px;
        font-size: 0.85rem;
    }
    .coord-ranks {
        font-size: 0.65rem;
        width: 16px;
    }
    .coord-files {
        font-size: 0.65rem;
        padding-left: 18px;
    }
}

@media (max-width: 480px) {
    .board-wrapper {
        max-width: min(calc(100vw - 16px), calc(100vh - 160px), 380px);
    }
    .square {
        font-size: 0.8rem;
    }
    .piece {
        background-size: contain;
    }
}

/* ── Bottom Navigation ── */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    /* Hide top tabs, show bottom nav */
    .mode-tabs {
        display: none;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--bg-dark, #1a1a2e);
        border-top: 1px solid var(--border, #2a2a4a);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .bottom-nav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px;
        background: none;
        border: none;
        color: var(--text-dim, #888);
        cursor: pointer;
        min-height: 56px;
        transition: color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-btn.active {
        color: var(--accent, #00d9a5);
    }

    .bottom-nav-btn:active {
        opacity: 0.7;
    }

    .bnav-icon {
        font-size: 1.3rem;
        line-height: 1;
    }

    .bnav-label {
        font-size: 0.6rem;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        white-space: nowrap;
    }

    /* Push content above bottom nav */
    .app {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    /* ── Hamburger Button ── */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: var(--bg-light, #2a2a4a);
        border: 1px solid var(--border, #3a3a5a);
        border-radius: 8px;
        color: var(--text, #e0e0e0);
        font-size: 1.3rem;
        cursor: pointer;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }

    /* ── Mobile Drawer ── */
    .mobile-drawer {
        background: var(--bg-dark, #1a1a2e);
        border-bottom: 1px solid var(--border, #2a2a4a);
        padding: 12px 16px;
        animation: drawerSlide 0.18s ease;
    }

    @keyframes drawerSlide {
        from {
            opacity: 0;
            transform: translateY(-6px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .drawer-section {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .drawer-user-bar {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .drawer-lang {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .drawer-lang label {
        font-size: 0.85rem;
        color: var(--text-dim, #888);
        white-space: nowrap;
    }

    .drawer-lang select {
        background: var(--bg-light, #2a2a4a);
        border: 1px solid var(--border, #3a3a5a);
        border-radius: 6px;
        color: var(--text, #e0e0e0);
        padding: 6px 8px;
        font-size: 0.9rem;
    }

    /* Hide the desktop lang-selector and header-controls clutter */
    .lang-selector {
        display: none;
    }
}

/* Desktop: hamburger hidden */
@media (min-width: 769px) {
    .hamburger-btn {
        display: none;
    }
    .mobile-drawer {
        display: none !important;
    }
}

/* ── Landscape orientation ── */
@media (max-width: 900px) and (orientation: landscape) {
    .bottom-nav {
        top: 0;
        bottom: auto;
        right: 0;
        left: auto;
        width: 64px;
        height: 100dvh;
        flex-direction: column;
        border-top: none;
        border-left: 1px solid var(--border, #2a2a4a);
        padding-bottom: 0;
        padding-right: env(safe-area-inset-right, 0px);
    }

    .app {
        padding-bottom: 8px;
        padding-right: calc(64px + env(safe-area-inset-right, 0px));
    }

    .bnav-label {
        display: none;
    }

    .bottom-nav-btn {
        min-height: 52px;
        width: 64px;
    }
}

/* ── Radar chart responsive ── */
#dashRadarCanvas {
    width: 100%;
    height: auto;
    max-width: 300px;
}
