/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.7);
    --border-color: rgba(15, 23, 42, 0.08);
    --border-glow: rgba(0, 162, 233, 0.15);
    
    --pln-blue: #00a2e9;
    --pln-yellow: #eab308;
    --pln-blue-glow: rgba(0, 162, 233, 0.2);
    --pln-yellow-glow: rgba(234, 179, 8, 0.2);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #d97706;
    
    --hover-bg: rgba(0, 162, 233, 0.06);
    --hover-color: var(--pln-blue);
    
    --sidebar-width: 260px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --transition-speed: 0.3s;
}

body.dark-mode {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --bg-card: rgba(26, 36, 62, 0.5);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(0, 162, 233, 0.2);
    
    --pln-yellow: #f9d806;
    --pln-blue-glow: rgba(0, 162, 233, 0.4);
    --pln-yellow-glow: rgba(249, 216, 6, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --warning: #f59e0b;
    
    --hover-bg: rgba(255, 255, 255, 0.04);
    --hover-color: #ffffff;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

input[type="password"], 
input[type="password"] *,
.no-uppercase, 
.no-uppercase *,
[style*="text-transform: none"],
[style*="text-transform: none"] *,
[style*="text-transform:none"],
[style*="text-transform:none"] * {
    text-transform: none !important;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

.glass:hover {
    border-color: rgba(0, 162, 233, 0.3);
    box-shadow: 0 0 15px rgba(0, 162, 233, 0.1);
    transition: all var(--transition-speed) ease;
}

/* App Layout */
.app-container {
    display: flex;
    width: 100%;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid var(--border-color);
    padding: 24px;
    transition: transform var(--transition-speed) ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--pln-blue), var(--pln-yellow));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #0b0f19;
    font-size: 1.1rem;
    box-shadow: 0 0 12px var(--pln-blue-glow);
}

.sidebar-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-title span {
    color: var(--pln-yellow);
    -webkit-text-fill-color: var(--pln-yellow);
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 20px;
}

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

.sidebar-link.active {
    border-left: 3px solid var(--pln-blue);
    background: linear-gradient(90deg, rgba(0, 162, 233, 0.1), transparent);
    box-shadow: inset 5px 0 10px rgba(0, 162, 233, 0.05);
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 162, 233, 0.2);
    border: 1px solid var(--pln-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pln-blue);
    font-weight: 600;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--danger);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background var(--transition-speed);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Header Dashboard */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-header h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2rem;
}

.content-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

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

.stat-card {
    border-radius: 16px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.stat-card.blue::before { background: var(--pln-blue); }
.stat-card.yellow::before { background: var(--pln-yellow); }
.stat-card.success::before { background: var(--success); }
.stat-card.danger::before { background: var(--danger); }

.stat-details h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-details .value {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.stat-details .unit {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card.blue .stat-icon { background: rgba(0, 162, 233, 0.1); color: var(--pln-blue); }
.stat-card.yellow .stat-icon { background: rgba(249, 216, 6, 0.1); color: var(--pln-yellow); }
.stat-card.success .stat-icon { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-card.danger .stat-icon { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* Dashboard Layout Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .main-content {
        margin-left: 0;
    }
}

.section-card {
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Charts Wrapper */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* Table Design */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-primary);
    vertical-align: middle;
    text-transform: uppercase;
}

.custom-table tr:hover td {
    background: var(--hover-bg);
}

/* Status Badges */
.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* UI Buttons & Controls */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-speed) ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--pln-blue);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 162, 233, 0.25);
}

.btn-primary:hover {
    background: #008cc9;
    box-shadow: 0 4px 16px rgba(0, 162, 233, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* Custom Remote Cutoff Toggles */
.switch-control {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch-control input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--danger);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,0.05);
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

input:checked + .slider {
    background-color: var(--success);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.switch-control.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.switch-control.disabled .slider {
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    width: 90%;
    max-width: 450px;
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-header.danger {
    color: var(--danger);
}

.modal-header.danger i {
    background: rgba(239, 68, 68, 0.1);
    padding: 8px;
    border-radius: 50%;
}

.modal-body {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Glassmorphism Login Box */
.login-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(0, 162, 233, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(249, 216, 6, 0.05) 0%, transparent 40%),
                var(--bg-primary);
}

.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--pln-blue), var(--pln-yellow));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #0b0f19;
    font-size: 1.8rem;
    box-shadow: 0 0 20px var(--pln-blue-glow);
}

