/* =============================================
   AriHom - Profesyonel Akıllı Ev Sistemi
   Ana Stil Dosyası v2.0
   ============================================= */

/* ---- Değişkenler ---- */
:root {
    --sidebar-w: 260px;
    --navbar-h: 58px;

    --bg-main: #f0f2f8;
    --bg-card: #ffffff;
    --bg-sidebar: #111827;
    --bg-sidebar-hover: rgba(255,255,255,.08);
    --bg-sidebar-active: #2563eb;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-sidebar: rgba(255,255,255,.72);
    --text-sidebar-active: #fff;

    --border: #e5e7eb;
    --border-focus: #2563eb;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition: .2s ease;
}

/* ---- Dark Mode ---- */
[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0a101e;
    --border: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #94a3b8;
}

/* ---- Temel ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-brand .brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.3px;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-section-label {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: rgba(255,255,255,.3);
    padding: 8px 8px 4px;
    margin-top: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    box-shadow: 0 2px 8px rgba(37,99,235,.4);
}

.sidebar-link .icon {
    width: 20px;
    text-align: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.sidebar-link .badge-count {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

/* ---- Ana İçerik ---- */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Üst Navbar ---- */
.top-navbar {
    height: var(--navbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.top-navbar .page-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.btn-icon {
    width: 36px; height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.btn-icon:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

.btn-icon .badge-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
}

/* ---- Sayfa İçeriği ---- */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ---- Kartlar ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ---- İstatistik Kartları ---- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Kanal Kartları (Dashboard) ---- */
.channel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.channel-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--ch-color, var(--primary));
    border-radius: 3px 0 0 3px;
}

.channel-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.channel-card.offline {
    opacity: .7;
}

.ch-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ch-icon-wrap {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ch-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.ch-meta {
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Büyük Toggle Switch ---- */
.toggle-switch {
    position: relative;
    width: 52px; height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0; height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 28px;
    cursor: pointer;
    transition: background var(--transition);
}

[data-theme="dark"] .toggle-slider {
    background: #475569;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    left: 3px; top: 3px;
    width: 22px; height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

[data-theme="dark"] .toggle-slider::after {
    background: #f1f5f9;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--ch-color, var(--primary));
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: .5;
    cursor: not-allowed;
}

/* ---- Durum Noktası ---- */
.status-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(22,163,74,.2);
    animation: pulse-green 2s infinite;
}

.status-dot.offline {
    background: #9ca3af;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
    50% { box-shadow: 0 0 0 6px rgba(22,163,74,.05); }
}

/* ---- Değer Göstergesi ---- */
.ch-value-display {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ch-color, var(--primary));
    line-height: 1;
}

.ch-value-unit {
    font-size: .8rem;
    color: var(--text-muted);
    margin-left: 3px;
}

/* ---- Güncelleme Zamanı ---- */
.ch-updated {
    font-size: .68rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ---- Oda Filtre Butonları ---- */
.room-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.room-filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: .82rem;
    font-weight: 500;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.room-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.room-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* ---- Bildirim Paneli ---- */
.notification-panel {
    position: fixed;
    top: var(--navbar-h);
    right: 0;
    width: 360px;
    max-height: calc(100vh - var(--navbar-h));
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    transform: translateX(100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
}

.notification-panel.open {
    transform: translateX(0);
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.notification-item:hover {
    background: var(--bg-main);
}

.notification-item.unread {
    background: rgba(37,99,235,.04);
}

/* ---- Toast ---- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-msg {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .875rem;
    min-width: 260px;
    max-width: 360px;
    animation: slideInRight .3s ease;
}

.toast-msg.success { border-left: 3px solid var(--success); }
.toast-msg.error   { border-left: 3px solid var(--danger); }
.toast-msg.warning { border-left: 3px solid var(--warning); }
.toast-msg.info    { border-left: 3px solid var(--info); }

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ---- Tablo ---- */
.table { color: var(--text-primary); }

.table th {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-color: var(--border);
    white-space: nowrap;
}

.table td {
    border-color: var(--border);
    vertical-align: middle;
    font-size: .875rem;
}

.table-hover tbody tr:hover {
    background: rgba(37,99,235,.03);
}

/* ---- Form ---- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: .875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
    background: var(--bg-card);
    color: var(--text-primary);
}

.input-group-text {
    background: var(--bg-main);
    border-color: var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* ---- Butonlar ---- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: .875rem;
    transition: all var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

/* ---- Badge ---- */
.badge {
    font-weight: 500;
    font-size: .72rem;
    padding: .3em .6em;
    border-radius: 6px;
}

/* ---- Auth Sayfası ---- */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 8px 20px rgba(37,99,235,.4);
}

/* ---- Oda Kartları ---- */
.room-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.room-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.room-icon-wrap {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(37,99,235,.1), rgba(37,99,235,.05));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary);
    margin-bottom: 12px;
}

/* ---- Grafik Alanı ---- */
.chart-container {
    position: relative;
    height: 240px;
}

/* ---- Boş Durum ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: .4;
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ---- Log Satırları ---- */
.log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
}

