/* ClinicalMatch.ai - Design System Styles */

/* ========================================
   CSS Variables / Design Tokens
   ======================================== */
:root {
    /* Colors */
    --color-primary: #0057B8;
    --color-primary-dark: #004494;
    --color-navy: #1A2B4A;
    --color-teal: #0891B2;
    --color-sky: #E0F2FE;
    --color-sky-dark: #BAE6FD;
    --color-warm-gray: #64748B;
    --color-light-gray: #F1F5F9;
    --color-success: #059669;
    --color-amber: #D97706;
    --color-error: #DC2626;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;
    --space-16: 64px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-nav: 0 1px 3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ========================================
   Base Styles
   ======================================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Focus Styles (Accessibility)
   ======================================== */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   Typography
   ======================================== */
.font-mono {
    font-family: var(--font-mono);
}

/* Line clamp utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========================================
   Buttons
   ======================================== */
button,
[role="button"] {
    cursor: pointer;
    user-select: none;
}

button:disabled {
    cursor: not-allowed;
}

/* Button press effect */
button:active:not(:disabled) {
    transform: scale(0.98);
}

/* ========================================
   Form Inputs
   ======================================== */
input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
    font-family: inherit;
    font-size: 16px; /* Prevents iOS zoom */
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
}

/* ========================================
   Mutation Chips
   ======================================== */
.mutation-chip {
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-base);
}

.mutation-chip:hover {
    transform: translateY(-1px);
}

.mutation-chip:active {
    transform: translateY(0) scale(0.98);
}

/* Chip selection animation */
@keyframes chipSelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.mutation-chip.selected {
    animation: chipSelect 200ms ease;
}

/* ========================================
   Trial Cards
   ======================================== */
.trial-card {
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

/* Card entrance animation */
@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.trial-card {
    animation: cardFadeIn 300ms ease forwards;
}

/* ========================================
   Eligibility Toggle
   ======================================== */
.eligibility-toggle svg {
    transition: transform var(--transition-base);
}

.eligibility-toggle svg.rotate-180 {
    transform: rotate(180deg);
}

/* ========================================
   Hero Animations
   ======================================== */
@keyframes float-slow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes float-delayed {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(-5deg); }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-float-slow {
    animation: float-slow 6s ease-in-out infinite;
}

.animate-float-delayed {
    animation: float-delayed 7s ease-in-out infinite;
    animation-delay: 1s;
}

.animate-fade-in-up {
    animation: fade-in-up 0.6s ease-out forwards;
}

.animation-delay-100 { animation-delay: 100ms; }
.animation-delay-200 { animation-delay: 200ms; }
.animation-delay-300 { animation-delay: 300ms; }
.animation-delay-400 { animation-delay: 400ms; }

/* ========================================
   Match Score Ring
   ======================================== */
@keyframes score-fill {
    from { stroke-dashoffset: 283; }
}

.match-score-ring {
    transform: rotate(-90deg);
    transform-origin: center;
}

.match-score-ring circle.progress {
    animation: score-fill 1s ease-out forwards;
}

/* ========================================
   Closing Soon Badge
   ======================================== */
@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.badge-closing-soon {
    animation: pulse-urgent 2s ease-in-out infinite;
}

/* ========================================
   Loading Spinner
   ======================================== */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ========================================
   Scrollbar Hide (for carousel)
   ======================================== */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ========================================
   FAQ Accordion
   ======================================== */
.faq-toggle svg {
    transition: transform var(--transition-base);
}

.faq-toggle svg.rotate-180 {
    transform: rotate(180deg);
}

.faq-content {
    animation: fadeIn 200ms ease;
}

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

/* ========================================
   Navigation
   ======================================== */
#main-nav.scrolled {
    box-shadow: var(--shadow-nav);
}

/* Mobile menu animation */
#mobile-menu {
    animation: slideDown 200ms ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Custom Scrollbar
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-light-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* ========================================
   Progress Indicator
   ======================================== */
.progress-connector {
    transition: width var(--transition-slow);
}

/* ========================================
   Modal
   ======================================== */
#dontKnowModal {
    backdrop-filter: blur(4px);
}

#dontKnowModal > div {
    animation: modalSlideIn 200ms ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 640px) {
    .mutation-chip {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .cancer-type-btn {
        padding: 0.75rem;
    }
}

/* ========================================
   Reduced Motion Support
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    .trial-card:hover {
        transform: none;
    }

    .mutation-chip:hover {
        transform: none;
    }
}

/* ========================================
   High Contrast Mode Support
   ======================================== */
@media (prefers-contrast: high) {
    .mutation-chip,
    .cancer-type-btn {
        border-width: 3px;
    }

    a {
        text-decoration: underline;
    }

    :focus-visible {
        outline-width: 3px;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    nav,
    footer,
    .no-print,
    #mobile-menu-btn {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    .trial-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
