/* ============================================
   AJEY IoT Cloud - PHP Dashboard Styles
   ============================================ */

/* CSS Variables */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-bg: rgba(99, 102, 241, 0.1);
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-blue: #3b82f6;
    --accent-purple: #a855f7;
    --accent-cyan: #06b6d4;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-inverse: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border-color: #334155;
    --border-hover: #475569;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 0.9375rem; line-height: 1.5; color: var(--text-primary); background: var(--bg-primary); min-height: 100vh; overflow-x: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ============================================
   Auth Pages
   ============================================ */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-primary); padding: 1rem; }
.auth-container { width: 100%; max-width: 440px; }
.auth-card { background: var(--bg-secondary); border-radius: var(--radius-lg); padding: 2.5rem; box-shadow: var(--shadow-lg); }
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo { width: 72px; height: 72px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem; box-shadow: var(--shadow-lg); }
.auth-logo i { font-size: 36px; color: white; }
.auth-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.auth-header p { color: var(--text-secondary); }

/* ============================================
   App Layout
   ============================================ */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: var(--bg-secondary); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 100; transition: transform var(--transition); }
.sidebar-header { padding: 1.25rem; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); }
.sidebar-logo { width: 40px; height: 40px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-logo i { font-size: 20px; color: white; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 1.25rem; border-bottom: 1px solid var(--border-color); font-size: 1.125rem; font-weight: 700; }
.sidebar-brand i { font-size: 1.5rem; color: var(--primary); }
.sidebar-brand span { font-size: 1.125rem; font-weight: 700; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem; }
.nav-section { margin-bottom: 1rem; }
.nav-section-title { font-size: 0.6875rem; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; padding: 0.5rem 0.75rem; }
.nav-item, .nav-link { display: flex; align-items: center; gap: 10px; padding: 0.625rem 0.75rem; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; transition: all var(--transition-fast); text-decoration: none; margin-bottom: 2px; }
.nav-item:hover, .nav-link:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item.active, .nav-link.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.nav-item i, .nav-link i { font-size: 1.125rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border-color); }
.btn-logout { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); font-size: 0.875rem; text-decoration: none; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); transition: all var(--transition-fast); width: 100%; }
.btn-logout:hover { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 0.75rem; margin-bottom: 0.5rem; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.875rem; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.user-role, .user-email { font-size: 0.75rem; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* Main Content */
.main-content { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }
.main-header { height: var(--header-height); background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 50; }
.header-left { display: flex; align-items: center; gap: 1rem; }
.header-left h1, .header-left h2, .page-title { font-size: 1.25rem; font-weight: 600; margin: 0; }
.header-actions, .header-right { display: flex; align-items: center; gap: 0.5rem; }
.header-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.page-content { flex: 1; padding: 1.5rem; max-width: 1400px; width: 100%; }

/* ============================================
   Common Components
   ============================================ */

/* Buttons */
.btn-primary { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.25rem; background: var(--primary); color: white; border-radius: var(--radius-sm); font-weight: 500; font-size: 0.875rem; transition: all var(--transition-fast); border: none; cursor: pointer; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.25rem; background: var(--bg-tertiary); color: var(--text-primary); border-radius: var(--radius-sm); font-weight: 500; font-size: 0.875rem; border: 1px solid var(--border-color); cursor: pointer; }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.25rem; background: var(--accent-red); color: white; border-radius: var(--radius-sm); font-weight: 500; font-size: 0.875rem; border: none; cursor: pointer; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-secondary); transition: all var(--transition-fast); }
.btn-icon:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.form-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); transition: border-color var(--transition-fast); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > i:first-child { position: absolute; left: 14px; color: var(--text-tertiary); font-size: 1.125rem; }
.input-icon input { padding-left: 44px !important; }
.input-readonly { background: var(--bg-tertiary) !important; cursor: default; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; }

/* Alerts */
.alert { padding: 0.875rem 1.25rem; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; font-size: 0.875rem; }
.alert i { font-size: 1.125rem; }
.alert-success { background: rgba(34, 197, 94, 0.1); color: #16a34a; border: 1px solid rgba(34, 197, 94, 0.2); }
.alert-danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Page Actions */
.page-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

/* Section Heading */
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 1.5rem 0 1rem; }
.section-heading h3 { font-size: 1.125rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: white; flex-shrink: 0; }
.stat-icon.blue { background: var(--accent-blue); }
.stat-icon.green { background: var(--accent-green); }
.stat-icon.orange { background: var(--accent-yellow); }
.stat-icon.purple { background: var(--accent-purple); }
.stat-icon.red { background: var(--accent-red); }
.stat-icon.cyan { background: var(--accent-cyan); }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--text-tertiary); font-weight: 500; }

