/* ==========================================
   VIRD.CLICK - RESPONSIVE DESIGN
   ========================================== */

/* Mobile First - Base is already mobile */

/* Small phones (320px) */
@media screen and (max-width: 359px) {
    .header-tabs {
        gap: 2px;
    }
    .tab-btn {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
    .header-brand {
        display: none;
    }
    .profile-stats {
        gap: 16px;
    }
    .stat-number {
        font-size: 0.95rem;
    }
    .wallet-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .gift-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Standard phones (360px - 413px) */
@media screen and (min-width: 360px) and (max-width: 413px) {
    /* Default styles apply */
}

/* Large phones (414px+) */
@media screen and (min-width: 414px) {
    .post-card {
        border-radius: var(--border-radius-xl);
    }
    .posts-container {
        gap: 12px;
        padding: 12px;
    }
}

/* Tablets (768px+) */
@media screen and (min-width: 768px) {
    :root {
        --nav-height: 64px;
        --header-height: 60px;
    }

    .app-container {
        display: grid;
        grid-template-columns: 240px 1fr;
        grid-template-rows: auto 1fr;
    }

    /* Convert bottom nav to sidebar */
    .bottom-nav {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        right: auto;
        width: 240px;
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        padding: 20px 12px;
        padding-top: calc(20px + var(--safe-top));
        border-top: none;
        border-right: 1px solid var(--border-light);
        gap: 4px;
        z-index: var(--z-fixed);
    }
    .nav-item {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px 16px;
        border-radius: var(--border-radius-md);
        width: 100%;
    }
    .nav-item.active {
        background: var(--primary-light);
    }
    .nav-label {
        font-size: 0.9rem;
        font-weight: 600;
    }
    .nav-icon {
        font-size: 1.3rem;
    }
    .create-btn-wrapper {
        width: 100%;
        height: 44px;
        border-radius: var(--border-radius-md);
    }
    .nav-create .nav-label {
        display: none;
    }

    /* Sidebar brand */
    .bottom-nav::before {
        content: 'Vird';
        font-family: var(--font-display);
        font-size: 1.5rem;
        font-weight: 800;
        background: var(--gradient-primary);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        padding: 8px 16px;
        margin-bottom: 20px;
    }

    /* Main layout */
    .top-header {
        margin-left: 240px;
    }
    .stories-bar {
        margin-left: 240px;
    }
    .main-content {
        margin-left: 240px;
        padding-bottom: 0;
    }

    /* FAB */
    .fab-create {
        display: flex;
    }

    /* Posts grid for tablet */
    .posts-container {
        max-width: 600px;
        margin: 0 auto;
        padding: 16px;
        gap: 16px;
    }

    /* Discover grid */
    .discover-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 16px;
        max-width: 900px;
        margin: 0 auto;
    }

    /* Shop grid */
    .shop-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Profile */
    .profile-cover {
        height: 260px;
    }
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
    .profile-posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Chat page */
    #chat-page {
        display: grid;
        grid-template-columns: 340px 1fr;
    }

    /* Games grid */
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Achievements */
    .achievements-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Modals */
    .modal-full {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--border-radius-xl);
        top: 5%;
        bottom: 5%;
        animation: scaleIn 0.3s ease;
    }

    .slide-panel {
        box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    }

    /* Login */
    .login-container {
        max-width: 440px;
        padding: 40px;
        background: var(--bg-card);
        border-radius: var(--border-radius-xl);
        box-shadow: var(--shadow-xl);
    }
}

/* Desktop (1024px+) */
@media screen and (min-width: 1024px) {
    .bottom-nav {
        width: 280px;
    }
    .top-header,
    .stories-bar,
    .main-content {
        margin-left: 280px;
    }

    /* Right sidebar for desktop */
    .main-content {
        display: grid;
        grid-template-columns: 1fr 320px;
        gap: 0;
        max-width: calc(100vw - 280px);
    }
    .feed-container.active {
        padding-right: 16px;
    }

    .posts-container {
        max-width: 560px;
    }

    /* Discover */
    .discover-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Shop */
    .shop-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Profile */
    .profile-posts-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .profile-cover {
        height: 300px;
    }

    /* Wallet */
    .wallet-cards {
        flex-direction: row;
    }
    .wallet-card {
        flex: 1;
    }

    /* Games */
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Achievements */
    .achievements-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large Desktop (1440px+) */
@media screen and (min-width: 1440px) {
    .posts-container {
        max-width: 620px;
    }
    .discover-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .shop-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Ultra Wide (1920px+) */
@media screen and (min-width: 1920px) {
    body {
        font-size: 17px;
    }
    .discover-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Height Queries */
@media screen and (max-height: 600px) {
    .stories-bar {
        display: none;
    }
    .splash-logo-img {
        width: 60px;
        height: 60px;
    }
    .splash-title {
        font-size: 2rem;
    }
}

/* Landscape on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .top-header {
        padding: 4px 16px;
        min-height: 40px;
    }
    .stories-bar {
        display: none;
    }
    .bottom-nav {
        height: 48px;
    }
    .nav-label {
        display: none;
    }
}

/* Hover-capable devices */
@media (hover: hover) {
    .post-card:hover {
        box-shadow: var(--shadow-lg);
    }
    .nav-item:hover {
        background: var(--bg-hover);
    }
    .conversation-item:hover {
        background: var(--bg-hover);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print */
@media print {
    .bottom-nav,
    .top-header,
    .stories-bar,
    .fab-create,
    .toast-container {
        display: none !important;
    }
    .main-content {
        margin: 0;
        padding: 0;
    }
}

/* Dark mode system preference */
@media (prefers-color-scheme: dark) {
    /* Auto dark mode if user hasn't set preference */
    body:not([data-theme]) {
        /* Apply dark theme variables */
    }
}