/* ===== RESPONSIVE DESIGN ===== */

/* Tablet View (768px - 1024px) */
@media screen and (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }
    
    /* Header Adjustments */
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero .tagline {
        font-size: 1.1rem;
    }
    
    /* Map Tabs */
    .map-tabs {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .tab-btn {
        flex: 1 1 calc(33.333% - 10px);
        min-width: 120px;
    }
    
    /* Role Map Layout */
    #map-role {
        flex-direction: column;
    }
    
    .role-stats {
        width: 100%;
        margin-top: 20px;
    }
}

/* Mobile View (max-width: 768px) */
@media screen and (max-width: 768px) {
    /* Header Mobile Optimization */
    .site-header {
        padding: 15px 0;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: center;
    }
    
    .nav-menu a {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    /* Hero Section Mobile */
    .hero {
        padding: 60px 20px;
    }
    
    .hero h1 {
        font-size: 2rem;
        line-height: 1.3;
    }
    
    .hero .tagline {
        font-size: 1rem;
        margin: 15px 0;
    }
    
    .hashtag-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .hashtag {
        font-size: 1.2rem;
    }
    
    .hashtag-fa {
        font-size: 1rem;
    }
    
    /* Join Form Mobile */
    .join-section {
        padding: 40px 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .submit-btn {
        width: 100%;
        padding: 15px;
    }
    
    /* Map Section Mobile */
    .map-section {
        padding: 40px 15px;
    }
    
    .map-tabs {
        flex-direction: column;
        width: 100%;
    }
    
    .tab-btn {
        width: 100%;
        padding: 12px;
        font-size: 0.9rem;
    }
    
    /* Map Containers Mobile */
    #world-map-country,
    #world-map-role,
    #world-map-realtime {
        height: 400px !important;
    }
    
    /* Role Legend Mobile */
    .role-legend {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        margin-top: 15px;
        width: 100%;
    }
    
    /* Realtime Map Mobile */
    .realtime-container {
        flex-direction: column;
    }
    
    .realtime-sidebar {
        width: 100%;
        max-height: 300px;
        order: -1; /* نمایش لیست بالای نقشه */
    }
    
    /* Statement Section Mobile */
    .statement-section {
        padding: 40px 15px;
    }
    
    .statement-content {
        padding: 20px;
        font-size: 1rem;
    }
    
    /* Footer Mobile */
    .site-footer {
        padding: 30px 15px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Supporter Counter Mobile */
    .supporter-counter {
        padding: 30px 15px;
    }
    
    .counter-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .counter-item h3 {
        font-size: 2rem;
    }
}

/* Small Mobile (max-width: 480px) */
@media screen and (max-width: 480px) {
    /* Extra small adjustments */
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero .tagline {
        font-size: 0.9rem;
    }
    
    .join-btn,
    .submit-btn {
        font-size: 1rem;
        padding: 12px 20px;
    }
    
    /* Map height for very small screens */
    #world-map-country,
    #world-map-role,
    #world-map-realtime {
        height: 350px !important;
    }
    
    /* Role Chart Mobile */
    #roleChart {
        max-width: 250px;
        max-height: 250px;
        margin: 0 auto;
    }
}

/* Landscape Mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 40px 20px;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    #world-map-country,
    #world-map-role,
    #world-map-realtime {
        height: 300px !important;
    }
}

/* High Resolution Mobile */
@media screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 768px),
       screen and (min-resolution: 192dpi) and (max-width: 768px) {
    /* Sharper borders and shadows for retina displays */
    .tab-btn,
    .submit-btn,
    .form-control {
        border-width: 0.5px;
    }
}

/* Print Styles */
@media print {
    .nav-menu,
    .join-section,
    .map-tabs,
    .footer-links {
        display: none;
    }
    
    .hero {
        padding: 20px 0;
    }
    
    .map-container {
        page-break-inside: avoid;
    }
}

/* Hover Effects Disabled for Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .tab-btn:hover,
    .submit-btn:hover,
    .nav-menu a:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Safe Area Insets for Modern Phones */
@supports (padding: max(0px)) {
    .site-header,
    .site-footer {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    .hero,
    .join-section,
    .map-section {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
}