/* Elevate MediLens Design System */
:root {
    /* Main Background & Surfaces */
    --background: hsl(210, 25%, 98%);
    --surface: hsl(0, 0%, 100%);
    --surface-variant: hsl(210, 15%, 96%);
    --foreground: hsl(215, 25%, 15%);

    /* Card System */
    --card: hsl(0, 0%, 100%);
    --card-foreground: hsl(215, 25%, 15%);
    --card-border: hsl(210, 15%, 90%);

    /* Primary Brand Colors - Trustworthy Blue */
    --primary: hsl(210, 85%, 58%);
    --primary-light: hsl(210, 90%, 68%);
    --primary-dark: hsl(210, 80%, 48%);
    --primary-foreground: hsl(0, 0%, 100%);
    --primary-muted: hsl(210, 40%, 95%);

    /* Secondary - Gentle Green for Highlights */
    --secondary: hsl(145, 65%, 55%);
    --secondary-light: hsl(145, 70%, 65%);
    --secondary-dark: hsl(145, 60%, 45%);
    --secondary-foreground: hsl(0, 0%, 100%);
    --secondary-muted: hsl(145, 30%, 95%);

    /* Alert System - Warm Red for Warnings */
    --alert: hsl(355, 85%, 62%);
    --alert-dark: hsl(355, 80%, 52%);
    --alert-foreground: hsl(355, 100%, 15%); /* Darker red text for high contrast */
    --alert-muted: hsl(355, 100%, 97%); /* Very light pink background */

    /* Success - Medical Green */
    --success: hsl(142, 71%, 45%);
    --success-light: hsl(142, 76%, 55%);
    --success-foreground: hsl(0, 0%, 100%);
    --success-muted: hsl(142, 30%, 95%);

    /* Warning - Amber for Cautions */
    --warning: hsl(35, 91%, 62%);
    --warning-light: hsl(35, 95%, 72%);
    --warning-foreground: hsl(215, 25%, 15%);
    --warning-muted: hsl(35, 50%, 95%);

    /* Text Hierarchy */
    --text-primary: hsl(215, 25%, 15%);
    --text-secondary: hsl(215, 15%, 35%);
    --text-muted: hsl(215, 10%, 55%);
    --text-inverse: hsl(0, 0%, 100%);

    /* Interactive Elements */
    --border: hsl(210, 15%, 88%);
    --border-hover: hsl(210, 25%, 78%);
    --input: hsl(210, 15%, 94%);
    --input-focus: hsl(210, 25%, 88%);
    --ring: hsl(210, 85%, 58%);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, hsl(210, 85%, 58%), hsl(145, 65%, 55%));
    --gradient-surface: linear-gradient(180deg, hsl(0, 0%, 100%), hsl(210, 15%, 98%));
    --gradient-hero: linear-gradient(135deg, hsl(210, 90%, 65%) 0%, hsl(145, 70%, 60%) 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px hsla(215, 25%, 15%, 0.05);
    --shadow-md: 0 4px 12px hsla(215, 25%, 15%, 0.08);
    --shadow-lg: 0 8px 24px hsla(215, 25%, 15%, 0.12);
    --shadow-xl: 0 16px 40px hsla(215, 25%, 15%, 0.15);
    --shadow-glow: 0 0 24px hsla(210, 85%, 58%, 0.3);

    /* Animations */
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    --radius: 12px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --background: hsl(215, 30%, 8%);
        --surface: hsl(215, 25%, 12%);
        --surface-variant: hsl(215, 20%, 15%);
        --foreground: hsl(210, 15%, 90%);
        --card: hsl(215, 25%, 12%);
        --card-foreground: hsl(210, 15%, 90%);
        --card-border: hsl(215, 20%, 20%);
        --primary: hsl(210, 85%, 68%);
        --primary-muted: hsl(210, 30%, 20%);
        --text-primary: hsl(210, 15%, 90%);
        --text-secondary: hsl(210, 10%, 70%);
        --text-muted: hsl(210, 8%, 50%);
        --border: hsl(215, 20%, 20%);
        --input: hsl(215, 20%, 18%);
        --alert-foreground: hsl(355, 90%, 85%); /* Light pink text for dark mode */
        --alert-muted: hsla(355, 85%, 62%, 0.15); /* Dark, translucent background */
    }
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', system-ui, sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
}

.font-heading {
    font-family: 'Montserrat', system-ui, sans-serif;
}

.font-body {
    font-family: 'Roboto', system-ui, sans-serif;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Hero Header */
.hero-header {
    background: var(--gradient-hero);
    color: var(--text-inverse);
    position: relative;
    overflow: hidden;
    padding: 3rem 0;
    text-align: center;
}

.hero-content {
    position: relative;
    z-index: 10;
}

.hero-title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem; /* Increased gap for better spacing */
    margin-bottom: 1.5rem;
    animation: fadeIn 0.6s ease-out;
}

