/* ============================================================
   e-Counseling - BK Madrasah Matholi'ul Huda
   Modern Minimalist Green Theme
   ============================================================ */

:root {
    --primary: #166534;
    --primary-dark: #14532d;
    --primary-light: #22c55e;
    --primary-lighter: #4ade80;
    --primary-soft: #86efac;
    --primary-bg: #f0fdf4;
    --sidebar-width: 250px;
    --topbar-height: 60px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--primary-bg);
    color: #1f2937;
    overflow-x: hidden;
}

/* --- Topbar --- */
.topbar {
    height: var(--topbar-height);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary)) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1040;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    z-index: 1050;
    overflow-y: auto;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    min-height: var(--topbar-height);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h6 {
    color: #fff;
    font-size: 0.95rem;
}

.sidebar-menu {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-menu .nav-link {
    color: rgba(255,255,255,0.75);
    padding: 0.7rem 1.2rem;
    font-size: 0.88rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-menu .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--primary-lighter);
}

.sidebar-menu .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-left-color: var(--primary-lighter);
    font-weight: 500;
}

.sidebar-menu .nav-section span {
    display: block;
    padding: 0.8rem 1.2rem 0.3rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 0.8rem;
}

/* --- Sidebar Overlay (mobile) --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1045;
}

.sidebar-overlay.show {
    display: block;
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 1.5rem;
    min-height: calc(100vh - var(--topbar-height) - 50px);
    transition: margin-left 0.3s ease;
}

.ta-info {
    background: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-left: 3px solid var(--primary);
}

/* --- Cards --- */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* --- Stat Cards --- */
.stat-card {
    border-radius: 12px;
    padding: 1.25rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    font-size: 3rem;
    opacity: 0.25;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.bg-stat-green { background: linear-gradient(135deg, #166534, #22c55e); }
.bg-stat-blue  { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.bg-stat-amber { background: linear-gradient(135deg, #92400e, #f59e0b); }
.bg-stat-rose  { background: linear-gradient(135deg, #9f1239, #f43f5e); }
.bg-stat-teal  { background: linear-gradient(135deg, #115e59, #14b8a6); }
.bg-stat-purple{ background: linear-gradient(135deg, #581c87, #a855f7); }

/* --- Tables --- */
.table-responsive {
    border-radius: 8px;
}

.table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    border-bottom-width: 1px;
}

.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* --- Buttons --- */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.45rem 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-success {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
}

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

/* --- Forms --- */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #d1d5db;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: #374151;
    margin-bottom: 0.3rem;
}

/* --- Footer --- */
.footer {
    margin-left: var(--sidebar-width);
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 0.8rem 1.5rem;
    transition: margin-left 0.3s ease;
}

/* --- Alert --- */
.alert {
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
}

.alert i {
    margin-right: 6px;
}

/* --- Badge --- */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* --- Modal --- */
.modal-content {
    border: none;
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* --- Pagination --- */
.pagination .page-link {
    border: none;
    border-radius: 8px !important;
    margin: 0 2px;
    color: var(--primary);
    font-weight: 500;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
}

/* --- Sidebar collapsed (desktop) --- */
.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.sidebar-collapsed .main-content,
.sidebar-collapsed .footer {
    margin-left: 0;
}

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #14532d 0%, #166534 50%, #22c55e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .card-body {
    padding: 2.5rem 2rem;
}

.login-logo {
    width: 70px;
    height: 70px;
}

/* --- Print --- */
@media print {
    .sidebar, .topbar, .footer, .btn, form, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; margin-top: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content,
    .footer {
        margin-left: 0;
    }

    .sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .login-card .card-body {
        padding: 1.5rem 1rem;
    }
}
