/* DIMS - Djaya IoT Management System - Modern IoT-Themed Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* IoT Theme - Technology-focused color palette */
    --primary: #00a8ff;           /* Bright cyan - IoT data streams */
    --primary-dark: #0085cc;       /* Darker cyan */
    --primary-light: #33bbff;      /* Light cyan */
    --secondary: #6c5ce7;          /* Purple - System processing */
    --accent-orange: #ff6b35;      /* Orange - Alerts/warnings */
    --accent-green: #00d084;       /* Green - Active/Online status */
    --accent-red: #ff3838;         /* Red - Errors/Critical */
    --accent-yellow: #ffc107;      /* Yellow - Warnings */
    
    --success: #00d084;
    --warning: #ff6b35;
    --danger: #ff3838;
    --info: #00a8ff;
    
    /* Gradient backgrounds for IoT tech feel */
    --bg-primary: #0a0e2e;         /* Deep navy */
    --bg-secondary: #1a1f3a;       /* Dark blue-gray */
    --bg-tertiary: #252d4a;        /* Medium dark blue */
    --bg-card: #151b2f;            /* Card background */
    --bg-light: #f8f9fa;           /* Light mode background */
    
    --text-primary: #f0f4f8;       /* Almost white */
    --text-secondary: #b8c5d6;     /* Light gray */
    --text-tertiary: #7a8694;      /* Medium gray */
    --text-dark: #1a202c;          /* Dark text for light mode */
    
    --border-color: #2d3a52;       /* Blue-tinted border */
    --border-light: #e2e8f0;       /* Light border */
    
    /* Shadows for depth */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px 0 rgba(0, 168, 255, 0.08);
    --shadow-lg: 0 10px 30px 0 rgba(0, 168, 255, 0.15);
    --shadow-xl: 0 20px 50px 0 rgba(0, 168, 255, 0.2);
    
    /* Spacing system */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 24px;
    --spacing-2xl: 32px;
    
    /* Responsive breakpoints */
    --mobile: 480px;
    --tablet: 768px;
    --laptop: 1024px;
    --desktop: 1280px;
}

#logoutBtn {
    display: none !important;
    padding: 10px 18px !important;
    background: #dc3545 !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    height: auto !important;
    line-height: 1.2 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: all 0.2s ease !important;
}

#logoutBtn:hover {
    background: #c82333 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3) !important;
}

#logoutBtn:active {
    transform: translateY(0) !important;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0a0e27 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
}

@media (max-width: 768px) {
    body {
        overflow: visible;
    }
}

/* App Container */
.app-container {
    display: flex !important;
    flex-direction: row !important;
    height: 100vh !important;
    gap: 0 !important;
}

@media (max-width: 768px) {
    .app-container {
        height: auto !important;
        flex-direction: column !important;
    }
}

/* Sidebar */
.sidebar {
    width: 260px !important;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0 !important;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo-text p {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-list {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
    padding-left: 24px;
}

.nav-link.active {
    color: var(--primary);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%);
    border-left: 3px solid var(--primary);
    padding-left: 17px;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
}

.version-info {
    text-align: center;
}

.version-info p:first-child {
    color: var(--primary);
    font-weight: 600;
}

.version-info .system-name {
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* Main Content */
.main-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: linear-gradient(135deg, #0f172a 0%, #1a1f3a 100%);
    min-width: 0 !important;
}

/* Mobile Footer - Hidden on Desktop */
.mobile-footer {
    display: none !important;
}

@media (max-width: 768px) {
    .main-content {
        overflow: visible !important;
    }
}

/* Top Header */
.top-header {
    padding: 20px 30px;
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.8) 0%, rgba(30, 41, 59, 0.4) 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    z-index: 10;
    gap: 30px;
    flex-wrap: nowrap;
    min-height: 80px;
    flex-shrink: 0;
}

.header-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
    flex-shrink: 0;
    white-space: nowrap;
}

.header-left h1 {
    font-size: 24px;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
}

.timestamp {
    font-size: 13px;
    color: var(--text-tertiary);
    padding: 8px 16px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
}

/* Content Scroll Area */
.main-content > :not(.top-header) {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
}

@media (max-width: 768px) {
    .main-content > :not(.top-header) {
        overflow-y: visible;
        padding: 20px;
    }
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.section-header h2 {
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-end;
    white-space: nowrap;
}

.header-info span {
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-tertiary);
}

