/**
 * Mobile-Optimized Styles
 * Responsive design for all panel pages
 */

/* Mobile-First Approach */
@media (max-width: 768px) {
    /* Header */
    .header {
        padding: 15px 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .logout-btn {
        width: 100%;
        text-align: center;
    }
    
    /* Container */
    .container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    /* Quick Actions */
    .quick-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .action-btn {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    /* Chart Container */
    .chart-container {
        padding: 20px;
    }
    
    .chart-title {
        font-size: 16px;
    }
    
    .activity-item {
        padding: 12px;
        font-size: 11px;
        word-break: break-all;
    }
    
    /* Navigation Tabs */
    .nav-tabs {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .nav-tab {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Refresh Button */
    .refresh-btn {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }
    
    /* Login Container */
    .login-container {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .logo h1 {
        font-size: 22px;
    }
    
    .form-group input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .login-button {
        padding: 12px;
        font-size: 15px;
    }
    
    /* Map */
    #map {
        height: 300px;
    }
    
    /* Country List */
    .country-item {
        padding: 10px 0;
    }
    
    .country-name {
        font-size: 13px;
    }
    
    .country-count {
        padding: 3px 10px;
        font-size: 11px;
    }
    
    /* Info Box */
    .info-box {
        padding: 15px;
        font-size: 13px;
    }
    
    /* Tables */
    table {
        font-size: 12px;
    }
    
    table th,
    table td {
        padding: 8px;
    }
    
    /* Buttons */
    button,
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    /* Control Panel */
    .control-grid {
        grid-template-columns: 1fr;
    }
    
    .control-card {
        padding: 15px;
    }
    
    .control-card h3 {
        font-size: 16px;
    }
    
    .ip-input {
        font-size: 14px;
        padding: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-buttons button {
        width: 100%;
    }
}

/* Tablet Styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #map {
        height: 400px;
    }
}

/* Touch-Friendly Improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .stat-card:hover,
    .action-btn:hover,
    .nav-tab:hover {
        transform: none;
    }
    
    /* Better tap feedback */
    button:active,
    .btn:active,
    a:active {
        opacity: 0.7;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 10px 20px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    #map {
        height: 250px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .header {
        padding: 12px 15px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        font-size: 24px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .chart-container {
        padding: 15px;
    }
    
    .activity-item {
        padding: 10px;
        font-size: 10px;
    }
    
    .login-container {
        padding: 25px 15px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .refresh-btn {
        width: 45px;
        height: 45px;
        bottom: 15px;
        right: 15px;
        font-size: 18px;
    }
}

/* Print Styles */
@media print {
    .header,
    .logout-btn,
    .back-btn,
    .refresh-btn,
    .quick-actions,
    .nav-tabs {
        display: none;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .stat-card,
    .chart-container {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .stat-card,
    .chart-container,
    .login-container {
        background: #2a2a2a;
        color: #e0e0e0;
    }
    
    .stat-label,
    .activity-item {
        color: #b0b0b0;
    }
    
    .form-group input {
        background: #333;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .info-box {
        background: #333;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .stat-card,
    .chart-container {
        border: 2px solid #000;
    }
    
    button,
    .btn {
        border: 2px solid #000;
    }
}
