/* Patel Hospital CRM - Custom Styles */
/* Healthcare Blue Gradient Theme with Dark Mode Support */

:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --primary-darker: #084298;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --mobile-nav-height: 60px;
    --glass-bg: rgba(255,255,255,0.7);
    --glass-border: rgba(255,255,255,0.18);
}

[data-bs-theme="dark"] {
    --glass-bg: rgba(30,35,45,0.7);
    --glass-border: rgba(255,255,255,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f4f6fb;
    overflow-x: hidden;
}
[data-bs-theme="dark"] body { background: #0f1419; }

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0d6efd 0%, #084298 100%);
    color: white;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-header > a > div:last-child,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-footer .btn { display: none !important; }
.sidebar.collapsed .sidebar-item { justify-content: center; padding: 0.85rem; }
.sidebar.collapsed .sidebar-item i { margin: 0; font-size: 1.25rem; }
.sidebar.collapsed .user-card { justify-content: center; }

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo-icon {
    width: 40px; height: 40px;
    background: white;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.3rem;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.5rem;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.9rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 2px;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}
.sidebar-item i { font-size: 1.15rem; margin-right: 0.75rem; }
.sidebar-item:hover { background: rgba(255,255,255,0.12); color: white; }
.sidebar-item.active {
    background: rgba(255,255,255,0.2);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.user-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role { font-size: 0.7rem; opacity: 0.75; }

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }
.main-content.no-sidebar { margin-left: 0; }

.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1020;
}
[data-bs-theme="dark"] .topbar { background: #1a1f26; border-color: #2a2f36; }

.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

.main-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    background: white;
}
[data-bs-theme="dark"] .main-footer { background: #1a1f26; border-color: #2a2f36; }

/* Buttons */
.btn-icon {
    width: 40px; height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    position: relative;
}
.badge-dot {
    position: absolute;
    top: 6px; right: 6px;
    padding: 2px 5px;
    font-size: 0.65rem;
    border-radius: 10px;
}

/* Glass Cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}
.glass-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,0.08); }
.glass-card .card-header { border-bottom: 1px solid rgba(0,0,0,0.05); padding: 1rem 1.25rem; }
.glass-card .card-body { padding: 1.25rem; }

/* KPI Cards */
.kpi-card .card-body { padding: 1.25rem; }
.kpi-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.kpi-card h3 { font-size: 1.5rem; }

/* Gradient helpers */
.bg-gradient-primary {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

/* Avatar */
.avatar-sm { width: 36px; height: 36px; font-size: 0.85rem; }
.avatar-md { width: 48px; height: 48px; font-size: 1rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }

/* Tables */
.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    font-weight: 600;
    border-bottom-width: 1px;
}

/* Form controls */
.form-control, .form-select {
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.15);
}
.form-floating > label { padding: 0.85rem 0.9rem; }

/* Notifications dropdown */
.notification-dropdown {
    width: 340px;
    max-height: 400px;
    overflow-y: auto;
}

/* Mobile */
.fixed-top-mobile { z-index: 1030; }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0 !important; padding-bottom: calc(var(--mobile-nav-height) + 1rem); }
    .content-wrapper { padding: 1rem; }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
        display: none;
    }
    .sidebar-overlay.show { display: block; }
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--mobile-nav-height);
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1030;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}
[data-bs-theme="dark"] .mobile-bottom-nav { background: #1a1f26; border-color: #2a2f36; }
.mob-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}
.mob-nav-item i { font-size: 1.3rem; }
.mob-nav-item.active { color: var(--primary); }

/* Kanban */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}
.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 0.75rem;
}
[data-bs-theme="dark"] .kanban-column { background: #1a1f26; }
.kanban-column h6 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}
.kanban-card {
    background: white;
    border-radius: 10px;
    padding: 0.85rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
    cursor: grab;
    transition: box-shadow 0.2s;
}
[data-bs-theme="dark"] .kanban-card { background: #22272e; border-color: #2a2f36; }
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* Print Receipt */
@media print {
    body * { visibility: hidden; }
    .print-area, .print-area * { visibility: visible; }
    .print-area { position: absolute; left: 0; top: 0; width: 100%; }
    .no-print { display: none !important; }
    .sidebar, .topbar, .mobile-bottom-nav, .main-footer { display: none !important; }
    .main-content { margin-left: 0 !important; }
}
.receipt-paper {
    max-width: 210mm;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.receipt-header {
    text-align: center;
    border-bottom: 3px double #0d6efd;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.receipt-header h2 { color: #0d6efd; margin: 0.5rem 0; }

/* Tabs */
.nav-tabs .nav-link {
    border-radius: 10px 10px 0 0;
    font-weight: 500;
    color: #6c757d;
}
.nav-tabs .nav-link.active {
    color: var(--primary);
    font-weight: 600;
}

/* Stats badge colors */
.stat-pill { padding: 0.35rem 0.75rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in-up { animation: fadeInUp 0.3s ease-out; }

/* DataTables tweaks */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
}
.dataTables_wrapper .dataTables_length select {
    border-radius: 8px;
}

/* Select2 */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: 10px !important;
    min-height: 42px;
}

/* Page header with actions */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}
.empty-state i { font-size: 3rem; opacity: 0.5; }

/* Report cards */
.report-card {
    transition: transform 0.2s;
    cursor: pointer;
}
.report-card:hover { transform: translateY(-4px); }

/* Scrollable */
.scroll-x { overflow-x: auto; }

/* Responsive table card */
@media (max-width: 575.98px) {
    .kpi-card h3 { font-size: 1.2rem; }
    .kpi-icon { width: 40px; height: 40px; font-size: 1.2rem; }
    .glass-card { border-radius: 12px; }
}

/* Urdu font support */
.urdu { font-family: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif; direction: rtl; }
