/* ============================================================
   DASHBOARD.CSS – SISMUT-RS / SPM-KP RSUD Sehat Sejahtera
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-bg:     #0f172a;
    --sidebar-active: #1e293b;
    --sidebar-hover:  #1e293b80;
    --sidebar-text:   #94a3b8;
    --sidebar-white:  #f8fafc;
    
    --primary:        #0284c7;
    --primary-hover:  #0369a1;
    --primary-light:  #e0f2fe;
    
    --bg-main:        #f1f5f9;
    --card-bg:        #ffffff;
    --border-color:   #e2e8f0;
    
    --text-dark:      #0f172a;
    --text-muted:     #64748b;
    --text-light:     #94a3b8;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.03);
    --shadow-dropdown: 0 10px 30px rgba(15, 23, 42, 0.15);
    --trans: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR & COLLAPSED STATE
   ============================================================ */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 20px 14px;
    color: var(--sidebar-text);
    transition: width var(--trans), padding var(--trans);
    z-index: 100;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Brand logo */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
    overflow: hidden;
}

.brand-icon-box {
    width: 40px;
    height: 40px;
    background: #0284c7;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    color: #ffffff;
    flex-shrink: 0;
}

.brand-info {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
}

.brand-title {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.03em;
}

.brand-sub {
    font-size: 11px;
    color: #38bdf8;
    font-weight: 500;
}

/* Navigation menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-header {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #475569;
    padding: 16px 12px 6px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--trans);
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #f1f5f9;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: #ffffff;
    font-weight: 600;
}

.nav-item.active svg {
    color: #38bdf8;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Sidebar footer box */
.sidebar-footer-card {
    background: var(--sidebar-active);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #33415550;
    overflow: hidden;
    white-space: nowrap;
}

.footer-card-icon {
    width: 34px;
    height: 34px;
    background: #0284c720;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    color: #38bdf8;
    flex-shrink: 0;
}

.footer-card-text strong {
    display: block;
    font-size: 12.5px;
    color: #f8fafc;
    font-weight: 600;
}

.footer-card-text span {
    font-size: 11px;
    color: #64748b;
}

/* --- SIDEBAR COLLAPSED CLASS --- */
.sidebar.collapsed {
    width: 72px;
    padding: 20px 8px;
}

.sidebar.collapsed .brand-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-header,
.sidebar.collapsed .footer-card-text {
    display: none !important;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 4px 0;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.collapsed .sidebar-footer-card {
    justify-content: center;
    padding: 8px;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

/* Top Navbar */
.top-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Hamburger button */
.btn-hamburger {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: var(--text-dark);
    cursor: pointer;
    transition: background var(--trans), border-color var(--trans);
}

.btn-hamburger:hover {
    background: var(--bg-main);
    border-color: var(--text-light);
}

.header-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Header Date picker Widget */
.header-date {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-main);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: border-color var(--trans);
}

.header-date:hover {
    border-color: var(--primary);
}

.header-date svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    flex-shrink: 0;
    color: var(--text-muted);
}

.date-input {
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    width: 135px;
}

/* ============================================================
   USER PROFILE DROPDOWN
   ============================================================ */
.user-profile-wrapper {
    position: relative;
}

.user-profile-btn {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: background var(--trans);
    text-align: left;
}

.user-profile-btn:hover {
    background: var(--bg-main);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
}

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

.user-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-dark);
}

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

.dropdown-chevron {
    color: var(--text-muted);
    transition: transform var(--trans);
}

.user-profile-btn[aria-expanded="true"] .dropdown-chevron {
    transform: rotate(180deg);
}

/* Dropdown Menu Floating Box */
.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    padding: 8px 0;
    display: none;
    flex-direction: column;
    z-index: 200;
}

.profile-dropdown-menu.show {
    display: flex;
}

.dropdown-header {
    padding: 10px 16px;
}

.dp-user-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-dark);
}

.dp-user-email {
    font-size: 11.5px;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    text-decoration: none;
    transition: background var(--trans), color var(--trans);
}

.dropdown-item:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.dropdown-item.item-logout {
    color: #ef4444;
}

.dropdown-item.item-logout:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ============================================================
   PAGE BODY & BANNER & CARDS
   ============================================================ */
.page-body {
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.welcome-banner {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border-radius: var(--radius-md);
    padding: 28px 32px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.2);
}

.banner-text {
    max-width: 680px;
}

.banner-text h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.banner-text p {
    font-size: 13.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.88);
}

.banner-badge-box {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    text-align: center;
    min-width: 130px;
}

.badge-num {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    color: #ffffff;
}

.badge-label {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 4px;
    display: block;
    font-weight: 500;
}

/* Modules Grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.module-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-card);
    transition: transform var(--trans), box-shadow var(--trans);
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-icon-svg {
    color: var(--primary);
    display: flex;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

/* Badges */
.status-badge {
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.badge-blue {
    background: #e0f2fe;
    color: #0284c7;
}

.badge-red {
    background: #fee2e2;
    color: #ef4444;
}

.badge-orange {
    background: #ffedd5;
    color: #f97316;
}

.badge-green {
    background: #dcfce7;
    color: #16a34a;
}

.card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
}

.card-footer-row {
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-info {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.card-action {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--trans);
}

.card-action:hover {
    color: var(--primary-hover);
}

.card-action svg {
    transition: transform var(--trans);
}

.card-action:hover svg {
    transform: translateX(3px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
    .sidebar.collapsed {
        display: none;
    }
    .modules-grid {
        grid-template-columns: 1fr;
    }
    .welcome-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .banner-badge-box {
        width: 100%;
    }
}