#userInfo {
    font-weight: 500;
    color: var(--text-primary) !important;
}

/* Collapsible Sections */
.collapsible-section {
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
    user-select: none;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
}

.collapsible-header h2 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.toggle-icon {
    font-size: 16px;
    color: var(--primary);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
}

.collapsible-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    padding: 20px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

/* Filter Card */
.filter-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.5) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
}

.filter-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary-light);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dashboard-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.filter-select:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.filter-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 2px solid transparent;
    border-radius: 14px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.2);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stat-icon.total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.inactive {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stat-icon.types {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-icon.min {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.stat-icon.max {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stat-icon.avg {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-icon.latest {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Data Card */
.data-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.5) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 16px;
    color: var(--primary-light);
}

.card-title i {
    font-size: 18px;
}

.card-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: rgba(99, 102, 241, 0.1);
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: all 0.3s ease;
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}

/* Button Sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

/* Button Color Variants */
.btn-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.5);
}

.btn-info:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}

/* Sensors Grid */
.sensors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.sensor-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid #334155;
    border-radius: 14px;
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.sensor-card:hover {
    transform: translateY(-6px);
    border-color: #60a5fa;
    box-shadow: 0 16px 40px rgba(96, 165, 250, 0.2);
}

.sensor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 16px;
}

.sensor-card-title {
    flex: 1;
}

.sensor-card-title h3 {
    font-size: 17px;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 700;
}

.sensor-card-code {
    font-size: 12px;
    color: #60a5fa;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.sensor-status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(16, 185, 129, 0.1) 100%);
    color: #10b981;
    border: 1px solid #10b981;
}

.status-inactive {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: #fca5a5;
    border: 1px solid #ef4444;
}

.status-maintenance {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.sensor-card-body {
    flex: 1;
    margin-bottom: 15px;
}

.sensor-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    color: var(--text-tertiary);
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

.sensor-card-footer {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.sensor-card-footer button {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sensor-card-footer button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-primary);
}

.close {
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.1);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    background: var(--primary);
    color: white;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.9);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background: rgba(30, 41, 59, 1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group textarea {
    resize: vertical;
    font-size: 13px;
    line-height: 1.5;
}

.form-divider {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 25px 0 15px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* Chart Container */
.chart-container {
    padding: 20px;
    position: relative;
    height: 400px;
}

/* Analytics Container */
.analytics-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.analytics-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.custom-date-range {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.custom-date-range input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

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

    .sensors-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        flex-direction: row;
    }

    .sidebar-header {
        padding: 12px 20px;
        border-bottom: none;
        order: 2;
        flex: 1;
        min-width: 200px;
    }

    .logo-container {
        gap: 10px;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .logo-text h1 {
        font-size: 16px;
    }

    .sidebar-nav {
        display: none;
    }

    .sidebar-footer {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .mobile-footer {
        display: block !important;
    }

    .sidebar-footer p {
        margin: 0;
    }

    .sidebar-footer a {
        font-size: 12px;
        padding: 6px 10px;
    }

    .main-content {
        flex-direction: column;
        padding-bottom: 70px;
    }

.top-header {
    flex-direction: column;
    gap: 10px;
    padding: 15px 20px;
    min-height: auto;
    align-items: flex-start;
}

.header-left {
    width: 100%;
    align-items: flex-start;
}

.header-right {
    width: 100%;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.header-info {
    width: 100%;
    justify-content: flex-end;
}

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .dashboard-filters {
        grid-template-columns: 1fr;
    }

    .sensors-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-number {
        font-size: 24px;
    }

    .section-header h2 {
        font-size: 18px;
    }

    .nav-link span {
        display: none;
    }

    .nav-link {
        justify-content: center;
        padding: 12px 15px;
    }

    .nav-link.active {
        border-left: none;
        border-bottom: 3px solid var(--primary);
        padding-left: 20px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(99, 102, 241, 0.05);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Sensor Management Dashboard */
.management-section {
    background: transparent;
    margin-bottom: 30px;
}

.management-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.management-table {
    width: 100%;
    border-collapse: collapse;
}

.management-table thead {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-bottom: 2px solid var(--primary);
}

.management-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--primary-light);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.management-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.management-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.management-table td {
    padding: 14px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.management-table td strong {
    color: var(--text-primary);
}

.sensor-code-cell {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-light);
}

.sensor-type-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.sensor-location-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-buttons .btn {
    padding: 6px 12px;
    font-size: 12px;
    min-width: 60px;
}

/* Form Grid Layouts */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-divider {
    grid-column: 1 / -1;
    padding: 15px 0 10px 0;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--primary-light);
    margin: 10px 0;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.modal-lg {
    max-width: 700px;
}

/* Modal Enhanced Styling */
.modal-lg .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.form-group input[readonly],
.form-group select[readonly] {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    
    .management-table {
        font-size: 12px;
    }
    
    .management-table th,
    .management-table td {
        padding: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
        min-width: auto;
    }
    
    .sensor-location-cell {
        max-width: 150px;
    }
}

/* Sensor Types Management */
.sensor-types-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow-lg);
}

.sensor-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.sensor-type-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sensor-type-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sensor-type-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.2);
}

.sensor-type-card:hover::before {
    opacity: 1;
}

.sensor-type-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.sensor-type-title {
    flex: 1;
}

.sensor-type-code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.sensor-type-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.sensor-type-unit {
    font-size: 13px;
    color: var(--primary-light);
    font-weight: 600;
    margin-top: 4px;
}

.sensor-type-status-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    background: rgba(99, 102, 241, 0.2);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.status-toggle-switch.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

.status-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.status-toggle-switch.active::after {
    left: 24px;
    background: var(--success);
}

.sensor-type-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.sensor-type-description {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 15px;
    min-height: 40px;
    line-height: 1.4;
}

.sensor-type-usage {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 15px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 6px;
}

.sensor-type-usage strong {
    color: var(--primary-light);
}

.sensor-type-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.sensor-type-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    margin: 0;
}

