/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f8fafc;
    color: #1e293b;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
}

.dashboard {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ========== LOGIN PAGE ========== */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 32px;
    padding: 40px 40px 35px 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 55px;
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 26px;
    color: #1e293b;
    margin-bottom: 6px;
}

.login-header p {
    color: #64748b;
    font-size: 13px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.input-group label i {
    margin-right: 8px;
    color: #8e2de2;
}

.input-group input {
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #8e2de2;
    box-shadow: 0 0 0 3px rgba(142, 45, 226, 0.2);
}

.btn-login, .btn-register {
    padding: 12px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    color: white;
    margin-top: 8px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(78, 0, 224, 0.4);
}

.btn-register {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    color: white;
    margin-top: 10px;
    margin-bottom: 5px;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(78, 0, 224, 0.4);
}

.register-link {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    margin-top: 12px;
    margin-bottom: 5px;
}

.register-link a {
    color: #8e2de2;
    text-decoration: none;
    font-weight: 600;
}

.register-link a:hover {
    text-decoration: underline;
}

.login-info {
    background: #f8fafc;
    border-radius: 14px;
    padding: 12px;
    margin-top: 20px;
    text-align: center;
}

.login-info p {
    font-size: 11px;
    color: #64748b;
    margin: 3px 0;
}

.login-info .demo-id {
    font-family: monospace;
    background: #e2e8f0;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    color: #334155;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    box-shadow: 4px 0 10px rgba(0,0,0,0.02);
    transition: width 0.3s;
    z-index: 1000;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.logo i {
    font-size: 28px;
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo span {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    background: #f8fafc;
    border-radius: 16px;
    margin: 16px;
}

.user-profile i {
    font-size: 40px;
    color: #8e2de2;
}

.user-info-sidebar {
    flex: 1;
}

.user-info-sidebar .user-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.user-info-sidebar .user-id {
    font-size: 11px;
    color: #64748b;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    position: relative;
    z-index: 10;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #64748b;
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 4px;
    transition: all 0.3s;
    cursor: pointer;
}

.sidebar-nav a i {
    width: 20px;
    font-size: 18px;
}

.sidebar-nav a:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(78, 0, 224, 0.3);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

.logout-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}

.logout-btn i {
    font-size: 18px;
}

/* ========== SIDEBAR OVERLAY ========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px 40px;
    width: calc(100% - 280px);
    max-width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
    box-sizing: border-box;
    background: #f8fafc;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-left h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.greeting {
    color: #64748b;
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.device-status {
    background: #e6f7e6;
    color: #2e7d32;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    color: #4CAF50;
    font-size: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ========== HAMBURGER BUTTON ========== */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #1e293b;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
}

.hamburger-btn:hover {
    background: #f1f5f9;
}

/* ========== STATS CARDS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid #e2e8f0;
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    font-size: 24px;
    color: white;
}

.stat-label {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

/* ========== DASHBOARD GRID ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
    max-width: 100%;
}

.dashboard-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    font-size: 20px;
    color: #8e2de2;
}

.card-title h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.normal-badge {
    font-size: 11px;
    background: #ede7f6;
    color: #5e35b1;
    padding: 4px 8px;
    border-radius: 20px;
    font-weight: 500;
}

.card-value .value {
    font-size: 36px;
    font-weight: 700;
    color: #1e293b;
}

.card-value .unit {
    font-size: 14px;
    color: #64748b;
    margin-left: 4px;
}

.card-trend {
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chart-wrapper {
    height: 80px;
    margin-bottom: 16px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #64748b;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.min-max {
    display: flex;
    gap: 12px;
}

.min-max span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.update-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========== HISTORY PAGE ========== */
#history-page .page-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

#history-page .page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    flex: 1;
    min-width: 150px;
}

#history-page .date-filter {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px;
    flex-shrink: 0;
}

#history-page .date-filter input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: white;
    color: #1e293b;
    outline: none;
    width: 140px;
    height: 38px;
}

#history-page .date-filter input[type="date"]:focus {
    border-color: #8e2de2;
    box-shadow: 0 0 0 3px rgba(142, 45, 226, 0.2);
}

#history-page .date-filter .filter-btn,
#history-page .date-filter .export-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
    height: 38px;
    white-space: nowrap;
}

#history-page .date-filter .filter-btn {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    color: white;
}

#history-page .date-filter .filter-btn:hover {
    background: linear-gradient(135deg, #7b26cc 0%, #3d00b8 100%);
    transform: translateY(-1px);
}

#history-page .date-filter .export-btn {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    color: white;
}

