/* ============================================
   URLAUBBRO DESIGN SYSTEM 2026
   Modern, Glassmorphic, Micro-Interactions
   ============================================ */

/* === CUSTOM PROPERTIES (CSS Variables) === */
:root {
    /* === Round 70: KANONISCHE BRAND-TOKENS ===
       Single Source of Truth für alle 5 Apps (Platform/Creator/Admin/CreatorSite/Mobile).
       Diese Datei wird in jeder App via `_content/UrlaubBro.Web.Shared/css/design-system.css`
       eingebunden. Lokale `:root`-Blocks (site.css, creator.css, app.css) bleiben für
       App-spezifische Tokens, ÜBERLAGERN aber NIEMALS die `--ub-*`-Brand-Tokens unten.

       Legacy-Aliases (`--creator-primary`, `--color-primary`, `--ub-primary`)
       zeigen via var()-Fallback auf die kanonischen `--ub-brand-*` — damit existierende
       Pages weiter funktionieren ohne Migrations-Zwang.
    */
    /* Notova-Marke (2026-06-01): Ink + Spark statt Blau. Kanonische Quelle für
       alle var(--ub-primary)/var(--creator-primary)-Aliases plattformweit. */
    --ub-brand-primary: #16233D;        /* Notova Ink (Buttons, Links, Headers) */
    --ub-brand-primary-hover: #11203B;  /* Hover-State */
    --ub-brand-accent: #F0A500;         /* Notova Spark (Akzent) */
    --ub-brand-gradient: linear-gradient(150deg, #213354 0%, #16233D 60%, #0C1424 100%);
    --ub-success: #10b981;
    --ub-warning: #f59e0b;
    --ub-danger: #dc2626;
    --ub-text-primary: #1e293b;
    --ub-text-secondary: #64748b;
    --ub-text-muted: #94a3b8;
    --ub-border: #e2e8f0;
    --ub-bg-card: #ffffff;
    --ub-bg-subtle: #f8fafc;

    /* === Round 70: Legacy-Aliases ===
       App-Pages nutzen historisch unterschiedliche Token-Namen. Hier zeigen alle auf
       die kanonische `--ub-brand-*`-Quelle. Wenn eine App ihren lokalen `:root` Block
       NICHT mehr definiert (z.B. weil entfernt), greifen diese Aliases als Fallback.
       Wenn die App den lokalen `:root` weiter hat, gewinnt die App-spezifische
       Definition (Cascade-Reihenfolge: design-system.css zuerst, lokale CSS später).
    */
    --ub-primary: var(--ub-brand-primary);
    --ub-primary-light: var(--ub-brand-accent);
    --ub-primary-hover: var(--ub-brand-primary-hover);
    --ub-primary-dark: var(--ub-brand-primary-hover);
    --ub-primary-gradient: var(--ub-brand-gradient);
    --creator-primary: var(--ub-brand-primary);
    --creator-primary-hover: var(--ub-brand-primary-hover);
    --creator-accent: var(--ub-brand-accent);
    --color-primary: var(--ub-brand-primary);
    --color-primary-dark: var(--ub-brand-primary-hover);
    --color-primary-gradient: var(--ub-brand-gradient);

    /* Primary-XX-Skala — Notova Ink-Ramp (Legacy-Design-System-Components) */
    /* === Primary Brand Colors === */
    --primary-50: #F4F6F9;
    --primary-100: #E5EAF1;
    --primary-200: #C7D0E0;
    --primary-300: #9AA8C2;
    --primary-400: #5E7193;
    --primary-500: #16233D;  /* Main brand color — Notova Ink */
    --primary-600: #11203B;
    --primary-700: #0F1B33;
    --primary-800: #0C1424;
    --primary-900: #080E1A;

    /* === Secondary/Accent Colors === Notova Spark (amber) */
    --accent-50: #FEF9EC;
    --accent-100: #FDF1D6;
    --accent-200: #FBE3AD;
    --accent-300: #F8CE73;
    --accent-400: #F4B73C;
    --accent-500: #F0A500;  /* Notova Spark */
    --accent-600: #D08F00;
    --accent-700: #B97F08;
    --accent-800: #93650A;
    --accent-900: #6E4C0C;

    /* === Success Colors === */
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;

    /* === Warning Colors === */
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;

    /* === Error Colors === */
    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-500: #ef4444;
    --error-600: #dc2626;

    /* === Neutrals (Grays) === */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* === Typography Scale === */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;

    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 1.875rem;    /* 30px */
    --text-4xl: 2.25rem;     /* 36px */
    --text-5xl: 3rem;        /* 48px */
    --text-6xl: 3.75rem;     /* 60px */
    --text-7xl: 4.5rem;      /* 72px */

    /* === Font Weights === */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* === Spacing Scale === */
    --space-0: 0;
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    --space-20: 5rem;     /* 80px */
    --space-24: 6rem;     /* 96px */
    --space-32: 8rem;     /* 128px */

    /* === Border Radius === */
    --radius-none: 0;
    --radius-sm: 0.25rem;    /* 4px */
    --radius-md: 0.375rem;   /* 6px */
    --radius-lg: 0.5rem;     /* 8px */
    --radius-xl: 0.75rem;    /* 12px */
    --radius-2xl: 1rem;      /* 16px */
    --radius-3xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;   /* Fully rounded */

    /* === Shadows (Soft & Layered) === */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Colored Shadows for Brand Elements */
    --shadow-primary: 0 10px 30px -5px rgba(22,35,61, 0.3);
    --shadow-accent: 0 10px 30px -5px rgba(240,165,0, 0.3);
    --shadow-success: 0 10px 30px -5px rgba(34, 197, 94, 0.3);

    /* === Glassmorphism Effects === */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-blur: blur(20px);
    --glass-dark-bg: rgba(17, 24, 39, 0.7);
    --glass-dark-border: rgba(255, 255, 255, 0.1);

    /* === Gradients === */
    --gradient-primary: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
    --gradient-sunset: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-ocean: linear-gradient(135deg, #2196F3 0%, #00BCD4 100%);
    --gradient-vibrant: linear-gradient(135deg, var(--primary-400) 0%, var(--accent-500) 100%);

    /* === Transitions & Animations === */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 600ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* === Z-Index Scale === */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
    :root {
        --glass-bg: rgba(17, 24, 39, 0.7);
        --glass-border: rgba(255, 255, 255, 0.1);
    }
}

/* === BASE RESET & TYPOGRAPHY === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray-900);
    background-color: #FAF8F4; /* Notova warm paper */
}

/* === HEADINGS === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--ub-brand-primary, #16233D); /* Notova Ink */
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

/* === LINKS === */
a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--primary-700);
}