.loading-indicator {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* Location Management Styles */
.locations-container {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
}

.locations-tree {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.location-level {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
}

.location-level h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.location-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
}

.location-item:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05));
}

.location-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
}

.location-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.location-checkbox span {
    color: var(--text-primary);
    font-weight: 500;
}

.form-text {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* Nested Location Hierarchy */
.locations-tree {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.location-level {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.location-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid var(--border-color);
}

.location-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-toggle-all {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px 10px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
    font-size: 13px;
}

.location-sublist {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.location-city {
    margin-bottom: 20px;
    padding-left: 20px;
    border-left: 3px solid var(--primary);
}

.location-city-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: block;
}

.location-districts {
    margin-left: 10px;
    margin-top: 8px;
}

.location-district {
    margin-bottom: 12px;
    padding-left: 15px;
    border-left: 2px solid var(--secondary);
}

.location-district-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.location-subdistricts {
    margin-left: 10px;
    margin-top: 6px;
}

.location-subdistrict-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 5px;
    padding-left: 5px;
}

.save-locations-footer {
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-top: 1px solid var(--border-color);
    text-align: right;
}

@media (max-width: 768px) {
    .sensor-types-grid {
        grid-template-columns: 1fr;
    }
    
    .sensor-type-card {
        padding: 15px;
    }
    
    .sensor-type-actions {
        flex-direction: column;
    }
    
    .sensor-type-actions .btn {
        width: 100%;
    }
}

/* Cascading Location Selection */
.locations-selector {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 30px;
    background: linear-gradient(135deg, #1a1f3a 0%, #16213e 100%);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.selection-step {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selection-step label {
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 6px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selection-step .form-control {
    padding: 12px 15px;
    border: 2px solid #3b5998;
    border-radius: 8px;
    font-size: 14px;
    background-color: #0f172a;
    color: #f1f5f9;
    transition: all 0.3s ease;
    font-weight: 500;
}

.selection-step .form-control:hover:not(:disabled) {
    border-color: #60a5fa;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.2);
}

.selection-step .form-control:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 16px rgba(129, 140, 248, 0.3);
    background-color: #1e293b;
}

.selection-step .form-control:disabled {
    background-color: #334155;
    border-color: #475569;
    cursor: not-allowed;
    opacity: 0.6;
    color: #94a3b8;
}

.selection-step .form-control option {
    background-color: #1e293b;
    color: #f1f5f9;
}

.selected-locations-display {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(129, 140, 248, 0.1) 100%);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #3b5998;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.selected-locations-display h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #60a5fa;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selected-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.selected-list::-webkit-scrollbar {
    width: 8px;
}

.selected-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.selected-list::-webkit-scrollbar-thumb {
    background: #3b5998;
    border-radius: 10px;
}

.selected-list::-webkit-scrollbar-thumb:hover {
    background: #60a5fa;
}

.selected-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.selected-list li {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-left: 4px solid #60a5fa;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #e2e8f0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.selected-list li:hover {
    background: linear-gradient(135deg, #334155 0%, #475569 100%);
    border-left-color: #818cf8;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
}

.selected-list li:last-child {
    margin-bottom: 0;
}

.selected-list li span {
    flex: 1;
    font-weight: 500;
}

.selected-list .btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    background: #ef4444;
    border: 1px solid #dc2626;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selected-list .btn-sm:hover {
    background: #dc2626;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.text-muted {
    color: #94a3b8 !important;
    font-style: italic;
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.location-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.location-actions .btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.location-actions .btn-secondary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.location-actions .btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.location-actions .btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.location-actions .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.location-actions .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Custom Modal Notifications */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal.show {
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 500px;
    width: 90%;
    overflow: hidden;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 30px 30px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 2px solid #334155;
}

.modal-header.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.modal-header.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.modal-icon {
    font-size: 48px;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.success-modal .modal-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.error-modal .modal-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
}

.success-modal .modal-header h2 {
    color: #10b981;
}

.error-modal .modal-header h2 {
    color: #fca5a5;
}

.modal-body {
    padding: 25px 30px;
    max-height: 400px;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.modal-body::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.modal-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border-left: 4px solid #60a5fa;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-stat-item:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    transform: translateX(4px);
}

.modal-stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-weight: 700;
    color: #60a5fa;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #10b981;
    min-width: 60px;
    text-align: right;
}

.error-message {
    color: #fca5a5;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    padding: 16px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border-radius: 8px;
    border-left: 4px solid #ef4444;
}

.modal-footer {
    padding: 20px 30px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-top: 1px solid #334155;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-close-btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary.modal-close-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-primary.modal-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-danger.modal-close-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger.modal-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}
    transform: none;
}

/* Enabled Locations Display */
.enabled-locations-container {
    margin-top: 40px;
    padding: 20px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 12px;
    border: 1px solid #334155;
}

.location-section {
    background: #334155;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.location-section:hover {
    box-shadow: 0 4px 12px rgba(51, 65, 85, 0.4);
}

.location-section-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    cursor: pointer;
    user-select: none;
    border-bottom: 2px solid #1e293b;
    transition: all 0.3s ease;
}

