/* ── Hospital Quoting Tool Design System ── */
/* Based on MedQuote UI with burgundy/cream theme */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600&family=Source+Sans+3:wght@300;400;500;600&display=swap');

:root {
    /* Brand Colors */
    --primary: #722f37;
    --primary-dark: #5a252c;
    --primary-light: #8b3a44;
    --accent: #a23b48;

    /* Backgrounds */
    --cream: #faf8f7;
    --warm-white: #fffffe;
    --rose-tint: #fdf5f5;

    /* Text */
    --text-dark: #2d1f21;
    --text-muted: #6b5a5c;
    --text-light: #9a8b8d;

    /* Borders */
    --border: #e8dedd;
    --border-light: #f0eae9;

    /* Status Colors */
    --success: #38a169;
    --success-light: #c6f6d5;
    --success-bg: #f0fff4;
    --warning: #d69e2e;
    --warning-light: #fefcbf;
    --warning-bg: #fffff0;
    --danger: #e53e3e;
    --danger-light: #fed7d7;
    --danger-bg: #fff5f5;
    --info: #3182ce;
    --info-light: #bee3f8;
    --info-bg: #ebf8ff;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(114, 47, 55, 0.06);
    --shadow: 0 2px 8px rgba(114, 47, 55, 0.08);
    --shadow-md: 0 4px 16px rgba(114, 47, 55, 0.1);
    --shadow-lg: 0 8px 32px rgba(114, 47, 55, 0.12);

    /* Radii */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition: 0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Typography ── */
body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--cream);
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 15px;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

/* ── App Header ── */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(114, 47, 55, 0.2);
}

.app-header .logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: white;
}

.app-header .logo-area img {
    height: 36px;
    filter: brightness(0) invert(1);
}

.app-header .logo-area h1 {
    font-size: 1.25rem;
    font-family: 'Playfair Display', serif;
    margin: 0;
}

.app-header .logo-area .subtitle {
    font-size: 0.75rem;
    opacity: 0.8;
    font-family: 'Source Sans 3', sans-serif;
}

.app-header nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.app-header nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
}

.app-header nav a:hover,
.app-header nav a.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.app-header .user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.app-header .user-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.app-header .btn-logout {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition);
}

.app-header .btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ── Main Container ── */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ── Cards ── */
.card {
    background: var(--warm-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
    color: var(--primary);
    margin: 0;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(114, 47, 55, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(114, 47, 55, 0.35); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #2f855a; }

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

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

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-dark);
}
.btn-outline:hover { background: var(--rose-tint); border-color: var(--primary-light); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }

.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Form Controls ── */
label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--warm-white);
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.1);
}

input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { width: auto; }

.field { margin-bottom: 1rem; }

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.col { flex: 1; min-width: 200px; }

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0.625rem 0.75rem;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tr:hover td { background: var(--rose-tint); }

td input { padding: 0.25rem 0.5rem; font-size: 0.875rem; }
td input[type="number"] { width: 100px; text-align: right; }

tr.subtotal-row td { font-weight: 700; border-top: 2px solid var(--border); padding-top: 0.75rem; }
tr.vat-row td { color: var(--text-muted); font-style: italic; }

.text-right { text-align: right; }
.amount-cell { text-align: right; font-variant-numeric: tabular-nums; min-width: 100px; }

/* ── Status Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending { background: var(--warning-light); color: #744210; }
.badge-approved { background: var(--success-light); color: #22543d; }
.badge-rejected { background: var(--danger-light); color: #742a2a; }
.badge-draft { background: var(--info-light); color: #2a4365; }

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 280px;
}

.toast-success { background: var(--success-bg); color: #22543d; border-left: 4px solid var(--success); }
.toast-error { background: var(--danger-bg); color: #742a2a; border-left: 4px solid var(--danger); }
.toast-info { background: var(--info-bg); color: #2a4365; border-left: 4px solid var(--info); }

@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(100%); } }

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 31, 33, 0.5);
    z-index: 5000;
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    overflow-y: auto;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--warm-white);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
    margin: auto;
}

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

.modal-header h3 { color: var(--primary); margin: 0; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0.25rem;
}
.modal-close:hover { color: var(--danger); }

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 0.5rem; }

@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ── Utilities ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.fw-bold { font-weight: 600; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .app-header { padding: 0 1rem; height: 56px; }
    .app-header .logo-area h1 { font-size: 1rem; }
    .app-header .logo-area .subtitle { display: none; }
    .app-header nav a { padding: 0.375rem 0.5rem; font-size: 0.8125rem; }
    .app-container { padding: 1rem; }
    .row { flex-direction: column; }
}