/* === FOCUS STATES === */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-md);
}

/* ============================================
   MODERN COMPONENT STYLES
   ============================================ */

/* === CARD COMPONENT === */
.card {
    background: white;
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 1px solid var(--gray-100);
}

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

/* Glass Card Variant */
.card-glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
}

/* === BUTTON COMPONENT === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    line-height: 1;
    border-radius: var(--radius-xl);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

/* Primary Button */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px -10px rgba(22,35,61, 0.4);
}

/* Secondary Button */
.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--gray-700);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

/* === INPUT COMPONENTS === */
.input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    color: var(--gray-900);
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    transition: all var(--transition-base);
}

.input:hover {
    border-color: var(--gray-300);
}

.input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(22,35,61, 0.1);
}

/* === BADGE COMPONENT === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-success {
    background: var(--success-100);
    color: var(--success-700);
}

.badge-warning {
    background: var(--warning-100);
    color: var(--warning-700);
}

/* ============================================
   ANIMATIONS & KEYFRAMES
   ============================================ */

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-base) ease-in;
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-slow) ease-out;
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-slow) ease-out;
}

/* Spin */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

/* Pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Bounce */
@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* Stagger Animation for Lists */
.stagger-animation > * {
    animation: fadeInUp var(--transition-slow) ease-out backwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0ms; }
