/* ================================================================
   ADAGS Hospital Admin — Custom CSS
   Theme: White (#ffffff) + Green (#2e7d32 / #4caf50)
   ================================================================ */

/* ---------- CSS Variables ---------- */
:root {
    --primary:       #2e7d32;
    --primary-light: #4caf50;
    --primary-pale:  #e8f5e9;
    --sidebar-w:     250px;
    --sidebar-bg:    #1b5e20;
    --topbar-h:      60px;
    --radius:        8px;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: #f4f7f4;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #212121;
    margin: 0;
}

/* ---------- Layout Wrapper ---------- */
#wrapper {
    min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
#sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
}

.sidebar-header small {
    color: rgba(255,255,255,0.6);
    font-size: 0.75rem;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: all 0.18s;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-left-color: var(--primary-light);
}

.sidebar-nav li.active a {
    background: rgba(76,175,80,0.2);
    color: #fff;
    border-left-color: var(--primary-light);
    font-weight: 600;
}

.sidebar-nav .nav-section {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    padding: 16px 20px 4px;
    text-transform: uppercase;
}

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

.sidebar-user-info {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- EXPENSE SIDEBAR SUBMENU ---------- */
.sidebar-submenu {
    padding: 0;
    margin: 0;
    background: rgba(0,0,0,0.18);
}

.sidebar-submenu li a {
    display: flex;
    align-items: center;
    padding: 7px 20px 7px 42px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.82rem;
    border-left: 3px solid transparent;
    transition: all 0.18s;
}

.sidebar-submenu li a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-left-color: var(--primary-light);
}

.sidebar-submenu li.active a {
    background: rgba(76,175,80,0.2);
    color: #fff;
    border-left-color: var(--primary-light);
    font-weight: 600;
}

.submenu-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.25s;
}

.sidebar-nav li.submenu-parent.open > a > .submenu-chevron {
    transform: rotate(180deg);
}

#wrapper.sidebar-collapsed .sidebar-submenu {
    display: none !important;
}

#wrapper.sidebar-collapsed .submenu-chevron {
    display: none;
}

/* Collapsed sidebar */
#wrapper.sidebar-collapsed #sidebar {
    width: 64px;
}
#wrapper.sidebar-collapsed .sidebar-logo span,
#wrapper.sidebar-collapsed .sidebar-header small,
#wrapper.sidebar-collapsed .sidebar-nav li a span,
#wrapper.sidebar-collapsed .nav-section,
#wrapper.sidebar-collapsed .sidebar-user-info span,
#wrapper.sidebar-collapsed .sidebar-footer form {
    display: none;
}
#wrapper.sidebar-collapsed #sidebar .sidebar-nav li a {
    justify-content: center;
    padding: 10px;
}

/* ---------- PAGE CONTENT ---------- */
#page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ---------- TOP BAR ---------- */
.top-bar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.top-bar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #212121;
}

.top-bar-user {
    font-size: 0.85rem;
    color: #555;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
    padding: 24px;
    flex: 1;
}

/* ---------- STAT CARDS ---------- */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    border-left: 4px solid transparent;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-card__icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.stat-card__value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}
.stat-card__label {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

/* Type variants */
.stat-card--green  { border-left-color: #2e7d32; }
.stat-card--green  .stat-card__icon { background: #e8f5e9; color: #2e7d32; }
.stat-card--green  .stat-card__value { color: #2e7d32; }

.stat-card--teal   { border-left-color: #00796b; }
.stat-card--teal   .stat-card__icon { background: #e0f2f1; color: #00796b; }
.stat-card--teal   .stat-card__value { color: #00796b; }

.stat-card--blue   { border-left-color: #1565c0; }
.stat-card--blue   .stat-card__icon { background: #e3f2fd; color: #1565c0; }
.stat-card--blue   .stat-card__value { color: #1565c0; }

.stat-card--orange { border-left-color: #e65100; }
.stat-card--orange .stat-card__icon { background: #fff3e0; color: #e65100; }
.stat-card--orange .stat-card__value { color: #e65100; }

.stat-card--red    { border-left-color: #c62828; }
.stat-card--red    .stat-card__icon { background: #ffebee; color: #c62828; }
.stat-card--red    .stat-card__value { color: #c62828; }

/* ---------- CARDS ---------- */
.card { border-radius: var(--radius) !important; }
.card-header {
    border-radius: var(--radius) var(--radius) 0 0 !important;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 14px 20px;
}

/* ---------- TABLE ---------- */
.table thead th {
    background: var(--primary-pale);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-color: #dcedc8;
    white-space: nowrap;
    padding: 10px 16px;
}
.table tbody td { padding: 10px 16px; vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--primary-pale); }

/* ---------- BUTTONS ---------- */
.btn-primary,
.btn-success {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover,
.btn-success:hover {
    background: #1b5e20;
    border-color: #1b5e20;
}
.btn-outline-success {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-success:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* ---------- BADGES ---------- */
.badge.bg-success { background-color: var(--primary) !important; }

/* ---------- FORM CONTROLS ---------- */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(76,175,80,0.25);
}
.input-group-text {
    background: var(--primary-pale);
    border-color: #ced4da;
    color: var(--primary);
}

/* ---------- MODAL ---------- */
.modal-header {
    border-bottom: 1px solid #e8f5e9;
    background: var(--primary-pale);
}
.modal-footer { border-top: 1px solid #e8f5e9; }

/* ---------- ALERTS ---------- */
.alert-success {
    background: var(--primary-pale);
    border-color: #a5d6a7;
    color: #1b5e20;
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-body {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 40%, #4caf50 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.login-card {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-icon {
    width: 72px;
    height: 72px;
    background: var(--primary-pale);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary);
    margin: 0 auto 12px;
}

.login-brand h2 {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.btn-login {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    padding: 10px;
    color: #fff;
}
.btn-login:hover {
    background: #1b5e20;
    border-color: #1b5e20;
    color: #fff;
}

.login-footer {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    #sidebar      { width: 64px; }
    .sidebar-logo span,
    .sidebar-header small,
    .nav-section,
    .sidebar-user-info span,
    .sidebar-footer form { display: none; }
    #sidebar .sidebar-nav li a { justify-content: center; padding: 10px; }
    .main-content { padding: 16px; }
}