.location-section-header:hover {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.location-section-header h4 {
    color: #f1f5f9;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.location-section-header i {
    transition: transform 0.3s ease;
    color: #60a5fa;
}

.location-section-content {
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    display: block;
}

.location-section-content::-webkit-scrollbar {
    width: 6px;
}

.location-section-content::-webkit-scrollbar-track {
    background: #1e293b;
}

.location-section-content::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.location-section-content::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.location-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.location-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #1e293b;
    border-radius: 6px;
    border-left: 3px solid #60a5fa;
    transition: all 0.2s ease;
    justify-content: space-between;
}

.location-item:hover {
    background: #0f172a;
    transform: translateX(4px);
    border-left-color: #3b82f6;
}

.location-item .location-name {
    color: #f1f5f9;
    font-weight: 500;
    flex-grow: 1;
}

.location-item .location-code {
    color: #94a3b8;
    font-size: 12px;
    padding: 2px 8px;
    background: #334155;
    border-radius: 4px;
    margin: 0 8px;
    font-family: 'Courier New', monospace;
}

.location-item .btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    transition: all 0.2s ease;
}

/* ════════════════════════════════════════════════════════════════ */
/* RESPONSIVE DESIGN - MOBILE FIRST APPROACH */
/* ════════════════════════════════════════════════════════════════ */