.log-item:last-child { border-bottom: none; }

.log-badge {
    font-size: .65rem;
    padding: .25em .6em;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Log badge ek renkleri */
.bg-purple  { background-color: #7c3aed !important; }
.bg-teal    { background-color: #0d9488 !important; }
.bg-orange  { background-color: #ea580c !important; }

/* ---- Otomasyon ---- */
.automation-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.automation-card:hover {
    box-shadow: var(--shadow-md);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Sidebar Overlay (Mobil) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1030;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .page-content { padding: 16px; }
    .top-navbar { padding: 0 16px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.4rem; }
}

/* ---- Yükleniyor ---- */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

[data-theme="dark"] .loading-overlay {
    background: rgba(15,23,42,.82);
}

.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

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

/* ---- Renk Yardımcıları ---- */
.text-primary-custom { color: var(--primary); }
.bg-primary-soft { background: rgba(37,99,235,.08); }
.bg-success-soft { background: rgba(22,163,74,.08); }
.bg-danger-soft  { background: rgba(220,38,38,.08); }
.bg-warning-soft { background: rgba(217,119,6,.08); }
.bg-info-soft    { background: rgba(8,145,178,.08); }

/* ---- Cihaz Kart (Cihazlar Sayfası) ---- */
.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.device-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.device-card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.device-card-body {
    padding: 14px 16px;
}

.device-card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-main);
}

/* ---- Modal ---- */
.modal-content {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 14px 20px;
}

/* ---- İkon Seçici ---- */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.icon-pick-btn {
    aspect-ratio: 1;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .95rem;
    transition: all var(--transition);
}

.icon-pick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37,99,235,.06);
}

.icon-pick-btn.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

/* ---- Dark Mode Toggle ---- */
.theme-toggle {
    cursor: pointer;
}

/* ============================================================
   DARK MODE — Bootstrap + Custom Kapsamlı Override
   ============================================================ */

