/* Responsive Design for Sound Monitoring System */
/* Mobile-First Approach with Noto Sans Lao Font */

/* Base Styles */
* {
    font-family: 'Noto Sans Lao', sans-serif;
    box-sizing: border-box;
}

/* Mobile First (320px and up) */
@media screen and (min-width: 320px) {
    .container {
        padding: 0.5rem;
    }
    
    .nav-title {
        font-size: 1rem;
    }
    
    .device-card {
        margin-bottom: 0.75rem;
    }
    
    .sound-level-display {
        font-size: 1.25rem;
    }
    
    .map-container {
        height: 50vh;
        min-height: 300px;
    }
    
    /* Mobile sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 40;
        display: none;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Mobile modals */
    .modal {
        padding: 1rem;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Mobile buttons */
    .btn-mobile {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Mobile map controls */
    .map-controls {
        position: absolute;
        top: 1rem;
        right: 1rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .map-control-btn {
        width: 40px;
        height: 40px;
        border-radius: 0.5rem;
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        cursor: pointer;
    }
    
    /* Mobile legend */
    .map-legend {
        position: absolute;
        bottom: 1rem;
        left: 1rem;
        background: white;
        padding: 0.75rem;
        border-radius: 0.5rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        font-size: 0.75rem;
    }
    
    /* Mobile device list */
    .device-list-item {
        padding: 0.75rem;
        border-radius: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .device-sound-level {
        font-size: 1.125rem;
        font-weight: 600;
    }
    
    /* Mobile notifications */
    .notification-toast {
        position: fixed;
        top: 4rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
        z-index: 60;
    }
}

/* Small Mobile (375px and up) */
@media screen and (min-width: 375px) {
    .container {
        padding: 0.75rem;
    }
    
    .nav-title {
        font-size: 1.125rem;
    }
    
    .sidebar {
        width: 320px;
    }
    
    .sound-level-display {
        font-size: 1.5rem;
    }
    
    .notification-toast {
        right: 1rem;
        left: auto;
        max-width: 320px;
    }
}

/* Large Mobile (425px and up) */
@media screen and (min-width: 425px) {
    .map-container {
        height: 55vh;
        min-height: 350px;
    }
    
    .device-card {
        padding: 1rem;
    }
    
    .btn-mobile {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
    }
}

/* Tablet Portrait (768px and up) */
@media screen and (min-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .nav-title {
        font-size: 1.25rem;
    }
    
    /* Tablet sidebar */
    .sidebar {
        position: relative;
        transform: translateX(0);
        width: 350px;
        height: auto;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .map-container {
        height: 60vh;
        min-height: 400px;
    }
    
    /* Tablet grid layouts */
    .device-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stats-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
    
    /* Tablet modals */
    .modal {
        padding: 2rem;
    }
    
    .modal-content {
        max-width: 600px;
        margin: 0 auto;
    }
    
    /* Tablet map controls */
    .map-controls {
        top: 1.5rem;
        right: 1.5rem;
    }
    
    .map-control-btn {
        width: 44px;
        height: 44px;
    }
    
    /* Tablet legend */
    .map-legend {
        bottom: 1.5rem;
        left: 1.5rem;
        padding: 1rem;
        font-size: 0.875rem;
    }
}

/* Tablet Landscape (1024px and up) */
@media screen and (min-width: 1024px) {
    .container {
        padding: 1.5rem;
    }
    
    .sidebar {
        width: 380px;
    }
    
    .map-container {
        height: 65vh;
        min-height: 500px;
    }
    
    /* Desktop-like layouts */
    .device-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    /* Larger modals */
    .modal-content {
        max-width: 800px;
    }
    
    .chart-container {
        height: 300px;
    }
}

/* Desktop (1440px and up) */
@media screen and (min-width: 1440px) {
    .container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 2rem;
    }
    
    .sidebar {
        width: 400px;
    }
    
    .map-container {
        height: 70vh;
        min-height: 600px;
    }
    
    .device-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .modal-content {
        max-width: 1000px;
    }
    
    .chart-container {
        height: 400px;
    }
}

/* Large Desktop (1920px and up) */
@media screen and (min-width: 1920px) {
    .container {
        max-width: 1800px;
        padding: 3rem;
    }
    
    .sidebar {
        width: 450px;
    }
    
    .device-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

/* Responsive Typography */
@media screen and (max-width: 767px) {
    .text-responsive-sm {
        font-size: 0.75rem;
    }
    
    .text-responsive-base {
        font-size: 0.875rem;
    }
    
    .text-responsive-lg {
        font-size: 1rem;
    }
    
    .text-responsive-xl {
        font-size: 1.125rem;
    }
    
    .text-responsive-2xl {
        font-size: 1.25rem;
    }
}

@media screen and (min-width: 768px) {
    .text-responsive-sm {
        font-size: 0.875rem;
    }
    
    .text-responsive-base {
        font-size: 1rem;
    }
    
    .text-responsive-lg {
        font-size: 1.125rem;
    }
    
    .text-responsive-xl {
        font-size: 1.25rem;
    }
    
    .text-responsive-2xl {
        font-size: 1.5rem;
    }
}

/* Responsive Spacing */
.spacing-responsive {
    padding: 0.5rem;
}

@media screen and (min-width: 768px) {
    .spacing-responsive {
        padding: 1rem;
    }
}

@media screen and (min-width: 1024px) {
    .spacing-responsive {
        padding: 1.5rem;
    }
}

/* Responsive Images and Media */
.media-responsive {
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Responsive Tables */
@media screen and (max-width: 767px) {
    .table-responsive {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
}

/* Touch-friendly Interactive Elements */
@media (hover: none) and (pointer: coarse) {
    .touch-target {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
    }
    
    .form-input {
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .high-dpi-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .auto-dark-card {
        background-color: #374151;
        border-color: #4b5563;
    }
    
    .auto-dark-text {
        color: #e5e7eb;
    }
}

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

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .map-container {
        height: 400px;
        border: 1px solid #ccc;
    }
}

/* Accessibility Enhancements */
@media (prefers-contrast: high) {
    .high-contrast {
        border: 2px solid #000;
        background-color: #fff;
        color: #000;
    }
}

/* Focus Visible for Better Keyboard Navigation */
.focus-visible:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Custom Scrollbars for WebKit */
@media screen and (min-width: 768px) {
    .custom-scrollbar::-webkit-scrollbar {
        width: 8px;
    }
    
    .custom-scrollbar::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 4px;
    }
    
    .custom-scrollbar::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }
    
    .custom-scrollbar::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}
