:root {
    /* Palette Warna Air (Water Theme) */
    --primary-dark: #004e92;     /* Biru Tua Elegan */
    --primary-light: #00a8cc;    /* Cyan Cerah */
    --primary-mid: #0277bd;      /* Biru Medium */
    --bg-gradient: linear-gradient(135deg, #004e92 0%, #000428 100%);
    --surface-color: #ffffff;
    --text-color: #333333;
    --text-muted: #64748b;       /* Bootstrap-like muted color */
    --input-bg: #f4f7f6;
    --border-radius: 16px;
    --transition: all 0.3s ease;
    
    /* Variabel Tambahan untuk Dashboard */
    --sidebar-bg: #00152e;
    --dashboard-bg: #f4f6f9;     /* Background dashboard yang lebih jelas */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================================
   1. STYLE GLOBAL & LOGIN (Default)
   ========================================= */
body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gradient); /* Background default untuk Login */
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden; /* Mencegah scroll horizontal */
}

/* --- LAYOUT UTAMA LOGIN --- */
.login-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    background: var(--surface-color);
    overflow: hidden;
    position: relative;
}

/* --- SISI KIRI (BRANDING) --- */
.brand-section {
    flex: 1.2;
    background: url('https://picsum.photos/seed/watertreatment/1200/1600') no-repeat center center/cover;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    color: white;
}

.brand-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 78, 146, 0.7), rgba(0, 4, 40, 0.85));
    z-index: 1;
}

.brand-content {
    position: relative;
    z-index: 2;
    max-width: 450px;
    animation: fadeInUp 1s ease-out;
}

.app-logo {
    width: 140px;
    height: auto;
    margin-bottom: 20px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
    background-color: rgba(255,255,255,0.9); 
    padding: 10px;
    border-radius: 10%;
}

.sidebar .app-logo {
    width: 60px;
    margin-bottom: 10px;
}

.brand-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.brand-subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
}

.wave-decoration {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    line-height: 0;
    z-index: 2;
}

.wave-decoration svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 80px;
}

.wave-decoration .shape-fill {
    fill: #ffffff;
}

/* --- SISI KANAN (FORM LOGIN) --- */
.form-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    background: var(--surface-color);
    position: relative;
}

.form-header {
    margin-bottom: 40px;
}

.form-header h2 {
    font-size: 1.8rem;
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 8px;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* --- COMPONENTS (Shared) --- */
.input-group {
    position: relative;
    margin-bottom: 25px;
}

.input-group input {
    width: 100%;
    padding: 16px 20px 16px 50px; 
    border: 2px solid transparent;
    background-color: var(--input-bg);
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    color: var(--text-color);
    transition: var(--transition);
    outline: none;
}

.input-group input:focus {
    background-color: white;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(0, 168, 204, 0.1);
}

.input-group i.icon-left {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-dark);
    font-size: 1.1rem;
    transition: var(--transition);
}

.input-group input:focus ~ .icon-left {
    color: var(--primary-light);
}

.toggle-password {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    background: none;
    border: none;
}

.toggle-password:hover {
    color: var(--primary-dark);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 78, 146, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 78, 146, 0.4);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    cursor: pointer;
}

.forgot-pass {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.forgot-pass:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 5px solid;
}

.toast.show {
    transform: translateX(0);
}

