/* 
=============================================
SaaS CLINICAL SYSTEM - BIG TECH UI
============================================= 
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* SaaS Premium Palette - Ultra Clean Light Mode */
    --primary-color: #0f172a; /* Slate 900 (Dark) */
    --primary-light: #334155; /* Slate 700 */
    --accent-color: #2563eb; /* Blue 600 (Main Action) */
    --accent-hover: #1d4ed8; /* Blue 700 */
    --success-color: #10b981; /* Emerald 500 */
    --danger-color: #ef4444; /* Red 500 */
    --warning-color: #f59e0b; /* Amber 500 */
    --purple-color: #8b5cf6; /* Violet 500 */
    
    /* Backgrounds & Surfaces */
    --bg-color: #f8fafc; /* Slate 50 (Very light gray, almost white) */
    --sidebar-bg: #ffffff; /* Light Sidebar for Ultra-Clean */
    --sidebar-text: #334155;
    --sidebar-text-muted: #64748b;
    --sidebar-hover: #f1f5f9;
    --surface-solid: #ffffff; /* Card backgrounds */
    
    /* Text Colors */
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    /* Borders & Geometry */
    --border-color: #e2e8f0; /* Slate 200 */
    --border-light: #f1f5f9; /* Slate 100 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 9999px;
    
    /* Shadows - Ultra Soft */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 8px 16px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.02);
    --shadow-lg: 0 16px 32px rgba(0,0,0,0.06), 0 4px 8px rgba(0,0,0,0.03);
    
    /* Transitions */
    --transition: all 0.2s ease-in-out;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* APP LAYOUT (Sidebar + Main) */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    max-height: 60px;
    object-fit: contain;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Scrollbar Sidebar */
.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--sidebar-text-muted);
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--sidebar-text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-link i {
    width: 20px;
    height: 20px;
    stroke-width: 2.5px;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.nav-link.active {
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--sidebar-text-muted);
}

.logout-btn {
    color: var(--sidebar-text-muted);
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: 280px; /* Same as sidebar width */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.topbar {
    height: 64px;
    background: var(--surface-solid);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.topbar-right {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.content-wrapper {
    padding: 2rem;
    flex: 1;
    width: 100%;
    margin: 0;
}

/* Cards (Modern Flat UI) */
.card {
    background: var(--surface-solid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.card-header h2, .card-header h3 {
    margin: 0;
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Forms Elements */
.form-constrained {
    max-width: 800px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    background-color: #fafafa;
    transition: var(--transition);
    color: var(--text-main);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--surface-solid);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 0.2px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background-color: var(--border-light);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.15);
}
.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background: var(--bg-color);
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

/* Grids */
.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-col {
    flex: 1;
    min-width: 200px;
}

/* Tables Modern */
.table-responsive {
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}
.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    font-size: 0.95rem;
}
.table tbody tr {
    transition: var(--transition);
}
.table tbody tr:hover td {
    background-color: rgba(0,0,0,0.01);
}

/* Dashboard Badges/Tags */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning-color); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }
.badge-info { background: rgba(37, 99, 235, 0.1); color: var(--accent-color); }

/* Alerts */
.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 0.95rem;
}
.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* System Footer */
.system-footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}
.system-footer img {
    height: 30px;
    opacity: 0.5;
    transition: var(--transition);
    filter: grayscale(100%);
    margin-top: 8px;
}
.system-footer img:hover {
    opacity: 1;
    filter: grayscale(0%);
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0,0,0,0.5);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-menu-btn {
        display: block;
    }
    .content-wrapper {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    .form-col-2, .form-col {
        flex: none;
        width: 100%;
    }
    .card {
        padding: 1.25rem;
    }
    .page-header-modern {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 1.25rem;
    }
    .page-actions-modern {
        width: 100%;
        justify-content: flex-start;
    }
    .table-modern th, .table-modern td {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 1rem;
    }
    .card {
        padding: 1rem;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    .btn-sm {
        width: auto;
    }
    .page-title-modern {
        font-size: 1.25rem;
    }
}

/* UI Modernization Classes */
.page-header-modern {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 24px;
    background: var(--surface-solid);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.page-title-modern {
    margin: 0;
    color: var(--text-main);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title-modern svg {
    color: var(--accent-color);
}

.page-desc-modern {
    margin: 8px 0 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.page-actions-modern {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.table-modern-wrapper {
    background: var(--surface-solid);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 30px;
}

.table-modern {
    width: 100%;
    border-collapse: collapse;
}

.table-modern th {
    background: #f8fafc;
    padding: 16px 24px;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}

.table-modern td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    font-size: 0.95rem;
    vertical-align: middle;
}

.table-modern tr:last-child td {
    border-bottom: none;
}

.table-modern tr:hover td {
    background: rgba(248, 250, 252, 0.5);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-primary { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
.badge-success { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-gray { background: rgba(100, 116, 139, 0.1); color: #475569; }

/* Timeline UI */
.timeline {
    position: relative;
    padding-left: 30px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-light);
}
.timeline-item {
    position: relative;
    margin-bottom: 30px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -35px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 3px solid var(--surface-solid);
    box-shadow: 0 0 0 2px var(--border-light);
}
.timeline-card {
    background: var(--surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
