/**
 * Bandeiras e Capitais - Responsive Stylesheet
 * Desenvolvido por B20 Conteúdo Digital
 * https://www.b20.com.br
 */

/* ===== TABLET (768px+) ===== */
@media (min-width: 768px) {
    /* Container */
    .container {
        padding: 24px;
        max-width: 720px;
        margin: 0 auto;
    }

    /* Body adjustments */
    body {
        padding-bottom: 40px;
    }

    /* Header */
    .header-logo h1 {
        font-size: 1.25rem;
    }

    /* Desktop Navigation */
    .desktop-nav {
        display: flex;
        gap: 8px;
    }

    .desktop-nav .nav-link {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 10px 16px;
        border-radius: var(--border-radius-sm);
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 500;
        transition: var(--transition-fast);
    }

    .desktop-nav .nav-link:hover {
        color: var(--primary-color);
        background: var(--primary-lighter);
    }

    .desktop-nav .nav-link.active {
        background: var(--primary-color);
        color: white;
    }

    .desktop-nav .nav-link i {
        font-size: 1rem;
    }

    /* Hide Bottom Navigation */
    .bottom-nav {
        display: none !important;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Game Modes Grid */
    .game-modes-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Answer Options */
    .answer-options {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Results Stats */
    .results-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Results Actions */
    .results-actions {
        flex-direction: row;
        justify-content: center;
    }

    .results-actions .btn {
        flex: 0 1 auto;
    }

    /* Profile Stats Grid */
    .profile-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

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

    /* Toast Container */
    .toast-container {
        bottom: 24px;
    }

    /* Footer */
    .app-footer {
        padding: 32px 24px;
    }
}

/* ===== DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
    /* Container */
    .container {
        max-width: 960px;
    }

    /* Hero Card */
    .hero-card {
        padding: 48px 40px;
    }

    .hero-icon {
        width: 100px;
        height: 100px;
    }

    .hero-icon i {
        font-size: 3rem;
    }

    /* Game Mode Cards */
    .game-mode-card {
        padding: 24px 20px;
    }

    .mode-icon {
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
    }

    /* Flag Image */
    .flag-img {
        max-width: 280px;
    }

    /* Country Name */
    .country-name-text {
        font-size: 2rem;
    }

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

    /* Continent Progress */
    .continent-progress-item {
        padding: 16px 20px;
    }

    .continent-info {
        min-width: 120px;
    }
}

/* ===== LARGE DESKTOP (1440px+) ===== */
@media (min-width: 1440px) {
    .container {
        max-width: 1200px;
    }

    /* Game Modes Grid */
    .game-modes-grid {
        gap: 20px;
    }

    /* Stats Grid */
    .stats-grid {
        gap: 20px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* ===== SMALL MOBILE (320px - 374px) ===== */
@media (max-width: 374px) {
    /* Header */
    .header-logo h1 {
        font-size: 0.9rem;
    }

    .header-logo i {
        font-size: 1.25rem;
    }

    /* Container */
    .container {
        padding: 12px;
    }

    /* Hero Card */
    .hero-card {
        padding: 24px 16px;
    }

    .hero-icon {
        width: 64px;
        height: 64px;
    }

    .hero-icon i {
        font-size: 2rem;
    }

    .hero-card h2 {
        font-size: 1.25rem;
    }

    /* Stats Grid */
    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    /* Game Modes */
    .game-modes-grid {
        gap: 8px;
    }

    .game-mode-card {
        padding: 16px 12px;
    }

    .mode-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .game-mode-card h4 {
        font-size: 0.9rem;
    }

    .game-mode-card p {
        font-size: 0.7rem;
    }

    /* Continents */
    .continent-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 14px 28px;
        font-size: 1rem;
    }

    /* Bottom Nav */
    .nav-item {
        padding: 6px 12px;
        min-width: 56px;
    }

    .nav-item i {
        font-size: 18px;
    }

    .nav-item span {
        font-size: 10px;
    }

    /* Flag Image */
    .flag-img {
        max-width: 160px;
    }

    /* Country Name */
    .country-name-text {
        font-size: 1.5rem;
    }

    /* Answer Buttons */
    .answer-btn {
        padding: 14px 16px;
        font-size: 0.9rem;
    }

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

    /* Profile */
    .profile-avatar {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }

    .profile-name-input {
        font-size: 1rem;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding-top: 50px;
        padding-bottom: 60px;
    }

    .app-header {
        height: 50px;
    }

    .bottom-nav {
        height: 55px;
    }

    .hero-card {
        padding: 20px;
    }

    .hero-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 12px;
    }

    .hero-icon i {
        font-size: 1.75rem;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .game-modes-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .flag-img {
        max-width: 150px;
    }

    .answer-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .answer-btn {
        padding: 12px 16px;
    }
}

/* ===== SAFE AREAS (iPhone X+) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-top: max(var(--header-height), env(safe-area-inset-top));
    }

    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }

    @media (min-width: 768px) {
        body {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}

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

    html {
        scroll-behavior: auto;
    }
}

/* ===== HIGH CONTRAST ===== */
@media (prefers-contrast: high) {
    :root {
        --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    }

    .btn {
        border: 2px solid currentColor;
    }

    .answer-btn {
        border-width: 3px;
    }

    .progress-fill {
        background: var(--primary-color);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .app-header,
    .bottom-nav,
    .toast-container,
    .modal-overlay {
        display: none !important;
    }

    body {
        padding: 0;
        background: white;
        color: black;
    }

    .container {
        max-width: 100%;
        padding: 20px;
    }

    .btn {
        display: none;
    }

    .hero-card {
        background: #f0f0f0;
        color: black;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .hero-card h2,
    .hero-card p {
        color: black;
    }
}