.toast.success { border-color: #2ecc71; }
.toast.error { border-color: #e74c3c; }
.toast i { font-size: 1.2rem; }
.toast.success i { color: #2ecc71; }
.toast.error i { color: #e74c3c; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .brand-section { display: none; }
    .form-section { padding: 40px 20px; }
    body { height: auto; align-items: flex-start; background: white; }
    .login-wrapper { height: 100vh; overflow-y: auto; }
}


/* ===================================================================
   2. STYLE KHUSUS DASHBOARD
   =================================================================== */
body.page-dashboard {
    background-color: var(--dashboard-bg); /* Background Abu-abu Terang */
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow-x: hidden;
}

/* Hilangkan elemen Login saat di Dashboard */
body.page-dashboard .login-wrapper,
body.page-dashboard .brand-section,
body.page-dashboard .wave-decoration {
    display: none !important;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 80px;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--sidebar-bg) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: width 0.3s ease;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.sidebar:hover {
    width: 260px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
}

.sidebar-header {
    padding: 30px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: padding 0.3s ease;
}

.sidebar:hover .sidebar-header {
    padding: 30px 20px;
}

.sidebar-header h4 {
    font-size: 0.8rem;
    margin: 10px 0 0 0;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.sidebar:hover .sidebar-header h4 {
    opacity: 1;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex-grow: 1;
    margin: 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: 0.3s;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.sidebar:hover .sidebar-menu li a {
    justify-content: flex-start;
    padding: 15px 25px;
}

.sidebar-menu li a i {
    min-width: 40px;
    font-size: 1.2rem;
    text-align: center;
    margin-right: 0;
    transition: margin 0.3s;
}

.sidebar:hover .sidebar-menu li a i {
    margin-right: 15px;
}

.sidebar-menu li a span {
    opacity: 0;
    display: none;
}

.sidebar:hover .sidebar-menu li a span {
    opacity: 1;
    display: inline-block;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-menu li a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background: var(--primary-light);
    border-radius: 0 4px 4px 0;
}

/* --- MAIN CONTENT DASHBOARD --- */
.main-content {
    margin-left: 80px;
    width: calc(100% - 80px);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease, width 0.3s ease;
    height: 100vh;
    overflow-y: auto;
}

.sidebar:hover ~ .main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
}

.top-navbar {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 900;
}

.menu-toggle { 
    font-size: 1.5rem; 
    cursor: pointer; 
    color: var(--primary-dark); 
    display: none; 
}

.user-profile {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    background: #ffebee; 
    color: #e74c3c; 
    padding: 8px 15px; 
    border-radius: 8px;
    text-decoration: none; 
    font-size: 0.9rem; 
    font-weight: 600; 
    transition: 0.3s;
}

.btn-logout:hover { 
    background: #e74c3c; 
    color: white; 
}

.content-area {
    padding: 30px;
    flex-grow: 1;
}

/* Styling Teks User */
.user-info-text {
    text-align: right;
    display: block;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.user-role {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- DASHBOARD CARDS (Perbaikan Kontras) --- */
.card {
    background: #ffffff; /* Putih Tegas */
    border: 1px solid #e4e6eb; /* Border Abu-abu Sangat Muda */
    border-radius: 12px; /* Sudut Tumpul */
    box-shadow: 0 2px 4px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.02); /* Bayangan Halus */
    margin-bottom: 1.5rem;
    overflow: hidden; /* Konten tidak keluar */
    height: 100%; /* Agar tinggi sama dalam satu baris */
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #f3f4f6;
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.stat-card-exec {
    border-left: 4px solid transparent; /* Aksen kiri */
}
.stat-card-exec.alert-high {
    border-left: 4px solid #e74c3c;
}

/* Helper Classes kustom untuk dashboard (menggantikan Bootstrap utility yang hilang) */
.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.bg-light-primary { background-color: #e3f2fd; color: #0d47a1; }
.bg-light-warning { background-color: #fff3e0; color: #ef6c00; }
.bg-light-success { background-color: #e8f5e9; color: #1b5e20; }
.bg-light-danger { background-color: #ffebee; color: #b71c1c; }
.bg-light-info { background-color: #e1f5fe; color: #01579b; }

.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}
.badge-soft-success { color: #198754; background-color: #d1e7dd; }
.badge-soft-warning { color: #ffc107; background-color: #fff3cd; }
.badge-soft-danger { color: #dc3545; background-color: #f8d7da; }

.ls-1 { letter-spacing: 1px; }

/* Responsive Mobile Dashboard */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 260px; }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
    .menu-toggle { display: block; }
    .user-info-text { display: none; }
    .btn-logout .logout-text { display: none; }
}