/**
 * OptionFinder Design System v1.0.0
 * ==================================
 * Zentrale CSS-Datei fuer ALLE Seiten (Website + Kundenbereich).
 * Wird als allererste CSS-Datei geladen.
 *
 * Definiert: Farben, Typografie, Buttons, Links, Cards, Spacing, Shadows, Dark Mode.
 * Alle Komponenten-CSS-Dateien referenzieren diese Variablen.
 *
 * DSGVO: Nur System-Fonts, keine externen Downloads.
 */

/* ==========================================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================================== */

:root {
    /* ----- FONT FAMILIES (System-Fonts, DSGVO-konform) ----- */
    --of-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                    "Helvetica Neue", Arial, sans-serif;
    --of-font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono",
                    Consolas, "Courier New", monospace;

    /* ----- FONT SIZES ----- */
    --of-text-xs:   0.75rem;     /* 12px */
    --of-text-sm:   0.8125rem;   /* 13px */
    --of-text-base: 0.875rem;    /* 14px — Basis fuer Datentabellen */
    --of-text-md:   0.9375rem;   /* 15px */
    --of-text-lg:   1rem;        /* 16px */
    --of-text-xl:   1.125rem;    /* 18px */
    --of-text-2xl:  1.25rem;     /* 20px */
    --of-text-3xl:  1.5rem;      /* 24px */
    --of-text-4xl:  1.875rem;    /* 30px */
    --of-text-5xl:  2.25rem;     /* 36px */
    --of-text-6xl:  3rem;        /* 48px */
    --of-text-7xl:  3.75rem;     /* 60px */

    /* ----- FONT WEIGHTS ----- */
    --of-weight-normal:    400;
    --of-weight-medium:    500;
    --of-weight-semibold:  600;
    --of-weight-bold:      700;
    --of-weight-extrabold: 800;

    /* ----- LINE HEIGHTS ----- */
    --of-leading-none:     1;
    --of-leading-tight:    1.2;
    --of-leading-snug:     1.35;
    --of-leading-normal:   1.5;
    --of-leading-relaxed:  1.65;

    /* ----- LETTER SPACING ----- */
    --of-tracking-tight:   -0.025em;
    --of-tracking-normal:  0;
    --of-tracking-wide:    0.025em;
    --of-tracking-caps:    0.06em;    /* fuer Uppercase-Labels */

    /* ----- COLORS — Light Theme (Default) ----- */
    --of-bg-primary:     #f8fafc;
    --of-bg-secondary:   #f1f5f9;
    --of-bg-card:        #ffffff;
    --of-bg-elevated:    #ffffff;

    --of-text-primary:   #1e293b;
    --of-text-secondary: #64748b;
    --of-text-muted:     #94a3b8;
    --of-text-inverse:   #f1f5f9;

    --of-border:         #e2e8f0;
    --of-border-light:   #f1f5f9;
    --of-border-strong:  #cbd5e1;

    /* Accent */
    --of-teal:           #14b8a6;
    --of-teal-hover:     #0d9488;
    --of-teal-light:     rgba(20, 184, 166, 0.1);
    --of-violet:         #8b5cf6;
    --of-violet-hover:   #7c3aed;
    --of-violet-light:   rgba(139, 92, 246, 0.1);

    /* Status */
    --of-success:        #10b981;
    --of-warning:        #f59e0b;
    --of-error:          #ef4444;
    --of-info:           #3b82f6;

    /* ----- SPACING (8px base) ----- */
    --of-space-1:  0.25rem;   /* 4px */
    --of-space-2:  0.5rem;    /* 8px */
    --of-space-3:  0.75rem;   /* 12px */
    --of-space-4:  1rem;      /* 16px */
    --of-space-5:  1.25rem;   /* 20px */
    --of-space-6:  1.5rem;    /* 24px */
    --of-space-8:  2rem;      /* 32px */
    --of-space-10: 2.5rem;    /* 40px */
    --of-space-12: 3rem;      /* 48px */
    --of-space-16: 4rem;      /* 64px */
    --of-space-20: 5rem;      /* 80px */

    /* ----- BORDER RADIUS ----- */
    --of-radius-sm:   0.25rem;  /* 4px */
    --of-radius-md:   0.5rem;   /* 8px */
    --of-radius-lg:   0.75rem;  /* 12px */
    --of-radius-xl:   1rem;     /* 16px */
    --of-radius-full: 9999px;

    /* ----- SHADOWS ----- */
    --of-shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.05);
    --of-shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --of-shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --of-shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* ----- TRANSITIONS ----- */
    --of-ease-fast:  150ms ease-in-out;
    --of-ease-base:  250ms ease-in-out;
    --of-ease-slow:  400ms ease-in-out;

    /* ----- LAYOUT ----- */
    --of-content-width: 1600px;
    --of-header-height: 72px;
}


/* ==========================================================================
   2. DARK MODE
   ========================================================================== */

[data-theme="dark"] {
    --of-bg-primary:     #0f172a;
    --of-bg-secondary:   #1e293b;
    --of-bg-card:        #1e293b;
    --of-bg-elevated:    #334155;

    --of-text-primary:   #f1f5f9;
    --of-text-secondary: #94a3b8;
    --of-text-muted:     #64748b;
    --of-text-inverse:   #0f172a;

    --of-border:         #334155;
    --of-border-light:   #1e293b;
    --of-border-strong:  #475569;

    --of-shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.2);
    --of-shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --of-shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --of-shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.5);
}