#history-page .date-filter .export-btn:hover {
    background: linear-gradient(135deg, #7b26cc 0%, #3d00b8 100%);
    transform: translateY(-1px);
}

.history-table-container {
    background: white;
    border-radius: 20px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    min-width: 600px;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

.history-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    font-size: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) { min-width: 140px; }
.history-table th:nth-child(2),
.history-table td:nth-child(2) { min-width: 80px; }
.history-table th:nth-child(3),
.history-table td:nth-child(3) { min-width: 70px; }
.history-table th:nth-child(4),
.history-table td:nth-child(4) { min-width: 70px; }
.history-table th:nth-child(5),
.history-table td:nth-child(5) { min-width: 90px; }

.history-table tr:hover td {
    background: #f8fafc;
}

.history-table .no-data {
    text-align: center;
    color: #94a3b8;
    padding: 40px !important;
    font-size: 14px;
}

/* ========== STATUS ========== */
.status-normal { color: #10b981; font-weight: 600; }
.status-warning { color: #f59e0b; font-weight: 600; }
.status-danger { color: #ef4444; font-weight: 600; }

/* ========== DEVICE PAGE ========== */
.page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 24px;
    width: 100%;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
    text-align: left;
}

.page-header .page-subtitle {
    color: #64748b;
    font-size: 14px;
    margin: 0;
    text-align: left;
}

.device-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 100%;
}

.device-card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    height: 100%;
    box-sizing: border-box;
}

.device-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.device-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: #1e293b;
    font-size: 17px;
    font-weight: 600;
    flex-shrink: 0;
}

.device-card h3 i {
    color: #8e2de2;
    font-size: 20px;
}

.device-card .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.device-card .info-row:last-of-type {
    flex: 1;
}

.device-card .info-row.toggle-row {
    padding-top: 12px !important;
    border-bottom: none !important;
    border-top: 1px solid #f1f5f9 !important;
    margin-top: auto !important;
    flex: 0 !important;
}

.info-label {
    color: #64748b;
    font-weight: 500;
    font-size: 14px;
}

.info-value {
    color: #1e293b;
    font-weight: 600;
    font-size: 14px;
}

/* ========== TOGGLE SWITCH ========== */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-label {
    position: relative;
    width: 52px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    padding: 0 4px;
}

.toggle-label .toggle-on,
.toggle-label .toggle-off {
    position: absolute;
    font-size: 10px;
    font-weight: 700;
    transition: all 0.3s;
}

.toggle-label .toggle-on {
    left: 8px;
    color: white;
    opacity: 0;
}

.toggle-label .toggle-off {
    right: 8px;
    color: #94a3b8;
    opacity: 1;
}

.toggle-label::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-label {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
}

.toggle-switch input:checked + .toggle-label .toggle-on {
    opacity: 1;
}

.toggle-switch input:checked + .toggle-label .toggle-off {
    opacity: 0;
}

.toggle-switch input:checked + .toggle-label::after {
    transform: translateX(24px);
}

/* ========== REPORT PAGE ========== */
.report-header {
    margin-bottom: 24px;
}

.report-header h2 {
    color: #1e293b;
    margin-bottom: 4px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid #e2e8f0;
}

.summary-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.summary-icon i {
    font-size: 30px;
    color: white;
}