/* Bootstrap global CSS değişkenlerini dark modda ezeriz */
[data-theme="dark"] {
    --bs-body-bg:                    var(--bg-main);
    --bs-body-color:                 var(--text-primary);
    --bs-card-bg:                    var(--bg-card);
    --bs-card-border-color:          var(--border);
    --bs-border-color:               var(--border);
    --bs-border-color-translucent:   rgba(255,255,255,.1);

    /* Dropdown */
    --bs-dropdown-bg:                var(--bg-card);
    --bs-dropdown-color:             var(--text-primary);
    --bs-dropdown-border-color:      var(--border);
    --bs-dropdown-link-color:        var(--text-primary);
    --bs-dropdown-link-hover-bg:     rgba(255,255,255,.07);
    --bs-dropdown-link-hover-color:  var(--text-primary);
    --bs-dropdown-divider-bg:        var(--border);

    /* Modal */
    --bs-modal-bg:                   var(--bg-card);
    --bs-modal-color:                var(--text-primary);
    --bs-modal-border-color:         var(--border);
    --bs-modal-header-border-color:  var(--border);
    --bs-modal-footer-border-color:  var(--border);

    /* Form */
    --bs-input-bg:                   var(--bg-card);
    --bs-form-control-bg:            var(--bg-card);
    --bs-form-control-color:         var(--text-primary);
    --bs-form-select-bg:             var(--bg-card);
    --bs-form-select-color:          var(--text-primary);
    --bs-input-border-color:         var(--border);
    --bs-input-placeholder-color:    var(--text-muted);
    --bs-input-focus-border-color:   var(--primary);

    /* Table */
    --bs-table-bg:                   transparent;
    --bs-table-color:                var(--text-primary);
    --bs-table-border-color:         var(--border);
    --bs-table-striped-bg:           rgba(255,255,255,.025);
    --bs-table-hover-bg:             rgba(37,99,235,.05);

    /* Nav */
    --bs-nav-link-color:             var(--text-secondary);
    --bs-navbar-color:               var(--text-primary);
    --bs-navbar-bg:                  var(--bg-card);

    /* Breadcrumb */
    --bs-breadcrumb-divider-color:   var(--text-muted);
    --bs-breadcrumb-item-active-color: var(--text-muted);
}

/* ---- body ---- */
[data-theme="dark"] body {
    background-color: var(--bg-main);
    color: var(--text-primary);
}

/* ---- Card ---- */
[data-theme="dark"] .card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .card-header {
    background: rgba(255,255,255,.04);
    border-color: var(--border);
}
[data-theme="dark"] .card-footer {
    background: rgba(255,255,255,.04);
    border-color: var(--border);
}
/* (table-light kapsamlı kurallar aşağıda, tablo bölümünde) */
[data-theme="dark"] .thead-light th {
    background-color: rgba(255,255,255,.05) !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] .bg-light {
    background-color: rgba(255,255,255,.06) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

/* ---- Dropdown ---- */
[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background: rgba(255,255,255,.07);
    color: var(--text-primary);
}
[data-theme="dark"] .dropdown-divider {
    border-color: var(--border);
}

/* ---- Modal ---- */
[data-theme="dark"] .modal-content {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border);
}
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(1);
}

/* ---- Form Elemanları ---- */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.2);
}
[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly] {
    background-color: rgba(255,255,255,.05);
    color: var(--text-muted);
}
[data-theme="dark"] .input-group-text {
    background: rgba(255,255,255,.06);
    border-color: var(--border);
    color: var(--text-muted);
}
[data-theme="dark"] .form-text {
    color: var(--text-muted);
}
[data-theme="dark"] .form-check-label {
    color: var(--text-primary);
}

/* ---- Alert ---- */
[data-theme="dark"] .alert {
    border-color: transparent;
}
[data-theme="dark"] .alert-danger {
    background: rgba(220,38,38,.15);
    color: #fca5a5;
    border-color: rgba(220,38,38,.25);
}
[data-theme="dark"] .alert-success {
    background: rgba(22,163,74,.15);
    color: #86efac;
    border-color: rgba(22,163,74,.25);
}
[data-theme="dark"] .alert-warning {
    background: rgba(217,119,6,.15);
    color: #fcd34d;
    border-color: rgba(217,119,6,.25);
}
[data-theme="dark"] .alert-info {
    background: rgba(8,145,178,.15);
    color: #67e8f9;
    border-color: rgba(8,145,178,.25);
}