/* ============================================
   Cards
   ============================================ */
.card { background: var(--bg-secondary); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); margin-bottom: 1.5rem; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); gap: 1rem; flex-wrap: wrap; }
.card-header h3 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; margin: 0; }

/* ============================================
   Device Grid & Cards
   ============================================ */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.device-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); transition: all var(--transition-fast); }
.device-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.device-card.offline { opacity: 0.7; }
.device-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.device-status { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-online { background: var(--accent-green); box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.status-offline { background: var(--text-tertiary); }
.status-pill.status-online { background: rgba(34, 197, 94, 0.1); color: #16a34a; box-shadow: none; }
.status-pill.status-offline { background: rgba(100, 116, 139, 0.1); color: #64748b; }
.device-name { font-weight: 600; flex: 1; font-size: 0.9375rem; }
.device-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.device-meta span { font-size: 0.75rem; color: var(--text-tertiary); display: flex; align-items: center; gap: 0.25rem; }
.device-controls { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }
.relay-control { display: flex; align-items: center; justify-content: space-between; flex: 1; min-width: 120px; padding: 0.5rem 0.75rem; background: var(--bg-tertiary); border-radius: var(--radius-sm); }
.relay-label { font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); }
.device-footer { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-tertiary); padding-top: 0.75rem; border-top: 1px solid var(--border-color); }

/* Toggle Button */
.toggle-btn { width: 44px; height: 24px; border-radius: 12px; position: relative; transition: background var(--transition-fast); cursor: pointer; border: none; }
.toggle-btn.off { background: var(--bg-hover); }
.toggle-btn.on { background: var(--accent-green); }
.toggle-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.toggle-slider { width: 18px; height: 18px; border-radius: 50%; background: white; position: absolute; top: 3px; transition: left var(--transition-fast); box-shadow: var(--shadow-sm); }
.toggle-btn.off .toggle-slider { left: 3px; }
.toggle-btn.on .toggle-slider { left: 23px; }

/* Device Menu / Dropdown */
.device-menu { position: relative; }
.dropdown-menu { display: none; position: absolute; right: 0; top: 100%; min-width: 160px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden; }
.dropdown-menu.show { display: block; }
.dropdown-menu button { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.5rem 0.875rem; font-size: 0.8125rem; color: var(--text-primary); transition: background var(--transition-fast); }
.dropdown-menu button:hover { background: var(--bg-tertiary); }
.text-danger { color: var(--accent-red) !important; }
.text-muted { color: var(--text-tertiary); }

/* ============================================
   Room Grid
   ============================================ */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.room-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.room-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.room-header h4 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.room-meta { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.8125rem; color: var(--text-tertiary); }
.room-meta span { display: flex; align-items: center; gap: 0.25rem; }
.room-devices-list { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 0.375rem; }
.room-device-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; padding: 0.375rem 0; }
.unassigned-card { padding: 0.75rem; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.assign-form { margin-left: auto; }
.assign-form select { padding: 0.25rem 0.5rem; font-size: 0.75rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-secondary); }

/* ============================================
   Tables
   ============================================ */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg-tertiary); border-bottom: 1px solid var(--border-color); }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); font-size: 0.875rem; vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg-tertiary); }
.data-table code { font-size: 0.8125rem; padding: 0.125rem 0.375rem; background: var(--bg-tertiary); border-radius: 4px; font-family: 'JetBrains Mono', monospace; }

/* Product Info in Table */
.product-info { display: flex; align-items: center; gap: 0.75rem; }
.product-thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb i { font-size: 1.125rem; color: var(--text-tertiary); }
.product-details { display: flex; flex-direction: column; }
.product-name { font-weight: 600; font-size: 0.875rem; }
.product-model { font-size: 0.75rem; color: var(--text-tertiary); }

/* Type Info */
.type-info { display: flex; align-items: center; gap: 0.625rem; }
.type-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; }

