/* MedScribes.AI - Design System */

/* Force light color scheme — prevents OS/browser dark mode from inverting colors */
html {
    color-scheme: light !important;
    font-size: 17px;
}

body {
    color: #0f172a !important;
    background-color: #f0f4f8 !important;
}

/* Logged area: keep readable contrast on desktop and mobile */
.app-shell .glass {
    background: rgba(255,255,255,.95) !important;
}

.app-shell .top-navbar,
.app-shell .top-navbar h1 {
    color: #0f172a !important;
}

.app-shell .top-navbar .top-navbar-muted {
    color: #475569 !important;
}

.app-shell .bg-white {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

.app-shell .bg-white .text-slate-900 { color: #0f172a !important; }
.app-shell .bg-white .text-slate-800 { color: #1e293b !important; }
.app-shell .bg-white .text-slate-700 { color: #334155 !important; }
.app-shell .bg-white .text-slate-600 { color: #475569 !important; }
.app-shell .bg-white .text-slate-500 { color: #64748b !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* Glass morphism */
.glass {
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* Medical gradients */
.med-gradient { background: linear-gradient(135deg, #0891b2 0%, #0284c7 40%, #0d9488 100%); }
.med-gradient-light { background: linear-gradient(135deg, #ecfeff 0%, #f0fdfa 50%, #f0f9ff 100%); }
.med-gradient-text {
    background: linear-gradient(135deg, #0891b2, #0284c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Grid dot pattern */
.grid-pattern {
    background-image: radial-gradient(circle, #cbd5e1 .5px, transparent .5px);
    background-size: 24px 24px;
}

/* Animations */
@keyframes fadeUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes breathe { 0%,100%{transform:scale(1);opacity:.6} 50%{transform:scale(1.08);opacity:1} }
@keyframes pulseRing { 0%{transform:scale(1);opacity:.6} 100%{transform:scale(2.2);opacity:0} }
@keyframes waveBar {
    0%   { transform:scaleY(.25); }
    15%  { transform:scaleY(.9); }
    30%  { transform:scaleY(.45); }
    50%  { transform:scaleY(1); }
    65%  { transform:scaleY(.35); }
    80%  { transform:scaleY(.75); }
    100% { transform:scaleY(.25); }
}
.pulse-ring { animation: pulseRing 2s ease-out infinite; }

.fade-up { animation: fadeUp .7s cubic-bezier(.16,1,.3,1) both; }
.fade-in { animation: fadeIn .5s ease both; }
.breathe { animation: breathe 3s ease-in-out infinite; }

/* IA Escriba — continuous feedback while scribe is active */
@keyframes scribeHalo {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0); }
    50%      { box-shadow: 0 0 0 6px rgba(139,92,246,.22); }
}
.scribe-active-halo { animation: scribeHalo 2.4s ease-in-out infinite; border-radius: 0.75rem; }

.scribe-shimmer-border {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
}
.scribe-shimmer-border::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(139,92,246,.18) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 4.5s linear infinite;
    pointer-events: none;
    border-radius: inherit;
}

/* .scribe-caret kept as a hook in case we ever need to override the inherited
   color; today the typing-caret uses `currentColor`, which inherits from the
   parent text-violet-600 utility — caret matches the label exactly. */
.scribe-caret { /* inherits color from parent (.text-violet-600 etc.) */ }

.delay-1 { animation-delay:.08s }
.delay-2 { animation-delay:.16s }
.delay-3 { animation-delay:.24s }
.delay-4 { animation-delay:.32s }
.delay-5 { animation-delay:.4s }

/* Sidebar */
.sidebar-link.active {
    background-color: rgba(6, 182, 212, 0.1);
    border-right: 3px solid #06b6d4;
    color: white;
}

/* Metric card hover */
.metric-card {
    transition: all .25s cubic-bezier(.16,1,.3,1);
    border: 1px solid #e2e8f0;
}
@media (hover: hover) {
    .metric-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 30px rgba(0,0,0,.06);
        border-color: #06b6d4;
    }
}

/* Section divider */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #06b6d4, transparent);
    opacity: .2;
}

/* ─── Landing page — Telemedicina + Copiloto Clínico ─────────── */

/* Connection pulse — particles flowing between doctor and patient */
@keyframes connectionFlow {
    0%   { left: -20px;    opacity: 0; }
    15%  {                 opacity: 1; }
    85%  {                 opacity: 1; }
    100% { left: 100%;     opacity: 0; }
}
.connection-line {
    position: relative;
    height: 2px;
    background: linear-gradient(90deg, rgba(6,182,212,.15), rgba(13,148,136,.35), rgba(6,182,212,.15));
    overflow: hidden;
    border-radius: 999px;
}
.connection-line::before,
.connection-line::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -20px;
    width: 20px;
    height: 4px;
    margin-top: -2px;
    background: linear-gradient(90deg, transparent, #06b6d4, transparent);
    border-radius: 999px;
    animation: connectionFlow 2.8s cubic-bezier(.4,0,.6,1) infinite;
    will-change: left, opacity;
}
.connection-line::after {
    animation-delay: 1.4s;
    animation-direction: reverse;
    background: linear-gradient(90deg, transparent, #0d9488, transparent);
}

/* ECG pulse through a path */
@keyframes ecg {
    0%   { stroke-dashoffset: 400; }
    60%  { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -400; }
}
.ecg-path {
    stroke-dasharray: 400;
    animation: ecg 3s linear infinite;
}

/* AI insight card entry */
@keyframes aiCardIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); filter: blur(4px); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   filter: blur(0); }
}
.ai-insight-card { animation: aiCardIn .6s cubic-bezier(.16,1,.3,1) both; }

/* Typing caret (for AI insight text) */
@keyframes typingCaret { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.typing-caret {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    background: currentColor;
    vertical-align: text-bottom;
    animation: typingCaret 1s step-end infinite;
}

/* Active insight highlight (halo) */
@keyframes insightHalo {
    0%, 100% { box-shadow: 0 0 0 0 rgba(6,182,212,0); }
    50%      { box-shadow: 0 0 0 6px rgba(6,182,212,.18); }
}
.insight-active { animation: insightHalo 2s ease-in-out infinite; }

/* Waveform bars — staggered per-child via --i */
.wave-bar {
    display: inline-block;
    width: 4px;
    margin: 0 2px;
    background: linear-gradient(180deg, #06b6d4, #0d9488);
    border-radius: 2px;
    transform-origin: center;
    animation: waveBar 1.2s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 80ms);
}

/* Floating shield (compliance) */
@keyframes floatSlow {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-6px) rotate(-1.5deg); }
}
.float-slow { animation: floatSlow 6s ease-in-out infinite; }

/* Scroll reveal variants */
.reveal-left  { opacity: 0; transform: translateX(-40px); transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .8s cubic-bezier(.16,1,.3,1); }
.reveal-right { opacity: 0; transform: translateX(40px);  transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .8s cubic-bezier(.16,1,.3,1); }
.reveal-scale { opacity: 0; transform: scale(.94);        transition: opacity .8s cubic-bezier(.16,1,.3,1), transform .8s cubic-bezier(.16,1,.3,1); }
.reveal-left.visible,
.reveal-right.visible,
.reveal-scale.visible { opacity: 1; transform: none; }

/* Compliance badge shimmer */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
.shimmer-border {
    position: relative;
    overflow: hidden;
}
.shimmer-border::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(6,182,212,.18) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 3.5s linear infinite;
    pointer-events: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .fade-up, .fade-in, .breathe, .pulse-ring { animation: none; }
    .delay-1, .delay-2, .delay-3, .delay-4, .delay-5 { animation-delay: 0s; }
    .connection-line::before, .connection-line::after,
    .ecg-path, .ai-insight-card, .typing-caret,
    .insight-active, .wave-bar, .float-slow,
    .shimmer-border::after,
    .scribe-active-halo, .scribe-shimmer-border::after { animation: none !important; }
    .reveal-left, .reveal-right, .reveal-scale { opacity: 1; transform: none; }
}

/* Mobile: prevent body scroll when sidebar open */
body.sidebar-open { overflow: hidden; }

/* Line clamp for clinical summary */
.line-clamp-6 {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hide scrollbar for tabs */
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* Pulse animation for critical indicators */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.animate-pulse { animation: pulse-dot 2s ease-in-out infinite; }

/* Mobile: sidebar hidden by default (CSS fallback before Alpine/Tailwind load) */
@media (max-width: 767.98px) {
    aside.fixed.z-40 { transform: translateX(-100%); }
}

/* intl-tel-input overrides so the phone input blends with our Tailwind styling */
.iti { width: 100%; display: block; }
.iti__tel-input {
    width: 100%;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    padding-right: 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #f0f4f8;
    font-size: 0.875rem;
}
.iti__tel-input:focus {
    outline: none;
    border-color: #22d3ee;
    box-shadow: 0 0 0 2px rgba(6,182,212,0.3);
}