/* ---- Badge ---- */
[data-theme="dark"] .badge.bg-light {
    background-color: rgba(255,255,255,.14) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .text-dark { color: var(--text-primary) !important; }

/* ---- Metin yardımcıları dark ---- */
[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

/* ---- Pin satırı form etiketleri dark ---- */
[data-theme="dark"] .pin-row .form-label,
[data-theme="dark"] .pin-row small {
    color: var(--text-secondary);
}

/* ---- Breadcrumb ---- */
[data-theme="dark"] .breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}
[data-theme="dark"] .breadcrumb-item.active,
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

/* ---- Table ---- */
[data-theme="dark"] .table {
    --bs-table-bg:           transparent;
    --bs-table-color:        var(--text-primary);
    --bs-table-border-color: var(--border);
    color: var(--text-primary);
    border-color: var(--border);
}
/* Tüm hücreler (thead + tbody + tfoot) */
[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: var(--bs-table-bg);
    color: var(--text-primary);
    border-bottom-color: var(--border);
}
/* Tablo başlık satırı — Bootstrap'in table-light ve varsayılan rengi ezer */
[data-theme="dark"] .table thead,
[data-theme="dark"] .table thead tr {
    --bs-table-bg:    rgba(255,255,255,.05);
    --bs-table-color: var(--text-muted);
    background-color: rgba(255,255,255,.05);
}
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table thead td {
    background-color: rgba(255,255,255,.05) !important;
    color:            var(--text-muted)     !important;
    border-color:     var(--border)         !important;
}
/* table-light sınıfı (Bootstrap thead'e eklenince beyaz kalır) */
[data-theme="dark"] .table-light,
[data-theme="dark"] thead.table-light,
[data-theme="dark"] .table thead.table-light th,
[data-theme="dark"] .table thead.table-light td {
    --bs-table-color:      var(--text-muted);
    --bs-table-bg:         rgba(255,255,255,.05);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: rgba(255,255,255,.035);
    --bs-table-hover-bg:   rgba(255,255,255,.07);
    background-color: rgba(255,255,255,.05) !important;
    color:            var(--text-muted)     !important;
    border-color:     var(--border)         !important;
}
[data-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: rgba(37,99,235,.06);
}

/* ---- Code ---- */
[data-theme="dark"] code {
    background: rgba(37,99,235,.15);
    color: #93c5fd;
    padding: .15em .4em;
    border-radius: 4px;
}
[data-theme="dark"] pre {
    background: rgba(255,255,255,.05);
    color: var(--text-primary);
    border-color: var(--border);
}

/* ---- Nav pills/tabs ---- */
[data-theme="dark"] .nav-link {
    color: var(--text-secondary);
}
[data-theme="dark"] .nav-link:hover {
    color: var(--text-primary);
}

/* ---- HR ---- */
[data-theme="dark"] hr {
    border-color: var(--border);
    opacity: 1;
}

/* ---- Scrollbar dark ---- */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
}

/* ---- Pin satırları (admin) ---- */
[data-theme="dark"] .pin-row {
    background: rgba(255,255,255,.04) !important;
    border-color: var(--border) !important;
}

/* ---- SweetAlert2 dark ---- */
[data-theme="dark"] .swal2-popup {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}
[data-theme="dark"] .swal2-title { color: var(--text-primary) !important; }
[data-theme="dark"] .swal2-html-container { color: var(--text-secondary) !important; }
[data-theme="dark"] .swal2-input,
[data-theme="dark"] .swal2-select,
[data-theme="dark"] .swal2-textarea {
    background: var(--bg-main) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

/* ---- Auth kart (login/register) ---- */
[data-theme="dark"] .auth-card {
    background: var(--bg-card);
    box-shadow: 0 25px 50px rgba(0,0,0,.5);
}
[data-theme="dark"] .auth-card h4,
[data-theme="dark"] .auth-card p {
    color: var(--text-primary) !important;
}

/* ============================================================
   KART BOYUTU SEÇİCİ
   ============================================================ */
.size-picker {
    display: flex;
    gap: 10px;
}

.size-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-secondary);
    font-size: .75rem;
    font-weight: 500;
}

.size-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37,99,235,.04);
}

.size-btn.active {
    border-color: var(--primary);
    background: rgba(37,99,235,.08);
    color: var(--primary);
}