/* ==========================================================================
   3. BASE STYLES
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-family: var(--of-font-sans);
    font-size: 16px;
    line-height: var(--of-leading-normal);
    color: var(--of-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    background: var(--of-bg-primary);
    color: var(--of-text-primary);
}


/* ==========================================================================
   4. TYPOGRAPHY — Headings
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--of-weight-bold);
    line-height: var(--of-leading-tight);
    letter-spacing: var(--of-tracking-tight);
    color: var(--of-text-primary);
    margin: 0;
}

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

@media (max-width: 640px) {
    h1 { font-size: var(--of-text-4xl); }
    h2 { font-size: var(--of-text-3xl); }
    h3 { font-size: var(--of-text-2xl); }
}

p {
    margin: 0;
    color: var(--of-text-secondary);
    line-height: var(--of-leading-relaxed);
}


/* ==========================================================================
   5. LINKS
   ========================================================================== */

a {
    color: var(--of-teal);
    text-decoration: none;
    transition: color var(--of-ease-fast);
}

a:hover {
    color: var(--of-teal-hover);
}


/* ==========================================================================
   6. BUTTONS
   ========================================================================== */

.of-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-family: var(--of-font-sans);
    font-size: var(--of-text-base);
    font-weight: var(--of-weight-semibold);
    line-height: 1;
    border: 1px solid transparent;
    border-radius: var(--of-radius-md);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--of-ease-fast);
}

/* Primary — Teal solid */
.of-btn--primary {
    background: var(--of-teal);
    color: #fff;
    border-color: var(--of-teal);
}

.of-btn--primary:hover {
    background: var(--of-teal-hover);
    border-color: var(--of-teal-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--of-shadow-md);
}

/* Secondary — Outline */
.of-btn--secondary {
    background: var(--of-bg-card);
    color: var(--of-text-primary);
    border-color: var(--of-border);
}

.of-btn--secondary:hover {
    border-color: var(--of-teal);
    color: var(--of-teal);
}

/* Gradient — Teal gradient with glow */
.of-btn--gradient {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
}

.of-btn--gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
    color: #fff;
}

/* Icon button */
.of-btn--icon {
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: var(--of-text-secondary);
}

.of-btn--icon:hover {
    color: var(--of-text-primary);
}

/* Sizes */
.of-btn--sm {
    padding: 0.375rem 0.875rem;
    font-size: var(--of-text-sm);
}

.of-btn--lg {
    padding: 0.75rem 1.75rem;
    font-size: var(--of-text-lg);
}


/* ==========================================================================
   7. CARDS
   ========================================================================== */

.of-card {
    background: var(--of-bg-card);
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-lg);
    padding: var(--of-space-6);
    box-shadow: var(--of-shadow-sm);
    transition: box-shadow var(--of-ease-fast);
}

.of-card:hover {
    box-shadow: var(--of-shadow-md);
}


/* ==========================================================================
   8. LABELS & BADGES
   ========================================================================== */

.of-label {
    display: inline-block;
    font-size: var(--of-text-xs);
    font-weight: var(--of-weight-semibold);
    letter-spacing: var(--of-tracking-caps);
    text-transform: uppercase;
    color: var(--of-teal);
}

.of-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    font-size: var(--of-text-xs);
    font-weight: var(--of-weight-semibold);
    border-radius: var(--of-radius-sm);
    line-height: 1.4;
}

.of-badge--success { background: rgba(16, 185, 129, 0.12); color: #059669; }
.of-badge--warning { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.of-badge--error   { background: rgba(239, 68, 68, 0.12);  color: #dc2626; }
.of-badge--info    { background: rgba(59, 130, 246, 0.12);  color: #2563eb; }
.of-badge--teal    { background: var(--of-teal-light);      color: var(--of-teal); }


/* ==========================================================================
   9. FORM ELEMENTS
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    font-family: var(--of-font-sans);
    font-size: var(--of-text-base);
    color: var(--of-text-primary);
    background: var(--of-bg-card);
    border: 1px solid var(--of-border);
    border-radius: var(--of-radius-md);
    padding: 0.5rem 0.75rem;
    transition: border-color var(--of-ease-fast);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--of-teal);
    box-shadow: 0 0 0 3px var(--of-teal-light);
}


/* ==========================================================================
   10. TOOLTIPS — Violetter Kreis mit Fragezeichen (wie im Aktienscanner)
   ========================================================================== */

.of-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    cursor: help;
}

.of-help__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--of-violet);
    background: transparent;
    color: var(--of-violet);
    font-size: 0.6875rem;
    font-weight: var(--of-weight-bold);
    font-style: normal;
    transition: all 0.2s ease;
    line-height: 1;
}

.of-help:hover .of-help__icon {
    background: var(--of-violet);
    color: #fff;
}

.of-help__text {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--of-violet);
    color: #fff;
    font-size: var(--of-text-sm, 0.8125rem);
    font-weight: var(--of-weight-normal);
    line-height: 1.5;
    border-radius: var(--of-radius-md);
    white-space: normal;
    width: max-content;
    max-width: 320px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-transform: none;
    letter-spacing: 0;
}

.of-help__text::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--of-violet);
}

.of-help:hover .of-help__text {
    opacity: 1;
    visibility: visible;
}

.of-help__text strong {
    color: #fff;
    font-weight: var(--of-weight-semibold);
}


/* ==========================================================================
   11. SECTION PATTERN
   ========================================================================== */

.of-section {
    width: 100%;
    padding: var(--of-space-20) var(--of-space-8);
}

.of-section__inner {
    max-width: var(--of-content-width);
    margin: 0 auto;
}

.of-section--alt {
    background: var(--of-bg-secondary);
}

@media (max-width: 640px) {
    .of-section {
        padding: var(--of-space-12) var(--of-space-5);
    }
}
