/* assets/css/mobile-app.css - Professional Card-Based Mobile Interface */

:root {
    --gold: #ffd700;
    --gold-glow: rgba(255, 215, 0, 0.4);
    --bg-dark: #05050a;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 215, 0, 0.15);
    --glass: rgba(10, 10, 15, 0.8);
    --text-muted: rgba(255, 255, 255, 0.6);
}

@media (max-width: 768px) {
    body {
        background: var(--bg-dark) !important;
        overflow-y: auto !important;
        /* Allow vertical scrolling on dashboard */
        overflow-x: hidden !important;
        touch-action: pan-y;
        position: relative;
    }

    /* Hide Desktop Elements */
    #desktopWorld,
    .auth-nav {
        display: none !important;
    }

    /* Fixed Profile Dropdown for Mobile */
    .profile-dropdown {
        position: fixed !important;
        top: 75px !important;
        right: 20px !important;
        z-index: 3000 !important;
        min-width: 200px !important;
    }

    /* Mobile App Container */
    #mobileApp {
        display: flex !important;
        flex-direction: column;
        min-height: 100vh;
        padding: 80px 20px 100px 20px;
        background: radial-gradient(circle at top, #1a1a2e 0%, var(--bg-dark) 70%);
    }

    /* App Header */
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: var(--glass);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        z-index: 2000;
        border-bottom: 1px solid var(--card-border);
    }

    .mobile-header .logo img {
        height: 35px;
    }

    /* User Welcome Section */
    .welcome-section {
        margin-bottom: 30px;
        animation: fadeInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .welcome-section h1 {
        font-family: 'Cinzel', serif;
        font-size: 1.8rem;
        color: var(--gold);
        text-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
        margin-bottom: 5px;
    }

    .welcome-section p {
        color: var(--text-muted);
        font-size: 0.9rem;
    }

    /* Bento Grid Dashboard */
    .kingdom-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 40px;
    }

    .kingdom-card {
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 20px;
        padding: 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        text-decoration: none;
        backdrop-filter: blur(10px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
        opacity: 0;
        animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .kingdom-card:nth-child(1) {
        animation-delay: 0.1s;
    }

    .kingdom-card:nth-child(2) {
        animation-delay: 0.2s;
    }

    .kingdom-card:nth-child(3) {
        animation-delay: 0.3s;
    }

    .kingdom-card:nth-child(4) {
        animation-delay: 0.4s;
    }

    .kingdom-card:active {
        transform: scale(0.95);
        background: rgba(255, 215, 0, 0.05);
    }

    .kingdom-card img {
        width: 60px;
        height: 60px;
        margin-bottom: 12px;
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.2));
    }

    .kingdom-card h3 {
        font-family: 'Cinzel', serif;
        font-size: 0.9rem;
        color: #fff;
        margin: 0;
        letter-spacing: 1px;
    }

    .kingdom-card.large {
        grid-column: span 2;
        flex-direction: row;
        justify-content: flex-start;
        gap: 20px;
        padding: 15px 25px;
    }

    .kingdom-card.large img {
        margin-bottom: 0;
        width: 50px;
        height: 50px;
    }

    /* Citizen HUB Section */
    .section-title {
        font-family: 'Cinzel', serif;
        color: #fff;
        font-size: 1.1rem;
        margin-bottom: 20px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .citizen-hub {
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 24px;
        padding: 5px;
        backdrop-filter: blur(10px);
    }

    .citizen-list-item {
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 12px 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .citizen-list-item:last-child {
        border-bottom: none;
    }

    .citizen-list-item img {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        border: 2px solid var(--gold);
        object-fit: cover;
    }

    .citizen-info {
        flex: 1;
    }

    .citizen-info .name {
        display: block;
        font-weight: 600;
        color: #fff;
        font-size: 0.95rem;
    }

    .citizen-info .rank {
        display: block;
        font-size: 0.75rem;
        color: var(--gold);
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    /* Bottom App Bar */
    .mobile-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        padding: 10px 20px 30px 20px;
        background: var(--glass);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        z-index: 1000;
        border-top: 1px solid var(--card-border);
        display: flex;
        gap: 10px;
    }

    .mobile-bar a {
        flex: 1;
        padding: 16px;
        text-align: center;
        border-radius: 14px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-size: 0.9rem;
        text-decoration: none;
    }

    .mobile-btn-primary {
        background: linear-gradient(135deg, #ffd700, #b8860b);
        color: #000;
        box-shadow: 0 5px 15px rgba(216, 175, 0, 0.3);
    }

    .mobile-btn-outline {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--card-border);
        color: #fff;
    }

    /* Animations */
    @keyframes fadeInDown {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Transform Sidebar into Centered Modal on Mobile */
    .sidebar-menu {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(0.9) !important;
        width: 90% !important;
        max-width: 400px;
        height: auto !important;
        max-height: 80vh;
        border-radius: 24px;
        border: 1px solid rgba(255, 215, 0, 0.3) !important;
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
        padding: 30px !important;
    }

    .sidebar-menu.active {
        transform: translate(-50%, -50%) scale(1) !important;
        opacity: 1;
        visibility: visible;
        left: 50% !important;
        /* overrides desktop .active class logic */
    }

    /* Mobile Modal Overlay */
    .mobile-modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-modal-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}