:root {
    --primary: #E62129;
    --bg-color: #ffffff;
    --text-color: #333333;
    --card-bg: #f9f9f9;
    --table-hover: rgba(230, 33, 41, 0.1);
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #f1f1f1;
    --card-bg: #1e1e1e;
    --table-hover: rgba(255, 255, 255, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); transition: background 0.3s, color 0.3s; }

/* === LOGIN PAGE === */
.login-container { display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #ffffff; position: relative;padding: 10px; }
.login-card { background-color: var(--primary); padding: 40px; border-radius: 15px; width: 100%; max-width: 400px; box-shadow: 0 10px 25px rgba(230, 33, 41, 0.3); }
.input-group { position: relative; margin-bottom: 20px; }
.input-group input { width: 100%; padding: 15px 45px; border: none; border-radius: 8px; font-size: 14px; outline: none; }
.input-group i.icon-left { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--primary); font-size: 18px; }
.input-group i.icon-right { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--primary); font-size: 18px; cursor: pointer; }
.btn-login { width: 100%; padding: 15px; background: #ffffff; color: var(--primary); border: none; border-radius: 8px; font-weight: bold; font-size: 16px; cursor: pointer; transition: 0.3s; }
.btn-login:hover { background: #f1f1f1; }
.forgot-link { display: block; text-align: right; color: #ffffff; margin-top: 15px; text-decoration: none; font-size: 13px; font-weight: 500; }
.logo-bottom { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); max-width: 100px; }

/* === DASHBOARD === */
.navbar { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 60px; 
    background: #ffffff; /* Diubah: Fix warna putih, tidak mengikuti var(--bg-color) */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 0 20px; 
    z-index: 1000; 
    transition: background 0.3s; /* Efek transisi yang halus */
}
.navbar img.logo { height: 35px; }
.nav-actions { display: flex; gap: 20px; align-items: center; font-size: 20px; color: var(--primary); cursor: pointer; }
.content-wrapper { padding: 80px 20px 20px; max-width: 1200px; margin: auto; }

/* Sidebar Right */
.sidebar-right { position: fixed; right: -300px; top: 60px; width: 250px; height: calc(100vh - 60px); background: var(--bg-color); box-shadow: -2px 0 10px rgba(0,0,0,0.1); transition: 0.3s; z-index: 999; padding: 20px 0; }
.sidebar-right.active { right: 0; }
.sidebar-menu { list-style: none; }
.sidebar-menu li { padding: 15px 25px; display: flex; align-items: center; gap: 15px; cursor: pointer; color: var(--text-color); transition: 0.2s; }
.sidebar-menu li:hover { background: var(--table-hover); color: var(--primary); }
.sidebar-menu li i { color: var(--primary); font-size: 18px; }
.sidebar-menu li.active-menu { background: var(--table-hover); color: var(--primary); border-left: 4px solid var(--primary); }

/* === PROFILE DROPDOWN === */
.profile-menu {
    position: relative;
    display: flex;
    align-items: center;
}
.profile-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 220px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    display: none; /* Disembunyikan secara default */
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    border: 1px solid #eee;
    animation: fadeIn 0.2s ease-in-out;
}
.profile-dropdown.active {
    display: flex; /* Muncul ketika class active ditambahkan */
}
.profile-header {
    background: var(--primary);
    padding: 20px 15px;
    color: #ffffff;
    text-align: left;
}
.profile-name {
    display: block;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}
.profile-role, .profile-wa {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
}
.dropdown-item {
    padding: 15px;
    text-decoration: none;
    color: var(--text-color); /* Beradaptasi dengan dark mode */
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-color); /* Beradaptasi dengan dark mode */
    transition: 0.3s;
}
.dropdown-item:hover {
    background: var(--table-hover);
    color: var(--primary);
}
.dropdown-item i {
    color: var(--primary);
}

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

/* Penyesuaian border untuk Dark Mode */
body.dark-mode .profile-dropdown {
    border-color: #333;
    box-shadow: 0 8px 20px rgba(255,255,255,0.05);
}

/* Cards */
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.card { background: var(--card-bg); padding: 20px; border-radius: 12px; border-left: 5px solid var(--primary); box-shadow: 0 4px 6px rgba(0,0,0,0.05); position: relative; }
.card h4 { color: #888; font-size: 14px; margin-bottom: 10px; }
.card h2 { font-size: 28px; color: var(--primary); }
.card span { font-size: 12px; color: #888; }
.card .icon-preview { position: absolute; bottom: 15px; right: 15px; background: var(--primary); color: white; width: 30px; height: 30px; display: flex; justify-content: center; align-items: center; border-radius: 50%; cursor: pointer; }

/* Tables */
.table-container { background: var(--card-bg); padding: 20px; border-radius: 12px; margin-bottom: 30px; overflow-x: auto; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
table th, table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #ddd; }
table th { color: var(--primary); font-weight: 600; }
table tr:hover { background-color: var(--table-hover); }
.action-btn { background: none; border: none; cursor: pointer; font-size: 16px; margin-right: 10px; }
.btn-edit { color: #4CAF50; }
.btn-delete { color: var(--primary); }