.hero-icon {
    width: 5rem; /* Increased size to match font */
    height: 5rem; /* Increased size to match font */
    animation: pulseGlow 2s ease-in-out infinite;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 5rem); /* Slightly increased base font size */
    font-weight: 800;
    margin: 0;
}

.hero-subtitle {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 300;
    margin-bottom: 2rem;
    animation: fadeUp 0.8s ease-out;
}

.hero-description {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 42rem;
    margin: 0 auto 2rem; /* Added margin bottom */
    animation: fadeUp 1s ease-out;
}

/* Language Selector */
.language-selector-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.language-selector-container label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-inverse);
}

#language-select {
    background-color: hsla(0, 0%, 100%, 0.2);
    color: var(--text-inverse);
    border: 1px solid hsla(0, 0%, 100%, 0.5);
    border-radius: calc(var(--radius) - 4px);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

#language-select:hover {
    background-color: hsla(0, 0%, 100%, 0.3);
}

#language-select option {
    background-color: var(--surface);
    color: var(--text-primary);
}

/* Card System */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    background: var(--surface-variant);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-content {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: calc(var(--radius) - 2px);
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-dark);
    transform: scale(1.02);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
    background: var(--surface-variant);
    border-color: var(--border-hover);
}

.btn-destructive {
    background: var(--alert);
    color: var(--primary-foreground);
}

.btn-destructive:hover:not(:disabled) {
    background: var(--alert-dark);
    transform: scale(1.05);
}

.btn-gradient {
    background: var(--gradient-primary);
    color: var(--text-inverse);
}

.btn-gradient:hover:not(:disabled) {
    box-shadow: var(--shadow-glow);
    transform: scale(1.02);
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.input, .textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--input);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.input:focus, .textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px hsla(210, 85%, 58%, 0.2);
}

.textarea {
    resize: vertical;
    min-height: 100px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: var(--surface-variant);
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-muted);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Video Container */
.video-container {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    margin-bottom: 1rem;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Progress Bar */
.progress-container {
    background: var(--surface-variant);
    border-radius: 9999px;
    height: 0.5rem;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    background: var(--gradient-primary);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Tabs */
.tabs-list {
    display: flex;
    background: var(--surface-variant);
    border-radius: calc(var(--radius) - 2px);
    padding: 0.25rem;
    margin-bottom: 1.5rem;
}

.tab-trigger {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: calc(var(--radius) - 4px);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-trigger.active {
    background: var(--card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.badge-secondary {
    background: var(--secondary-muted);
    color: var(--secondary-dark);
}

/* Alert Cards */
.alert-card {
    border-left: 4px solid var(--warning);
    background: var(--warning-muted);
    padding: 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
}

.alert-danger {
    border-left-color: var(--alert);
    background: var(--alert-muted);
    color: var(--alert-foreground);
}

.alert-danger .card-title {
     color: var(--alert-dark);
}

.alert-danger .alert-card {
    background: hsla(355, 85%, 62%, 0.1);
}

/* YouTube Video Styles */
.youtube-video-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.video-card {
    background: var(--surface-variant);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    text-align: left;
    transition: var(--transition-smooth);
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.video-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 4px);
    margin-bottom: 1rem;
}

.video-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    line-height: 1.3;
}

.video-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    height: 50px; /* Fixed height for description */
    overflow: hidden;
}

.video-card a {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: calc(var(--radius) - 4px);
    font-weight: 500;
}

.video-card a:hover {
    background: var(--primary-dark);
}


/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 20px hsla(210, 85%, 58%, 0.4); }
    50% { box-shadow: 0 0 40px hsla(210, 85%, 58%, 0.6); }
}

.animate-fade-in { animation: fadeIn 0.6s ease-out; }
.animate-fade-up { animation: fadeUp 0.8s ease-out; }
.animate-scale-in { animation: scaleIn 0.4s ease-out; }
.animate-slide-in-right { animation: slideInRight 0.6s ease-out; }

/* Utility Classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-warning { color: var(--warning); }
.text-alert { color: var(--alert); }

.bg-primary { background: var(--primary-muted); }
.bg-secondary { background: var(--secondary-muted); }
.bg-surface { background: var(--surface); }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

.rounded-lg { border-radius: var(--radius); }
.border-t { border-top: 1px solid var(--border); }

/* Responsive */
@media (min-width: 768px) {
    .container { padding: 0 2rem; }
    .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .hero-title { font-size: 4rem; }
    .hero-subtitle { font-size: 1.5rem; }
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--card);
    color: var(--card-foreground);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    max-width: 400px;
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--alert);
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toast-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Star Rating */
.star-rating {
    display: flex;
    gap: 0.25rem;
}

.star {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.star.active {
    color: var(--warning);
}

.star:hover {
    transform: scale(1.1);
}

@media print {
    body * {
        visibility: hidden;
    }
    #report-container, #report-container * {
        visibility: visible;
    }
    #report-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