/* Status Pills */
.status-pill { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.25rem 0.625rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.status-pill.active { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.status-pill.inactive { background: rgba(100, 116, 139, 0.1); color: #64748b; }
.status-pill.pending { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.status-pill.paired { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.status-pill.danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; }

/* Count Badge */
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 24px; padding: 0 0.5rem; background: var(--bg-tertiary); border-radius: 999px; font-size: 0.8125rem; font-weight: 600; }
.category-badge { display: inline-block; padding: 0.125rem 0.5rem; background: var(--primary-bg); color: var(--primary); border-radius: 999px; font-size: 0.75rem; font-weight: 500; }
.badge { display: inline-block; padding: 0.125rem 0.5rem; background: var(--bg-tertiary); border-radius: 999px; font-size: 0.75rem; font-weight: 500; }
.version-badge { background: var(--primary-bg) !important; color: var(--primary) !important; }

/* Table Actions */
.action-buttons { display: flex; align-items: center; gap: 0.25rem; justify-content: center; }
.btn-table-action { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-secondary); transition: all var(--transition-fast); }
.btn-table-action:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-table-action.danger:hover { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }

/* Table Footer / Pagination */
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; border-top: 1px solid var(--border-color); font-size: 0.8125rem; color: var(--text-tertiary); }
.pagination { display: flex; align-items: center; gap: 0.5rem; }
.btn-page { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--bg-tertiary); color: var(--text-secondary); text-decoration: none; }
.btn-page:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-indicator { font-size: 0.8125rem; font-weight: 500; }

/* Header Filters */
.header-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.header-filters select, .form-control-sm { padding: 0.375rem 0.625rem; font-size: 0.8125rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); }
.filter-form { display: flex; gap: 0.5rem; }

/* ============================================
   Search Box
   ============================================ */
.search-box { position: relative; display: flex; align-items: center; }
.search-box i { position: absolute; left: 0.75rem; color: var(--text-tertiary); }
.search-box input { padding: 0.5rem 0.75rem 0.5rem 2.25rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); font-size: 0.8125rem; width: 200px; }
.search-box input:focus { outline: none; border-color: var(--primary); }

/* ============================================
   Modals
   ============================================ */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
.modal-container { position: relative; background: var(--bg-secondary); border-radius: var(--radius-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); }
.modal-container.modal-lg { max-width: 640px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { font-size: 1.125rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.modal-body { padding: 1.5rem; }

/* ============================================
   Empty State
   ============================================ */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-icon { font-size: 3rem; color: var(--text-tertiary); margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.125rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text-tertiary); font-size: 0.875rem; }

/* ============================================
   Settings
   ============================================ */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.5rem; }
.settings-card { background: var(--bg-secondary); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.settings-card-header { margin-bottom: 1.25rem; }
.settings-card-header h3 { font-size: 1.0625rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }

/* ============================================
   Activity Log
   ============================================ */
.activity-list { padding: 0.5rem 0; }
.activity-item { display: flex; align-items: flex-start; gap: 0.875rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border-color); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg-tertiary); color: var(--text-tertiary); font-size: 0.875rem; }
.activity-icon.green { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.activity-icon.red { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.activity-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.activity-icon.purple { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.activity-icon.gray { background: var(--bg-tertiary); color: var(--text-tertiary); }
.activity-content { flex: 1; display: flex; flex-direction: column; gap: 0.125rem; }
.activity-text { font-size: 0.875rem; }
.activity-time { font-size: 0.75rem; color: var(--text-tertiary); }

/* ============================================
   Schedules
   ============================================ */
.schedule-time { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.schedule-days { display: flex; gap: 0.375rem; margin-top: 0.75rem; }
.day-badge { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0.6875rem; font-weight: 600; background: var(--bg-tertiary); color: var(--text-tertiary); }
.day-badge.active { background: var(--primary); color: white; }
.inactive-card { opacity: 0.5; }
.days-selector { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.day-check { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; cursor: pointer; }

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.75rem 1.25rem; border-radius: var(--radius-sm); color: white; font-size: 0.875rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; min-width: 200px; display: flex; align-items: center; gap: 0.5rem; }
.toast.success { background: var(--accent-green); }
.toast.error { background: var(--accent-red); }
.toast.info { background: var(--accent-blue); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ============================================
   Responsive
   ============================================ */
.menu-toggle { display: none; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .page-content { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .device-grid { grid-template-columns: 1fr; }
    .room-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .modal-container { max-width: 100%; }
    .auth-card { padding: 1.5rem; }
    .header-left h1 { font-size: 1rem; }
    .data-table { font-size: 0.8125rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.75rem; }
}

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

/* Icon Picker */
.icon-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.icon-option { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 2px solid var(--border-color); background: var(--bg-secondary); color: var(--text-secondary); font-size: 1.25rem; cursor: pointer; transition: all var(--transition-fast); }
.icon-option:hover { border-color: var(--primary-light); color: var(--primary); background: var(--primary-bg); }
.icon-option.selected { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); box-shadow: 0 0 0 2px var(--primary-bg); }