/* Mobile: 320px - 480px */
@media (max-width: 480px) {
    .app-container {
        flex-direction: column !important;
        height: auto !important;
    }
    
    .sidebar {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 2px solid var(--border-color) !important;
        padding: 0 !important;
        height: auto !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        flex-direction: row !important;
    }
    
    .sidebar-header {
        padding: 10px 15px !important;
        border-bottom: none !important;
        flex: 1 !important;
        min-width: 150px !important;
        order: 2 !important;
    }
    
    .logo-text h1 {
        font-size: 14px !important;
    }
    
    .logo-text p {
        display: none !important;
    }
    
    .sidebar-nav {
        padding: 0 !important;
        margin: 0 !important;
        display: none !important;
    }
    
    .nav-list {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0 !important;
    }
    
    .nav-link {
        padding: 10px 12px !important;
        font-size: 12px !important;
        flex: 1 !important;
        min-width: 70px !important;
        text-align: center !important;
        justify-content: center !important;
        flex-direction: column !important;
    }
    
    .nav-link span {
        display: block !important;
        font-size: 10px !important;
        margin-top: 2px !important;
    }
    
    .sidebar-footer {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .mobile-footer {
        display: block !important;
    }

    .sidebar-footer p {
        display: none !important;
    }

    .sidebar-footer a {
        display: none !important;
    }
    
    .main-content {
        padding: 12px !important;
    }
    
    .top-header {
        padding: 12px !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .page-title {
        font-size: 18px !important;
    }
    
    .page-subtitle {
        font-size: 12px !important;
    }
    
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    .stat-card {
        padding: 12px !important;
    }
    
    .stat-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
    }
    
    .stat-value {
        font-size: 20px !important;
    }
    
    .stat-label {
        font-size: 12px !important;
    }
    
    .sensor-card, .location-section {
        padding: 12px !important;
    }
    
    #typeSearchInput, #typeStatusFilter, .filter-select {
        font-size: 16px !important;
    }
    
    .dashboard-filters {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    button {
        min-height: 44px !important;
        font-size: 14px !important;
    }
    
    table {
        font-size: 12px !important;
    }
    
    #tableView {
        display: none !important;
    }
    
    #cardView {
        grid-template-columns: 1fr !important;
    }
}

/* Tablet: 481px - 1024px */
@media (max-width: 1024px) and (min-width: 481px) {
    .app-container {
        flex-direction: row !important;
    }
    
    .sidebar {
        width: 200px !important;
    }
    
    .logo-container {
        gap: 10px !important;
    }
    
    .logo-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
    }
    
    .logo-text h1 {
        font-size: 16px !important;
    }
    
    .logo-text p {
        font-size: 11px !important;
    }
    
    .nav-link {
        padding: 10px 15px !important;
        font-size: 13px !important;
    }
    
    .nav-link span {
        display: block !important;
    }
    
    .sidebar-header {
        padding: 15px !important;
    }
    
    .main-content {
        padding: 16px !important;
    }
    
    .top-header {
        padding: 16px !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .page-title {
        font-size: 20px !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .dashboard-filters {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    #cardView {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .hide-on-tablet {
        display: none !important;
    }
}

/* Desktop: 1025px and above */
@media (min-width: 1025px) {
    .app-container {
        flex-direction: row !important;
    }
    
    .sidebar {
        width: 260px !important;
    }
    
    .main-content {
        padding: 24px !important;
    }
    
    .top-header {
        padding: 20px 24px !important;
        flex-direction: row !important;
        gap: 24px !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 16px !important;
    }
    
    .dashboard-filters {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    #cardView {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    }
    
    #tableView {
        display: block !important;
        overflow-x: auto !important;
    }
}

/* ════════════════════════════════════════════════════════════════ */
/* ENHANCED BUTTON STYLES - IoT Theme */
/* ════════════════════════════════════════════════════════════════ */

button, .btn, .nav-link, .filter-select, select, input[type="text"], input[type="email"], input[type="password"], textarea {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

button:hover, .btn:hover, .nav-link.active {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(0, 168, 255, 0.25) !important;
}

button:active, .btn:active {
    transform: translateY(0) !important;
}

/* Primary button IoT style */
button[style*="background: #0066cc"],
button[style*="background: #00a8ff"],
#addTypeBtn, #saveTypeBtn,
button[style*="color: white"] {
    background: linear-gradient(135deg, var(--info) 0%, var(--primary-dark) 100%) !important;
    border: none !important;
    color: white !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    box-shadow: 0 4px 15px rgba(0, 168, 255, 0.3) !important;
}

button[style*="background: #0066cc"]:hover,
button[style*="background: #00a8ff"]:hover,
#addTypeBtn:hover, #saveTypeBtn:hover {
    box-shadow: 0 8px 25px rgba(0, 168, 255, 0.4) !important;
}

/* Secondary button style */
button[style*="background: #e2e8f0"],
#cancelTypeBtn {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%) !important;
    color: #1a202c !important;
    border: 1px solid var(--border-light) !important;
}

