/* ============================================
   MaritimeOne Crew Portal
   Refined Nautical Minimalism
   ============================================ */

/* --- Design Tokens (Light) --- */
:root {
    --background: 248 250 252;
    --foreground: 15 23 42;
    --card: 255 255 255;
    --card-foreground: 15 23 42;
    --popover: 255 255 255;
    --popover-foreground: 15 23 42;
    --muted: 241 245 249;
    --muted-foreground: 100 116 139;
    --border: 226 232 240;
    --input: 226 232 240;
    --ring: 14 165 233;
    --primary: 3 23 61;
    --primary-foreground: 255 255 255;
    --secondary: 241 245 249;
    --secondary-foreground: 30 41 59;
    --accent: 14 165 233;
    --accent-foreground: 255 255 255;
    --destructive: 239 68 68;
    --destructive-foreground: 255 255 255;
    --success: 16 185 129;
    --success-foreground: 255 255 255;
    --warning: 245 158 11;
    --warning-foreground: 255 255 255;
    --radius: 0.75rem;

    /* Crew Portal Specific */
    --crew-navy: #03173d;
    --crew-navy-light: #0a2a5e;
    --crew-ocean: #0ea5e9;
    --crew-teal: #14b8a6;
    --crew-glow: rgba(14, 165, 233, 0.4);
}

/* --- Design Tokens (Dark) --- */
.dark {
    --background: 10 15 30;
    --foreground: 226 232 240;
    --card: 15 23 42;
    --card-foreground: 226 232 240;
    --popover: 15 23 42;
    --popover-foreground: 226 232 240;
    --muted: 30 41 59;
    --muted-foreground: 148 163 184;
    --border: 51 65 85;
    --input: 51 65 85;
    --ring: 56 189 248;
    --primary: 56 189 248;
    --primary-foreground: 3 23 61;
    --secondary: 30 41 59;
    --secondary-foreground: 226 232 240;
    --accent: 56 189 248;
    --accent-foreground: 3 23 61;
    --destructive: 239 68 68;
    --destructive-foreground: 255 255 255;
    --success: 52 211 153;
    --success-foreground: 3 23 61;
    --warning: 251 191 36;
    --warning-foreground: 3 23 61;

    --crew-navy: #0f172a;
    --crew-navy-light: #1e293b;
    --crew-ocean: #38bdf8;
    --crew-teal: #2dd4bf;
    --crew-glow: rgba(56, 189, 248, 0.3);
}

/* --- Base --- */
html, body, #app {
    height: 100%;
    margin: 0;
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 var(--crew-glow); }
    50% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes drawLine {
    from { height: 0; }
    to { height: 100%; }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Utility animation classes */
.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out both;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out both;
}

.animate-slide-in-right {
    animation: slideInRight 0.4s ease-out both;
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out both;
}

/* Stagger delays */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }
.stagger-9 { animation-delay: 0.45s; }
.stagger-10 { animation-delay: 0.5s; }

/* --- Crew Header Gradient --- */
.crew-header {
    background: linear-gradient(135deg, var(--crew-navy) 0%, var(--crew-navy-light) 100%);
}

/* --- Stepper Glow --- */
.step-circle-active {
    animation: pulseGlow 2s ease-in-out infinite;
}

.step-line-animated {
    animation: drawLine 0.6s ease-out both;
}

/* --- Card Hover --- */
.crew-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.crew-card:active {
    transform: scale(0.98);
}

/* --- Glass Effect --- */
.glass {
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    background: rgba(255, 255, 255, 0.7);
}

.dark .glass {
    background: rgba(15, 23, 42, 0.7);
}

/* --- Status Badges --- */
.badge-valid { background-color: #dcfce7; color: #166534; }
.badge-expiring { background-color: #fef9c3; color: #854d0e; }
.badge-expired { background-color: #fee2e2; color: #991b1b; }
.badge-pending { background-color: #dbeafe; color: #1e40af; }
.badge-approved { background-color: #dcfce7; color: #166534; }
.badge-current { background-color: #dbeafe; color: #1e40af; }

.dark .badge-valid { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.dark .badge-expiring { background-color: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.dark .badge-expired { background-color: rgba(239, 68, 68, 0.15); color: #f87171; }
.dark .badge-pending { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.dark .badge-approved { background-color: rgba(16, 185, 129, 0.15); color: #34d399; }
.dark .badge-current { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* --- Skeleton --- */
.skeleton {
    background: linear-gradient(90deg, rgb(var(--muted)) 25%, rgb(var(--card)) 50%, rgb(var(--muted)) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

/* --- Safe Areas --- */
.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

.bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
}

/* --- Gradient Text --- */
.gradient-text {
    background: linear-gradient(135deg, var(--crew-ocean), var(--crew-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Animated Gradient Background --- */
.animated-gradient {
    background: linear-gradient(-45deg, #03173d, #0a2a5e, #0c4a6e, #064e3b);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgb(var(--muted-foreground) / 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgb(var(--muted-foreground) / 0.5); }