.heart-bg { background: linear-gradient(135deg, #ff4444 0%, #ff6b6b 100%); }
.spo2-bg { background: linear-gradient(135deg, #4CAF50 0%, #6fbf73 100%); }
.temp-bg { background: linear-gradient(135deg, #FFA500 0%, #ffb347 100%); }

.summary-details {
    flex: 1;
}

.summary-label {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.summary-sub {
    font-size: 11px;
    color: #94a3b8;
}

.report-chart {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 30px;
    border: 1px solid #e2e8f0;
}

.report-chart .chart-wrapper {
    width: 100%;
    height: 350px;
    position: relative;
}

.report-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.report-conclusion {
    background: white;
    border-radius: 20px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

.conclusion-content {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    line-height: 1.6;
    color: #334155;
}

/* ========== NOTIFICATION ========== */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.notification-popup {
    background: white;
    border-radius: 16px;
    width: 360px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
}

.notification-popup.show { transform: translateX(0); }
.notification-popup.hide { transform: translateX(100%); }

.notification-popup.success {
    border-left: 4px solid #8e2de2;
    background: linear-gradient(135deg, #ffffff 0%, #ede7f6 100%);
}
.notification-popup.error {
    border-left: 4px solid #ef4444;
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}
.notification-popup.warning {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}
.notification-popup.info {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}

.notification-popup-icon { font-size: 24px; flex-shrink: 0; }
.notification-popup.success .notification-popup-icon { color: #8e2de2; }
.notification-popup.error .notification-popup-icon { color: #ef4444; }
.notification-popup.warning .notification-popup-icon { color: #f59e0b; }
.notification-popup.info .notification-popup-icon { color: #3b82f6; }

.notification-popup-content { flex: 1; }
.notification-popup-title {
    font-weight: 700;
    font-size: 15px;
    color: #1e293b;
    margin-bottom: 4px;
}
.notification-popup-message {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}
.notification-popup-close {
    cursor: pointer;
    color: #94a3b8;
    font-size: 14px;
    transition: color 0.2s;
}
.notification-popup-close:hover { color: #1e293b; }

.notification-popup-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0,0,0,0.1);
    width: 100%;
    animation: progress 4s linear forwards;
}
.notification-popup.success .notification-popup-progress { background: #10b981; }
.notification-popup.error .notification-popup-progress { background: #ef4444; }
.notification-popup.warning .notification-popup-progress { background: #f59e0b; }

@keyframes progress {
    from { width: 100%; }
    to { width: 0%; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========== PASSWORD WRAPPER ========== */
.password-group {
    position: relative;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-wrapper input {
    width: 100%;
    padding-right: 45px;
    padding-left: 14px;
    height: 46px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s;
    background: white;
}

.password-wrapper input:focus {
    outline: none;
    border-color: #8e2de2;
    box-shadow: 0 0 0 3px rgba(142, 45, 226, 0.15);
}

.password-wrapper .toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #94a3b8;
    font-size: 18px;
    transition: all 0.3s;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.password-wrapper .toggle-password:hover {
    color: #8e2de2;
}

/* ========== FORGOT PASSWORD ========== */
.forgot-password-link {
    text-align: center;
    font-size: 13px;
    margin-top: -6px;
    margin-bottom: 4px;
}

.forgot-password-link a {
    color: #8e2de2;
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    transition: all 0.3s;
}

.forgot-password-link a:hover {
    text-decoration: underline;
}

.forgot-header {
    margin-bottom: 10px;
}

/* ========== BOTTOM NAV (HP ONLY) ========== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    justify-content: space-around;
    padding: 8px 0 12px 0;
    border-top: 1px solid #e2e8f0;
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.3s;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    min-width: 56px;
    cursor: pointer;
}

.bottom-nav a i {
    font-size: 22px;
    transition: all 0.3s;
}

.bottom-nav a.active {
    color: #8e2de2;
}

.bottom-nav a.active i {
    color: #8e2de2;
}

.bottom-nav a:hover {
    color: #8e2de2;
}

/* ========== PAGE ========== */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== DIVIDER ========== */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    margin: 8px 0 4px 0;
    gap: 10px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.divider span {
    padding: 0 4px;
    font-weight: 500;
}

/* ========== ADMIN LINK ========== */
.admin-link {
    text-align: center;
    font-size: 13px;
    margin-top: 4px;
}

.admin-link a {
    color: #8e2de2;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 12px;
    transition: all 0.3s;
    background: #ede7f6;
}

.admin-link a:hover {
    background: #d1c4e9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(142, 45, 226, 0.2);
}

.admin-link a i {
    font-size: 14px;
}

/* ========== DATA LIMIT BAR ========== */
.data-limit-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 12px;
}

.limit-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.limit-left label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

#data-limit {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: white;
    color: #1e293b;
    cursor: pointer;
    outline: none;
    height: 38px;
    min-width: 180px;
}

#data-limit:focus {
    border-color: #8e2de2;
    box-shadow: 0 0 0 3px rgba(142, 45, 226, 0.15);
}

.apply-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    color: white;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    transition: all 0.3s;
    white-space: nowrap;
}

.apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(78, 0, 224, 0.3);
}

.limit-right {
    flex-shrink: 0;
}

.data-info {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 500;
}

.data-info i {
    color: #8e2de2;
}

/* ========== RESPONSIVE DATA LIMIT BAR ========== */
@media screen and (max-width: 768px) {
    .data-limit-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
    }
    
    .limit-left {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }
    
    .limit-left label {
        display: none;
    }
    
    #data-limit {
        width: 100%;
        min-width: unset;
    }
    
    .apply-btn {
        width: 100%;
        justify-content: center;
    }
    
    .limit-right {
        width: 100%;
    }
    
    .data-info {
        justify-content: center;
        width: 100%;
    }
}

/* ========== REPORT FILTER BAR ========== */
.report-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.filter-group label i {
    color: #8e2de2;
    margin-right: 4px;
}

#report-period-select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: white;
    color: #1e293b;
    cursor: pointer;
    outline: none;
    height: 38px;
    min-width: 180px;
}

#report-period-select:focus {
    border-color: #8e2de2;
    box-shadow: 0 0 0 3px rgba(142, 45, 226, 0.15);
}

.custom-date-range {
    display: flex;
    gap: 12px;
    align-items: center;
}

.date-input {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-input label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.date-input input[type="date"] {
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: white;
    color: #1e293b;
    outline: none;
    height: 38px;
}

.date-input input[type="date"]:focus {
    border-color: #8e2de2;
    box-shadow: 0 0 0 3px rgba(142, 45, 226, 0.15);
}

.apply-report-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    color: white;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    transition: all 0.3s;
    white-space: nowrap;
    margin-left: auto;
}

.apply-report-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(78, 0, 224, 0.3);
}

/* Responsive */
@media screen and (max-width: 768px) {
    .report-filter-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    #report-period-select {
        width: 100%;
        min-width: unset;
    }
    
    .custom-date-range {
        flex-direction: column;
        width: 100%;
    }
    
    .date-input {
        width: 100%;
    }
    
    .date-input input[type="date"] {
        width: 100%;
    }
    
    .apply-report-btn {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }
}
/* ========== RESPONSIVE ========== */

/* Tablet & Laptop Kecil (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    .sidebar .logo span,
    .sidebar-nav a span,
    .user-info-sidebar,
    .logout-btn span {
        display: none;
    }
    .sidebar-nav a {
        justify-content: center;
        padding: 12px;
    }
    .sidebar-nav a i {
        margin: 0;
        font-size: 20px;
        width: auto;
    }
    .logo {
        justify-content: center;
        padding: 20px 0;
    }
    .logo i {
        font-size: 32px;
    }
    .user-profile {
        justify-content: center;
        padding: 12px;
        margin: 8px;
    }
    .user-profile i {
        font-size: 32px;
    }
    .main-content {
        margin-left: 80px;
        padding: 20px;
        width: calc(100% - 80px);
    }
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .device-info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* HP (max-width: 768px) */
@media screen and (max-width: 768px) {
    /* ===== SIDEBAR - SLIDE FROM LEFT ===== */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -300px !important;
        width: 280px !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: white !important;
        z-index: 1001 !important;
        transition: left 0.3s ease !important;
        box-shadow: 4px 0 30px rgba(0,0,0,0.2) !important;
        border-right: 1px solid #e2e8f0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important; 
    }
    
    .sidebar.open {
        left: 0 !important;
    }

    .sidebar-nav {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 16px !important;
        padding-bottom: 16px  !important;
        -webkit-overflow-scrolling: touch !important;
        min-height: 0 !important; 
    }

    /* Tampilkan semua elemen di sidebar HP */
    .sidebar .logo span,
    .sidebar-nav a span,
    .user-info-sidebar,
    .logout-btn span {
        display: inline !important;
    }
    
    .sidebar .logo {
        flex-shrink: 0 !important;
        justify-content: flex-start !important;
        padding: 16px 20px !important;
    }
    
    .sidebar-nav a {
        justify-content: flex-start;
        padding: 12px 16px;
    }
    
    .sidebar-nav a i {
        margin: 0;
        font-size: 18px;
        width: 24px;
        text-align: center;
    }
    
    .user-profile {
        flex-shrink: 0 !important;
        justify-content: flex-start !important;
        padding: 14px 16px !important;
        margin: 12px 16px !important;
    }
    
    .user-profile i {
        font-size: 36px;
    }
    
    .logout-btn {
        justify-content: center !important;
        padding: 12px 16px !important;
        width: 100% !important;
        background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%) !important;
        color: white !important;
        border-radius: 12px !important;
        font-weight: 600 !important;
        box-shadow: 0 4px 12px rgba(78, 0, 224, 0.3) !important;
    }
    
    .logout-btn i {
        font-size: 18px !important;
        width: 24px !important;
        text-align: center !important;
        color: white !important;
    }

    .logout-btn:hover {
    background: linear-gradient(135deg, #7b26cc 0%, #3d00b8 100%) !important;
    color: white !important;
    }
    
    /* ===== HAMBURGER BUTTON ===== */
    .hamburger-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        padding: 6px 10px;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .header-left h1 {
        font-size: 20px;
    }
    
    /* ===== MAIN CONTENT ===== */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 16px !important;
        padding-bottom: 80px !important;
    }
    
    /* ===== STATS CARDS ===== */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
    }
    
    .stat-icon i {
        font-size: 18px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    /* ===== DASHBOARD GRID ===== */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    .dashboard-card {
        padding: 16px;
    }
    
    .card-value .value {
        font-size: 28px;
    }
    
    .chart-wrapper {
        height: 60px;
    }
    
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .normal-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    /* ===== HISTORY PAGE ===== */
    #history-page .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }
    
    #history-page .page-header h2 {
        font-size: 18px;
        min-width: 100%;
    }
    
    #history-page .date-filter {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 6px;
    }
    
    #history-page .date-filter input[type="date"] {
        width: 100%;
        max-width: 200px;
        flex: 1;
        min-width: 120px;
        height: 36px;
        font-size: 12px;
    }
    
    #history-page .date-filter .filter-btn,
    #history-page .date-filter .export-btn {
        padding: 6px 12px;
        font-size: 12px;
        height: 36px;
        flex: 1;
        min-width: 70px;
        justify-content: center;
    }
    
    #history-page .date-filter .filter-btn i,
    #history-page .date-filter .export-btn i {
        font-size: 14px;
    }
    
    .history-table-container {
        padding: 12px;
        border-radius: 12px;
    }
    
    .history-table {
        font-size: 12px;
        min-width: 500px;
    }
    
    .history-table th,
    .history-table td {
        padding: 8px 10px;
    }
    
    .history-table th:nth-child(1),
    .history-table td:nth-child(1) {
        min-width: 120px;
    }
    
    .history-table th:nth-child(2),
    .history-table td:nth-child(2) {
        min-width: 60px;
    }
    
    .history-table th:nth-child(3),
    .history-table td:nth-child(3) {
        min-width: 60px;
    }
    
    .history-table th:nth-child(4),
    .history-table td:nth-child(4) {
        min-width: 60px;
    }
    
    .history-table th:nth-child(5),
    .history-table td:nth-child(5) {
        min-width: 70px;
    }
    
    /* ===== DEVICE PAGE ===== */
    .device-info-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .device-card {
        padding: 16px;
        min-height: 160px;
    }
    
    .device-card h3 {
        font-size: 15px;
    }
    
    .device-card .info-row {
        padding: 8px 0;
    }
    
    .info-label,
    .info-value {
        font-size: 13px;
    }
    
    /* ===== REPORT PAGE ===== */
    .report-summary {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .report-chart .chart-wrapper {
        height: 220px;
    }
    
    .report-chart h3 {
        font-size: 16px;
    }
    
    .summary-card {
        padding: 16px;
    }
    
    .summary-icon {
        width: 50px;
        height: 50px;
    }
    
    .summary-icon i {
        font-size: 24px;
    }
    
    .summary-value {
        font-size: 20px;
    }
    
    .page-header h2 {
        font-size: 20px;
    }
    
    .page-header .page-subtitle {
        font-size: 13px;
    }
    
    /* ===== NOTIFICATION ===== */
    .notification-popup {
        width: calc(100vw - 40px);
        max-width: 360px;
    }
    
    #notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .notification-popup {
        width: 100%;
    }
    
    /* ===== TOP HEADER ===== */
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .device-status {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .greeting {
        font-size: 13px;
    }
    
    /* ===== BOTTOM NAV ===== */
    .bottom-nav {
        display: flex !important;
    }

    .sidebar-footer {
        position: relative !important;
        bottom: 0 !important;
        padding: 16px !important;
        background: white !important;
        border-top: 1px solid #e2e8f0 !important;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.05) !important;
        margin-top: auto !important;
    }

    /* ===== SIDEBAR OVERLAY ===== */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

/* HP Kecil (max-width: 480px) */
@media screen and (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .login-header i {
        font-size: 48px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
    
    .main-content {
        padding: 12px !important;
        padding-bottom: 80px !important;
    }
    
    .header-left h1 {
        font-size: 18px;
    }
    
    .hamburger-btn {
        font-size: 20px;
        padding: 4px 8px;
    }
    
    .card-value .value {
        font-size: 24px;
    }
    
    .device-status {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    .report-chart .chart-wrapper {
        height: 180px;
    }
    
    .notification-popup {
        padding: 12px;
    }
    
    .notification-popup-title {
        font-size: 14px;
    }
    
    .notification-popup-message {
        font-size: 12px;
    }
}

/* Layar Lebar (>1600px) */
@media screen and (min-width: 1600px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}