/* Danger button style */
button[style*="background: #dc3545"],
button[style*="background: #ff3838"],
#logoutBtn {
    background: linear-gradient(135deg, var(--danger) 0%, #cc2e2e 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(255, 56, 56, 0.3) !important;
}

/* ════════════════════════════════════════════════════════════════ */
/* ENHANCED INPUT STYLES - IoT Theme */
/* ════════════════════════════════════════════════════════════════ */

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    padding: 10px 12px !important;
    transition: all 0.3s ease !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.2) !important;
    background: var(--bg-card) !important;
}

/* ════════════════════════════════════════════════════════════════ */
/* TABLE STYLING - Responsive & IoT Themed */
/* ════════════════════════════════════════════════════════════════ */

table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 16px !important;
}

table thead th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: white !important;
    padding: 12px !important;
    text-align: left !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    letter-spacing: 0.5px !important;
}

table tbody tr {
    border-bottom: 1px solid var(--border-color) !important;
    transition: all 0.2s ease !important;
}

table tbody tr:hover {
    background: linear-gradient(90deg, rgba(0, 168, 255, 0.1) 0%, transparent 100%) !important;
}

table tbody td {
    padding: 12px !important;
    font-size: 14px !important;
    color: var(--text-primary) !important;
}

/* ════════════════════════════════════════════════════════════════ */
/* STATUS BADGES - IoT Color Theme */
/* ════════════════════════════════════════════════════════════════ */

.badge-active, span[style*="color: #22c55e"], .sensor-status.active {
    background: linear-gradient(135deg, var(--success) 0%, #00a060 100%) !important;
    color: white !important;
    padding: 4px 10px !important;
    border-radius: 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-block !important;
    box-shadow: 0 2px 8px rgba(0, 208, 132, 0.3) !important;
}

.badge-inactive, span[style*="color: #ef4444"], .sensor-status.inactive {
    background: linear-gradient(135deg, var(--danger) 0%, #cc2e2e 100%) !important;
    color: white !important;
    padding: 4px 10px !important;
    border-radius: 16px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-block !important;
    box-shadow: 0 2px 8px rgba(255, 56, 56, 0.3) !important;
}

/* ════════════════════════════════════════════════════════════════ */
/* CARD STYLES - Enhanced for IoT */
/* ════════════════════════════════════════════════════════════════ */

.stat-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%) !important;
    border: 1px solid var(--border-color) !important;
    border-left: 4px solid var(--primary) !important;
    box-shadow: 0 4px 15px rgba(0, 168, 255, 0.1) !important;
    border-radius: 8px !important;
    padding: 16px !important;
    transition: all 0.3s ease !important;
}

.stat-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 25px rgba(0, 168, 255, 0.2) !important;
    border-left-color: var(--primary-light) !important;
}

.sensor-card, .location-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 16px !important;
    transition: all 0.3s ease !important;
}

.sensor-card:hover, .location-section:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 25px rgba(0, 168, 255, 0.2) !important;
    border-color: var(--primary) !important;
}

/* ════════════════════════════════════════════════════════════════ */
/* FILTER STYLES - IoT Theme */
/* ════════════════════════════════════════════════════════════════ */

.filter-card, .dashboard-filters {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 16px !important;
    box-shadow: 0 4px 15px rgba(0, 168, 255, 0.1) !important;
}

