/* KambohCare-HMS Master UI Design System & Theme */

:root {
    --primary: #0f766e;
    --primary-hover: #0d9488;
    --primary-light: #ccfbf1;
    --secondary: #3b82f6;
    --accent: #8b5cf6;
    --dark: #0f172a;
    --dark-surface: #1e293b;
    --dark-border: #334155;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 25px rgba(15,118,110,0.12);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Fonts */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--light-bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Layout Shell */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--dark);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--dark-border);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    font-weight: 700;
}

.sidebar-brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #fff;
}

.sidebar-brand-text span {
    color: #2dd4bf;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0.75rem;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 0.75rem 0.75rem 0.35rem 0.75rem;
    font-weight: 700;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
}

.menu-item a:hover, .menu-item.active a {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.menu-item.active a {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
}

.menu-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* User Profile Widget in Sidebar */
.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d9488, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.user-details {
    flex-grow: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.user-role {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Main Content Area */
.main-wrapper {
    margin-left: 260px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Navbar */
.top-header {
    height: 68px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dept-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.logout-btn {
    background: #fee2e2;
    color: var(--danger);
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.logout-btn:hover {
    background: var(--danger);
    color: #fff;
}

/* Content Container */
.page-content {
    padding: 2rem;
    flex-grow: 1;
}

/* Cards & Statistics */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.primary { background: #ccfbf1; color: #0d9488; }
.stat-icon.secondary { background: #dbeafe; color: #2563eb; }
.stat-icon.warning { background: #fef3c7; color: #d97706; }
.stat-icon.danger { background: #fee2e2; color: #dc2626; }

.stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #cff4fc; color: #055160; }

/* Form Controls & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

/* Buttons */
.btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #64748b;
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
}
.btn-outline:hover {
    background: #f1f5f9;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-dialog {
    background: #fff;
    width: 90%;
    max-width: 650px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-backdrop.show .modal-dialog {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.5rem;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #f8fafc;
}