.size-preview {
    border-radius: 5px;
    background: var(--bg-main);
    border: 1.5px solid currentColor;
    transition: all var(--transition);
    height: 28px;
}

.size-preview-sm  { width: 28px; }
.size-preview-md  { width: 48px; }
.size-preview-lg  { width: 72px; }

.size-btn.active .size-preview {
    background: rgba(37,99,235,.2);
}

/* ---- Dark mode size-picker ---- */
[data-theme="dark"] .size-btn {
    background: var(--bg-card);
}
[data-theme="dark"] .size-preview {
    background: rgba(255,255,255,.06);
}
[data-theme="dark"] .size-btn.active .size-preview {
    background: rgba(37,99,235,.25);
}

/* ---- Renk Seçici Swatch ---- */
.color-swatch-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.color-swatch {
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--transition);
    flex-shrink: 0;
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--text-primary); transform: scale(1.15); }

/* ---- Setup / Sihirbaz sayfası ---- */
.wizard-step {
    display: none;
}
.wizard-step.active {
    display: block;
    animation: fadeIn .3s ease;
}

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

/* ---- Drag & Drop Sıralama (Sortable.js) ---- */
.sortable-ghost { opacity: .4; background: rgba(37,99,235,.1); border-radius: 12px; }
.drag-handle:active { cursor: grabbing; }

/* ---- Bildirim Paneli ---- */
.notif-panel {
    position: fixed;
    top: 0; right: -380px;
    width: 360px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: right .28s cubic-bezier(.4,0,.2,1);
}

.notif-panel.open { right: 0; }

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.notif-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
}

.notif-item:hover { background: var(--bg-main); }

.notif-item.unread { background: rgba(37,99,235,.04); }
.notif-item.unread::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.notif-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.notif-icon.info    { background: rgba(8,145,178,.12);  color: #0891b2; }
.notif-icon.success { background: rgba(22,163,74,.12);  color: #16a34a; }
.notif-icon.warning { background: rgba(217,119,6,.12);  color: #d97706; }
.notif-icon.danger  { background: rgba(220,38,38,.12);  color: #dc2626; }

.notif-title {
    font-size: .84rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 3px;
}

.notif-body {
    font-size: .78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-time {
    font-size: .72rem;
    color: var(--text-muted);
}

.notif-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity var(--transition), color var(--transition);
    flex-shrink: 0;
    margin-top: -2px;
}

.notif-item:hover .notif-delete-btn { opacity: 1; }
.notif-delete-btn:hover { color: var(--danger); }

.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: var(--text-muted);
    font-size: .85rem;
    text-align: center;
}

.notif-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 1049;
    backdrop-filter: blur(2px);
}

.notif-overlay.show { display: block; }

.btn-icon-sm {
    width: 28px; height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: .8rem;
    transition: all var(--transition);
}

.btn-icon-sm:hover { background: var(--bg-main); color: var(--text-primary); }
.btn-icon-sm.text-danger-soft:hover { color: var(--danger); }

.badge-count-notif {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 16px; height: 16px;
    background: var(--danger);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-card);
    line-height: 1;
}

@media (max-width: 480px) {
    .notif-panel { width: 100%; right: -100%; }
}

/* ============================================================
   LED / PWM / RGB KANAL KARTLARI
   ============================================================ */

/* ---- Range Slider (PWM, Parlaklık, Hız) ---- */
.led-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: var(--border);
    outline: none;
    cursor: pointer;
    display: block;
}

.led-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--slider-color, var(--primary));
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    transition: transform .15s ease;
}

.led-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.led-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--slider-color, var(--primary));
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

.led-slider:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* Dark mode slider track */
[data-theme="dark"] .led-slider {
    background: rgba(255,255,255,.12);
}

/* ---- Renk Input ---- */
.led-color-input {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    cursor: pointer;
    background: none;
    transition: border-color var(--transition), transform var(--transition);
    flex-shrink: 0;
}