.login-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.login-title span {
    color: var(--pln-yellow);
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px 12px 42px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-speed);
}

.form-input:focus {
    outline: none;
    border-color: var(--pln-blue);
    box-shadow: 0 0 8px var(--pln-blue-glow);
    background: var(--bg-secondary);
}

/* Alert Notification Banner */
.alert-banner {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.alert-banner.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Utility layout styles */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.device-card {
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-transform: uppercase;
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.device-meta h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.device-meta p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.device-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.85rem;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.device-info-row {
    display: flex;
    justify-content: space-between;
}

.device-info-row span:first-child {
    color: var(--text-secondary);
}

.device-info-row span:last-child {
    font-weight: 500;
}

.device-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Pagination UI */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.pagination-btn-group {
    display: flex;
    gap: 8px;
}

/* Action forms / Filters */
.filters-card {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: end;
    padding: 16px 20px;
    border-radius: 12px;
}

.filters-card .form-group {
    margin-bottom: 0;
    flex-grow: 1;
    min-width: 150px;
}

.filters-card .form-input {
    padding: 8px 12px;
}

.filters-card .btn {
    padding: 8px 16px;
}

/* iOS style toggle switch */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1; /* off state light mode */
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
}

.ios-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

input:checked + .ios-slider {
    background-color: var(--pln-blue);
}

input:checked + .ios-slider:before {
    transform: translateX(20px);
}

body.dark-mode .ios-slider {
    background-color: #334155; /* off state dark mode */
}

/* Horizontal Customer Row layout */
.device-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.device-card-row {
    border-radius: 14px;
    padding: 16px 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: all var(--transition-speed) ease;
}

.device-card-row:hover {
    border-color: rgba(0, 162, 233, 0.25);
    box-shadow: 0 4px 15px rgba(0, 162, 233, 0.05);
}

.device-row-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 100px;
}

.device-row-col.actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    flex: 0 0 auto;
    min-width: auto;
}

@media (max-width: 768px) {
    .device-card-row {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 20px;
    }
    .device-row-col {
        min-width: 100%;
    }
    .device-row-col.actions {
        justify-content: space-between;
        border-top: 1px solid var(--border-color);
        padding-top: 12px;
        margin-top: 6px;
    }
}

/* Mobile Top Bar (Hidden on desktops) */
.mobile-top-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    align-items: center;
    padding: 0 20px;
    z-index: 99;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: background var(--transition-speed);
}

.hamburger-btn:hover {
    background: var(--hover-bg);
}

.mobile-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mobile-brand span {
    color: var(--pln-yellow);
    -webkit-text-fill-color: var(--pln-yellow);
}

/* Sidebar Overlay Background */
.sidebar-overlay-bg {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.4);
    backdrop-filter: blur(4px);
    z-index: 98;
}

.sidebar-overlay-bg.active {
    display: block;
}

/* Media Queries for tablets and mobiles */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 280px;
    }
    
    .mobile-top-bar {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 80px 20px 40px 20px; /* Space for mobile top bar */
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
    }
    
    .content-header > div:last-child {
        width: 100%;
        text-align: left;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .modal {
        width: 95%;
        padding: 20px;
    }
    
    .modal form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    .filters-card form {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }
    
    .filters-card .form-group {
        width: 100% !important;
    }
    
    .filters-card button, .filters-card a.btn {
        width: 100% !important;
        text-align: center;
        justify-content: center;
    }
    .custom-table th, .custom-table td {
        white-space: nowrap;
    }
    .device-list-header {
        display: none !important;
    }
}

/* Table Header Row for Horizontal Grid */
.device-list-header {
    display: flex;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    border-radius: 12px;
}
.device-list-header .header-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