.filter-title {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    margin-bottom: 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.filter-group label {
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    margin-bottom: 6px !important;
    display: block !important;
}

/* ════════════════════════════════════════════════════════════════ */
/* UTILITY CLASSES */
/* ════════════════════════════════════════════════════════════════ */

.text-center {
    text-align: center !important;
}

.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.p-2 { padding: 8px !important; }
.p-3 { padding: 12px !important; }
.p-4 { padding: 16px !important; }

.location-item .btn-danger {
    background: #dc2626;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
}

.location-item .btn-danger:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

.text-muted {
    color: #94a3b8;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

/* ════════════════════════════════════════════════════════════════ */
/* RESPONSIVE DESIGN - MOBILE FIRST APPROACH */
/* ════════════════════════════════════════════════════════════════ */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column !important;
    }
    
    .sidebar {
        width: 100% !important;
        height: auto !important;
        flex-direction: row !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
        flex-wrap: wrap !important;
    }
    
    .sidebar-header {
        flex: 1;
        min-width: 200px;
        padding: 15px;
        border-bottom: none !important;
        border-right: 1px solid var(--border-color);
    }
    
    .sidebar-nav {
        flex: 1;
        min-width: 100%;
        padding: 0 !important;
        display: flex !important;
        overflow-x: auto !important;
        border-top: 1px solid var(--border-color);
    }
    
    .nav-list {
        display: flex !important;
        width: 100%;
    }
    
    .nav-link {
        flex: 1;
        padding: 12px 8px !important;
        text-align: center !important;
        font-size: 12px !important;
        white-space: nowrap !important;
        border-left: none !important;
        border-bottom: 3px solid transparent;
    }
    
    .nav-link:hover {
        background: rgba(99, 102, 241, 0.1) !important;
        padding-left: 8px !important;
    }
    
    .nav-link.active {
        background: none !important;
        border-left: none !important;
        border-bottom: 3px solid var(--primary) !important;
        padding-left: 8px !important;
    }
    
    .nav-link i {
        display: block;
        margin-bottom: 4px;
    }
    
    .sidebar-footer {
        display: flex !important;
        flex: 1;
        min-width: auto;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        padding: 8px 15px !important;
        border-left: 1px solid var(--border-color);
        border-bottom: none;
        flex-wrap: wrap;
    }

    .sidebar-footer p {
        margin: 0;
    }

    .sidebar-footer a {
        font-size: 12px !important;
        padding: 6px 10px !important;
        margin: 2px;
        white-space: nowrap;
    }
    
    /* Main content */
    main {
        height: auto !important;
        overflow-y: auto !important;
    }
    
    .dashboard-header {
        padding: var(--spacing-lg) !important;
        margin-bottom: var(--spacing-lg) !important;
    }
    
    .dashboard-header h1 {
        font-size: 22px !important;
    }
    
    .dashboard-header p {
        font-size: 13px !important;
    }
    
    .main-content {
        padding: var(--spacing-md) !important;
        gap: var(--spacing-md) !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--spacing-md) !important;
    }
    
    .stat-card {
        padding: var(--spacing-md) !important;
        gap: var(--spacing-sm) !important;
    }
    
    .stat-icon {
        width: 35px !important;
        height: 35px !important;
        font-size: 16px !important;
    }
    
    .stat-value {
        font-size: 22px !important;
    }
    
    .stat-label {
        font-size: 11px !important;
    }
    
    .dashboard-filters {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-md) !important;
    }
    
    .filter-select {
        font-size: 14px !important;
        padding: 10px !important;
        min-height: 40px !important;
    }
    
    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .section-header h2 {
        font-size: 18px !important;
    }
    
    .tab-content {
        padding: var(--spacing-md) !important;
    }
    
    .sensor-grid, .location-grid {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-md) !important;
    }
    
    .sensor-card, .location-section {
        padding: var(--spacing-md) !important;
    }
    
    /* Chart responsiveness */
    .sensorChartsContainer {
        grid-template-columns: 1fr !important;
    }
    
    canvas {
        max-height: 250px !important;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .app-container {
        height: auto !important;
    }
    
    .sidebar {
        width: 100% !important;
    }
    
    .sidebar-header {
        flex: 0 0 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
        padding: 12px;
    }
    
    .logo-container {
        gap: 10px;
    }
    
    .logo-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
    }
    
    .logo-text h1 {
        font-size: 16px !important;
    }
    
    .logo-text p {
        font-size: 11px !important;
    }
    
    .sidebar-nav {
        flex: 0 0 100% !important;
        min-height: auto !important;
        padding: 0 !important;
        border-top: none !important;
    }
    
    .nav-list {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0 !important;
    }
    
    .nav-link {
        padding: 10px 6px !important;
        font-size: 11px !important;
        flex: none !important;
    }
    
    .nav-link i {
        font-size: 14px !important;
    }
    
    main {
        height: auto !important;
    }
    
    .dashboard-header {
        padding: var(--spacing-md) !important;
        margin-bottom: var(--spacing-md) !important;
    }
    
    .dashboard-header h1 {
        font-size: 18px !important;
    }
    
    .dashboard-header p {
        font-size: 12px !important;
    }
    
    .main-content {
        padding: var(--spacing-md) !important;
        gap: var(--spacing-sm) !important;
    }
    
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-sm) !important;
    }
    
    .stat-card {
        padding: var(--spacing-sm) !important;
        gap: var(--spacing-xs) !important;
        flex-direction: column !important;
    }
    
    .stat-icon {
        width: 30px !important;
        height: 30px !important;
        font-size: 14px !important;
    }
    
    .stat-value {
        font-size: 20px !important;
    }
    
    .stat-label {
        font-size: 10px !important;
    }
    
    .stat-content {
        text-align: center !important;
    }
    
    .dashboard-filters {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-sm) !important;
        padding: var(--spacing-sm) !important;
    }
    
    .filter-select {
        font-size: 13px !important;
        padding: 8px !important;
        min-height: 36px !important;
        width: 100% !important;
    }
    
    .section-header {
        margin-bottom: var(--spacing-md) !important;
    }
    
    .section-header h2 {
        font-size: 16px !important;
    }
    
    .section-header p {
        font-size: 12px !important;
    }
    
    .tab-content {
        padding: var(--spacing-sm) !important;
    }
    
    .tab-content > div {
        margin-bottom: var(--spacing-md) !important;
    }
    
    .sensor-grid, .location-grid {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-sm) !important;
    }
    
    .sensor-card, .location-section {
        padding: var(--spacing-sm) !important;
        border-radius: 6px !important;
    }
    
    .sensor-card h3, .location-section h3 {
        font-size: 14px !important;
        margin-bottom: var(--spacing-sm) !important;
    }
    
    /* Chart responsiveness for mobile */
    #sensorChartsContainer {
        grid-template-columns: 1fr !important;
        gap: var(--spacing-sm) !important;
    }
    
    canvas {
        max-height: 200px !important;
        width: 100% !important;
    }
    
    /* Table responsiveness */
    table {
        font-size: 12px !important;
    }
    
    table th,
    table td {
        padding: 6px 4px !important;
    }
    
    /* Button responsiveness */
    button, .btn, input[type="button"], input[type="submit"] {
        min-height: 40px !important;
        font-size: 13px !important;
        padding: 8px 12px !important;
    }
    
    /* Select dropdown responsiveness */
    select {
        min-height: 36px !important;
        font-size: 13px !important;
    }
    
    /* Text input responsiveness */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        min-height: 36px !important;
        padding: 8px !important;
        width: 100% !important;
    }
    
    textarea {
        min-height: 80px !important;
    }
    
    /* Modal/dialog responsiveness */
    .modal, [role="dialog"] {
        width: 90vw !important;
        max-width: calc(100vw - 20px) !important;
    }
    
    /* Alert/notification responsiveness */
    .alert, [role="alert"] {
        padding: var(--spacing-sm) !important;
        font-size: 12px !important;
    }
    
    /* Hide elements that don't fit on mobile */
    .desktop-only {
        display: none !important;
    }
}