.led-color-input:hover {
    border-color: var(--primary);
    transform: scale(1.08);
}

.led-color-input:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ---- LED Strip Panel ---- */
.led-strip-panel {
    margin-top: 12px;
}

/* ---- Efekt Buton Izgarası ---- */
.led-effects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 5px;
}

.led-effect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 3px 6px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: .63rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.led-effect-btn i {
    font-size: .82rem;
    flex-shrink: 0;
}

.led-effect-btn:hover:not(:disabled) {
    border-color: var(--ef-color, var(--primary));
    color: var(--ef-color, var(--primary));
    background: var(--bg-main);
}

.led-effect-btn.active {
    border-color: var(--ef-color, var(--primary));
    color: var(--ef-color, var(--primary));
    background: var(--bg-main);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px var(--ef-color, var(--primary));
}

.led-effect-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Dark mode effect buttons */
[data-theme="dark"] .led-effect-btn {
    background: rgba(255,255,255,.04);
}

[data-theme="dark"] .led-effect-btn:hover:not(:disabled),
[data-theme="dark"] .led-effect-btn.active {
    background: rgba(255,255,255,.08);
}

/* ---- Sahneler Bölümü ---- */
.led-scenes-section {
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

/* ---- RGB önizleme dairesi hover efekti ---- */
[id^="rgb-preview-"] {
    transition: box-shadow var(--transition), transform var(--transition);
}

[id^="rgb-preview-"]:hover {
    box-shadow: 0 0 0 4px var(--border);
    transform: scale(1.05);
}

/* ============================================================
   DASHBOARD v4 — Cihaz Gruplu Kompakt Kartlar
   ============================================================ */

/* ---- Cihaz Grubu Başlığı ---- */
.device-group {
    margin-bottom: 20px;
}

.device-group-header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.device-group-header a {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition);
}

.device-group-header a:hover {
    color: var(--primary);
}

.device-group-header .dg-room {
    font-size: .7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Kompakt Kanal Kartı ---- */
.ch-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    min-height: 58px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
    overflow: hidden;
}

.ch-card:hover {
    box-shadow: var(--shadow-md);
}

.ch-card.offline {
    opacity: .65;
}

/* Sol renk şeridi */
.ch-card-strip {
    width: 4px;
    align-self: stretch;
    flex-shrink: 0;
    border-radius: 4px 0 0 4px;
    margin-right: 10px;
}

/* İkon kutusu */
.ch-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    flex-shrink: 0;
    margin-right: 9px;
}

/* Orta: isim */
.ch-card-body {
    flex: 1;
    min-width: 0;
    padding: 8px 0;
}

.ch-card-name {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    margin: 0;
}

/* Sağ: kontrol alanı */
.ch-card-ctrl {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    padding: 0 10px 0 6px;
}

/* Durum metni (AÇIK/KAPALI vb.) */
.ch-card-value {
    font-size: .74rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Renk önizleme noktası */
.ch-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

/* Efekt chip */
.ch-effect-chip {
    font-size: .63rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--bg-main);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* Düzenle butonu */
.ch-edit-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .75rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.ch-edit-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.ch-edit-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* PWM mini slider */
.ch-pwm-mini {
    width: 80px;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .ch-pwm-mini { width: 60px; }
}

/* ---- Offcanvas (RGB / LED Strip tam kontrol) ---- */
[data-theme="dark"] .offcanvas {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="dark"] .offcanvas-header {
    border-color: var(--border);
}

[data-theme="dark"] .offcanvas-title {
    color: var(--text-primary);
}

/* Dark mode: yeni kanal kartları */
[data-theme="dark"] .device-group-header {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="dark"] .ch-card {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="dark"] .ch-edit-btn {
    background: rgba(255,255,255,.06);
    border-color: var(--border);
}

[data-theme="dark"] .ch-effect-chip {
    background: rgba(255,255,255,.06);
    border-color: var(--border);
    color: var(--text-secondary);
}