.stagger-animation > *:nth-child(2) { animation-delay: 100ms; }
.stagger-animation > *:nth-child(3) { animation-delay: 200ms; }
.stagger-animation > *:nth-child(4) { animation-delay: 300ms; }
.stagger-animation > *:nth-child(5) { animation-delay: 400ms; }

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Flexbox Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Grid Utilities */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Spacing Utilities */
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-20 { padding-top: var(--space-20); padding-bottom: var(--space-20); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

/* Text Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: var(--text-sm); }
.text-5xl { font-size: var(--text-5xl); }
.font-semibold { font-weight: var(--font-semibold); }

/* Background Utilities */
.bg-gray-50 { background-color: var(--gray-50); }

/* Border Radius */
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Width Utilities */
.w-full { width: 100%; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.h-80 { height: 20rem; }

/* Responsive Grid */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

/* Space Utility */
.space-y-3 > * + * {
    margin-top: var(--space-3);
}

/* ==================================================================
   Round 100: Mobile-Polish (global)
   ==================================================================
   - iOS Safari zoomt automatisch in `<input>`-Felder wenn font-size < 16px.
     Fix: forciere font-size: 16px auf allen Form-Elementen unter 600px.
     Wir disable absichtlich NICHT `user-scalable=no` (Accessibility-Anti-Pattern).
   - Touch-tap-highlight transparent statt blau (sieht professioneller aus).
   - Tap-Targets mindestens 44x44px (Apple HIG / WCAG 2.5.5).
   ================================================================== */

/* Auto-zoom-Prevention bei iOS Safari */
@media (max-width: 600px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="month"],
    input[type="time"],
    input[type="week"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Touch-Highlight neutralisieren (Standard ist hellblau, looks cheap) */
html {
    -webkit-tap-highlight-color: rgba(22,35,61, 0.12);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Minimum Tap-Target-Groesse fuer kleine Buttons auf Touch-Geraeten */
@media (hover: none) and (pointer: coarse) {
    button,
    [role="button"],
    a.button,
    .btn,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 36px;
    }
    /* Standalone icon-buttons brauchen mehr Padding */
    button.icon-only,
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Smooth-scrolling auf Anchor-Links */
@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

/* Round 113: Mobile-Safety-Nets gegen horizontal-Scroll auf bis zu 768px
   erweitert (vorher nur unter 600px). Deckt zusaetzlich <pre>/<code>/<img>/
   <iframe>/<video>/<embed> ab — alles was Pages auseinandersprengen kann.
   User-Report "manche Seiten kann man in der Breite scrollen". */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Alle <table>-Elemente unter 768px scrollbar wrappen */
    table:not(.no-mobile-scroll) {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Pre/Code: lange Code-Zeilen sollen umbrechen, nicht die Seite sprengen */
    pre:not(.no-mobile-wrap),
    code:not(.no-mobile-wrap) {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre-wrap;
        word-wrap: break-word;
    }
    /* Media-Elemente: nie breiter als Container */
    img:not(.no-mobile-shrink),
    video:not(.no-mobile-shrink),
    iframe:not(.no-mobile-shrink),
    embed:not(.no-mobile-shrink) {
        max-width: 100%;
        height: auto;
    }
    /* Long-Word-Break in Body-Text damit lange URLs nicht horizontal scrollen */
    p, li, .post-body, [class*="-body"], [class*="-description"],
    h1, h2, h3, h4 {
        overflow-wrap: anywhere;
        word-wrap: break-word;
    }
}

/* Bessere Mobile-Tabellen — horizontal scroll statt overflow-hidden */
@media (max-width: 600px) {
    /* Generischer Container für Hero-Sections — sane padding auf engen Devices */
    .hero, [class*="-hero"] {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    /* Buttons groesser auf Touch: min-width damit Tap-Target gut greifbar ist */
    button:not(.icon-only):not([class*="icon-btn"]) {
        min-height: 38px;
    }
}

/* Round 110 Mobile-Polish: bessere Focus-States für Keyboard-Navigation
   (Tab-Indizierung wird wieder sichtbar — vorher haben einige Custom-Styles outline:none gesetzt) */
@media (any-pointer: fine) {
    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    textarea:focus-visible,
    select:focus-visible,
    [role="button"]:focus-visible {
        outline: 2px solid var(--ub-brand-primary, #16233D);
        outline-offset: 2px;
        border-radius: 4px;
    }
}

/* Round 110 Mobile-Polish: Sticky-Footer/Header verstecken wenn die Software-Keyboard
   den Viewport verkleinert (Mobile Safari/Chrome). visualViewport-Listener
   muesste in JS sein — Workaround mit dvh-Unit fuer modernen Browser-Support. */
@supports (height: 100dvh) {
    .min-h-screen, [class*="min-h-100vh"] {
        min-height: 100dvh;
    }
}
