﻿/* ========== AI Medical Scribe Plus - Global Styles ========== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #334155;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --card-radius: 12px;
    --transition: all 0.2s ease;
}

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

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app {
    min-height: 100vh;
}

/* ========== Layout ========== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 16px 12px;
    text-align: center;
    border-bottom: 1px solid #334155;
}

.sidebar-user {
    padding: 12px 16px;
    border-bottom: 1px solid #334155;
}

.sidebar-menu {
    flex: 1;
    padding: 8px 0;
}

.sidebar-menu-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-menu-item:hover {
    background: var(--sidebar-hover);
}

.sidebar-menu-item.active {
    background: var(--sidebar-hover);
    border-left-color: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #334155;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    max-width: calc(100vw - 240px);
}

/* ========== Buttons ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

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

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ========== Cards ========== */

.patient-card {
    background: white;
    border-radius: var(--card-radius);
    padding: 14px 16px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    margin-bottom: 8px;
}

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

/* ========== Vital Cards ========== */

.vital-card {
    background: white;
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 120px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
}

.vital-label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.vital-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.vital-sub {
    font-size: 0.75rem;
    color: #888;
}

/* ========== Info Grid ========== */

.info-row {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.85rem;
}

.info-label {
    width: 120px;
    color: #888;
    font-weight: 600;
    flex-shrink: 0;
}

.info-value {
    flex: 1;
    color: var(--gray-900);
}

/* ========== Stats Chips ========== */

.stat-chip {
    display: inline-block;
    padding: 4px 12px;
    background: white;
    border-radius: 20px;
    font-size: 0.8rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid var(--gray-200);
}

/* ========== Forms ========== */

input, select, textarea {
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--gray-700);
}

/* ========== Toast ========== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

#toast-container > div {
    pointer-events: all;
}

/* ========== Scrollbar ========== */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ========== Print Styles ========== */

@media print {
    .sidebar, .sidebar-header, .sidebar-user, .sidebar-menu, .sidebar-footer,
    .btn, button, nav, .no-print {
        display: none !important;
    }

    .app-layout {
        display: block;
    }

    .main-content {
        max-width: 100%;
        padding: 0;
    }

    body {
        background: white;
        color: black;
        font-size: 11pt;
    }

    .patient-card, [style*="background:white"], [style*="background: white"] {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
}

/* ========== Responsive ========== */

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        min-width: 60px;
    }

    .sidebar-header div:not(:first-child),
    .sidebar-user div,
    .sidebar-menu-item span:last-child,
    .sidebar-footer label,
    .sidebar-footer select,
    .sidebar-footer div:first-child {
        display: none;
    }

    .sidebar-menu-item {
        justify-content: center;
        padding: 12px;
    }

    .main-content {
        max-width: calc(100vw - 60px);
    }

    .sidebar-footer {
        padding: 8px;
    }

    [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    [style*="grid-template-columns:1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .vital-card {
        min-width: 80px;
    }
}

/* ========== Loading ========== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.patient-card, .vital-card, .btn, .stat-chip {
    animation: fadeIn 0.3s ease-out;
}
