/* =====================================================
   AKSARA - Stylesheet Utama
   ===================================================== */
:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #818cf8;
    --accent: #06b6d4;
    --bg-body: #f1f4f9;
    --bg-sidebar: #1e1b4b;
    --bg-sidebar-hover: #2d2a6e;
    --bg-card: #ffffff;
    --text-main: #1f2338;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --radius: 14px;
    --shadow-soft: 0 4px 20px rgba(31, 35, 56, 0.06);
    --shadow-card: 0 8px 30px rgba(31, 35, 56, 0.08);
    --sidebar-width: 280px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Poppins', 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ===================== LOGIN SPLIT PAGE ===================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
}

.login-brand {
    flex: 1.1;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 55%, var(--accent) 130%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 50px;
    position: relative;
    overflow: hidden;
}

.login-brand::before,
.login-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.login-brand::before { width: 340px; height: 340px; top: -120px; left: -100px; }
.login-brand::after { width: 260px; height: 260px; bottom: -80px; right: -60px; }

.login-brand .brand-icon {
    width: 92px;
    height: 92px;
    border-radius: 24px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    margin-bottom: 26px;
    backdrop-filter: blur(6px);
    z-index: 1;
}

.login-brand h1 {
    font-size: 2.1rem;
    font-weight: 700;
    margin: 0 0 6px;
    z-index: 1;
    text-align: center;
}

.login-brand p.tagline {
    opacity: 0.9;
    font-size: 1rem;
    margin-bottom: 30px;
    z-index: 1;
    text-align: center;
}

.login-brand .wilayah {
    z-index: 1;
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.9;
    background: rgba(255,255,255,0.12);
    padding: 16px 26px;
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 40px 30px;
}

.login-form-box {
    width: 100%;
    max-width: 380px;
}

.login-form-box h2 {
    font-weight: 700;
    margin-bottom: 4px;
}

.login-form-box p.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.form-control-modern {
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    width: 100%;
    font-size: 0.95rem;
    transition: 0.2s;
    background: #f9fafb;
}
.form-control-modern:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.input-group-modern { position: relative; margin-bottom: 18px; }
.input-group-modern label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}
.input-group-modern .toggle-pass {
    position: absolute;
    right: 14px;
    top: 40px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    user-select: none;
}

.btn-primary-modern {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    padding: 13px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.98rem;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}
.btn-primary-modern:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79, 70, 229, 0.32); }
.btn-primary-modern:active { transform: translateY(0); }

.alert-box {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 18px;
}
.alert-danger-box { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success-box { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-warning-box { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

@media (max-width: 860px) {
    .login-brand { display: none; }
    .login-form-side { flex: 1 1 100%; }
}

/* ===================== APP SHELL ===================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: #cfd2f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1000;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .logo-box {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: 1.1rem;
    flex-shrink: 0;
}
.sidebar-brand .brand-text .app-title { color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.sidebar-brand .brand-text .app-sub { font-size: 0.72rem; color: #9ca3e0; }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7c80b8;
    padding: 14px 12px 6px;
    font-weight: 600;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: #cfd2f0;
    font-size: 0.9rem;
    margin-bottom: 3px;
    cursor: pointer;
    transition: 0.15s;
}
.nav-link-item i { width: 18px; text-align: center; font-size: 0.95rem; }
.nav-link-item:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-link-item.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #cfd2f0;
    font-weight: 600;
}
.nav-dropdown-toggle:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-dropdown-toggle .chev { transition: transform 0.2s; font-size: 0.75rem; }
.nav-dropdown-toggle.open .chev { transform: rotate(180deg); }

.nav-dropdown-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    padding-left: 6px;
}
.nav-dropdown-body.open { max-height: 800px; }

.menu-item-icon {
    width: 26px; height: 26px;
    border-radius: 7px;
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}
.menu-item-icon-fallback {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

.topbar {
    height: 68px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar .page-title { font-weight: 700; font-size: 1.05rem; }
.topbar .page-title .sub { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; }

.burger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-main);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 10px;
}
.user-chip:hover { background: var(--bg-body); }
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}
.user-chip .u-name { font-size: 0.86rem; font-weight: 600; line-height: 1.1; }
.user-chip .u-role { font-size: 0.72rem; color: var(--text-muted); }

.content-area {
    flex: 1;
    padding: 22px;
}

.iframe-panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    height: calc(100vh - 68px - 44px);
    display: flex;
    flex-direction: column;
}
.iframe-panel .iframe-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #fafbff;
    font-size: 0.85rem;
}
.iframe-panel iframe {
    flex: 1;
    border: none;
    width: 100%;
}

.card-modern {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 22px;
    border: 1px solid var(--border-color);
}

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.menu-tile {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: 0.18s;
}
.menu-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); border-color: var(--primary-light); }
.menu-tile .tile-icon {
    width: 56px; height: 56px;
    border-radius: 14px;
    object-fit: cover;
    margin: 0 auto 12px;
    display: block;
    background: #f1f4f9;
}
.menu-tile .tile-icon-fallback {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 12px;
}
.menu-tile .tile-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 3px; }
.menu-tile .tile-desc { font-size: 0.75rem; color: var(--text-muted); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 14px;
}
.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}
.stat-card .stat-num { font-size: 1.35rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-muted); }

.table-modern { width: 100%; border-collapse: collapse; }
.table-modern th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 12px 14px;
    border-bottom: 2px solid var(--border-color);
}
.table-modern td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
    vertical-align: middle;
}
.table-modern tr:hover td { background: #fafbff; }

.badge-role { padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-superadmin { background: #eef2ff; color: var(--primary-dark); }
.badge-admin { background: #ecfeff; color: #0e7490; }
.badge-status-aktif { background: #f0fdf4; color: #15803d; padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-status-nonaktif { background: #fef2f2; color: #b91c1c; padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }

.btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    padding: 9px 16px;
    border-radius: 9px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    text-decoration: none;
}
.btn-modern-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-modern-primary:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-modern-outline { background: #fff; color: var(--text-main); border: 1.5px solid var(--border-color); }
.btn-modern-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-modern-danger { background: #fef2f2; color: #b91c1c; }
.btn-modern-danger:hover { background: #fee2e2; }
.btn-modern-sm { padding: 6px 12px; font-size: 0.78rem; }

.form-label-modern { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; display: block; }
.icon-preview-box {
    width: 90px; height: 90px;
    border-radius: 14px;
    border: 2px dashed var(--border-color);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    background: #f9fafb;
    margin-bottom: 10px;
}
.icon-preview-box img { width: 100%; height: 100%; object-fit: cover; }

.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(17,17,34,0.55);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: var(--radius);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 26px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-box h3 { margin-top: 0; font-weight: 700; }
.modal-close-x { float: right; cursor: pointer; font-size: 1.2rem; color: var(--text-muted); }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,0.3); }
    .main-content { margin-left: 0; width: 100%; }
    .burger-btn { display: block; }
    .sidebar-overlay.show { display: block; }
}