/* Extra small devices (below 360px) */
@media (max-width: 359px) {
    .logo-text h1 {
        font-size: 14px !important;
    }
    
    .dashboard-header h1 {
        font-size: 16px !important;
    }
    
    .stat-value {
        font-size: 18px !important;
    }
    
    .section-header h2 {
        font-size: 14px !important;
    }
    
    .nav-list {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* Show mobile menu toggle on tablets */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .sidebar-nav.mobile-open {
        max-height: 300px;
        overflow-y: auto;
    }
    
    .sidebar-nav:not(.mobile-open) .nav-list {
        max-height: 0 !important;
        overflow: hidden !important;
    }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch target sizes */
    button, input[type="button"], input[type="submit"], .btn, .nav-link {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Remove hover effects that don't apply to touch */
    .nav-link:hover {
        background: rgba(99, 102, 241, 0.1) !important;
    }
    
    /* Add active state for touch */
    .nav-link:active {
        background: rgba(99, 102, 241, 0.2) !important;
    }
    
    /* Improve touch spacing */
    .stat-card, .sensor-card, .location-section {
        padding: 16px !important;
    }
}

/* Optimize for landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        height: auto !important;
    }
    
    main {
        max-height: calc(100vh - 120px) !important;
        overflow-y: auto !important;
    }
    
    .dashboard-header {
        padding: var(--spacing-sm) !important;
        margin-bottom: var(--spacing-sm) !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}


