/* ═══════════════════════════════════════════════════════════════════════════
   AVV-Portal – Contedi GmbH
   Multi-Produkt-Theming via [data-product="…"]
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'IBM Plex Sans';
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/IBMPlexSans-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'IBM Plex Sans';
    font-weight: 600 700;
    font-display: swap;
    src: url('../fonts/IBMPlexSans-SemiBold.ttf') format('truetype');
}

:root {
    --c-bg:          #f5f5f7;
    --c-surface:     #ffffff;
    --c-surface-alt: #fafafa;
    --c-border:      #d2d2d7;
    --c-border-lt:   #e8e8ed;
    --c-text:        #1d1d1f;
    --c-text-2:      #6e6e73;
    --c-text-3:      #aeaeb2;
    --c-success:     #34c759;
    --c-success-bg:  #f0faf3;
    --c-error:       #ff3b30;
    --c-error-bg:    #fff2f1;
    --c-muted-bg:    #f2f2f7;

    --p-primary:  #005A78;
    --p-hover:    #00475f;
    --p-light:    #e5eff2;
    --p-text:     #ffffff;

    --font:  'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    --r-sm:  8px;
    --r:    12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --sh:    0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.05);
    --t:    .18s ease;
}

/* ── Produkt-Themes (gesetzt via data-product am <body>) ───────────────────── */
/* Helle Produktfarben: dunkle Contedi-Schrift auf Buttons fuer ausreichenden Kontrast */
[data-product="time"]    { --p-primary:#2AC8B5; --p-hover:#22ab9b; --p-light:#e3f7f4; --p-text:#00384b; --p-ink:#137a6e; }
[data-product="profile"] { --p-primary:#D6BB3A; --p-hover:#bea42c; --p-light:#faf5de; --p-text:#00384b; --p-ink:#7d6a12; }
[data-product="general"] { --p-primary:#005A78; --p-hover:#00475f; --p-light:#e5eff2; }

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--c-text);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */
.site-header {
    background: rgba(255,255,255,.88);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--c-border-lt);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 1.5rem;
}
.header-inner {
    max-width: 800px;
    margin: 0 auto;
    min-height: 72px;
    padding: .75rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--c-text); }
.brand-logo, .product-header-logo {
    height: 56px;
    width: auto;
    display: block;
    object-fit: contain;
}
.product-header-logo { height: 36px; }
.brand-logo { height: 28px; } /* Contedi-Wortmarke ist sehr breit (ca. 4,4:1) */
.header-right { display: flex; align-items: center; gap: .75rem; }

.lang-switcher { display: flex; gap: 2px; }
.lang-btn {
    font-size: .75rem; font-weight: 600;
    color: var(--c-text-2); text-decoration: none;
    padding: 4px 8px; border-radius: 6px;
    transition: all var(--t);
}
.lang-btn:hover { color: var(--c-text); background: var(--c-muted-bg); }
.lang-btn.lang-active { color: var(--p-ink, var(--p-primary)); background: var(--p-light); }

/* ═══════════════════════════════════════════════════════════════════════════
   LANDING
   ═══════════════════════════════════════════════════════════════════════════ */
.landing-main { flex: 1; padding: 0 1.5rem 5rem; }
.landing-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
    max-width: 620px;
    margin: 0 auto;
}
.landing-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -.035em;
    margin-bottom: .875rem;
    line-height: 1.2;
}
.landing-subtitle {
    font-size: .9375rem;
    color: var(--c-text-2);
    line-height: 1.7;
    max-width: 540px;
    margin: 0 auto;
}
.landing-products { max-width: 800px; margin: 0 auto; }
.landing-section-title {
    font-size: .75rem; font-weight: 600;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--c-text-3);
    margin-bottom: 1rem;
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.product-card {
    background: #fff;
    border: 1.5px solid var(--c-border-lt);
    border-radius: var(--r-xl);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    position: relative;
    overflow: hidden;
}
.product-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--p-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s ease;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,.11);
    border-color: var(--p-primary);
}
.product-card:hover::before { transform: scaleX(1); }
.product-card-inner {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    flex: 1;
}
.product-logo-wrap--img { background: transparent; align-items: flex-start; }
.product-logo-img { height: 36px; width: auto; object-fit: contain; }
.product-initial {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--p-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; font-weight: 700;
}
.product-name {
    font-size: 1.0625rem; font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: .25rem;
}
.product-desc {
    font-size: .875rem;
    color: var(--c-text-2);
    line-height: 1.55;
}
.product-cta {
    margin-top: .5rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--p-ink, var(--p-primary));
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM
   ═══════════════════════════════════════════════════════════════════════════ */
.form-main { flex: 1; padding: 2rem 1.5rem 4rem; }
.form-container { max-width: 640px; margin: 0 auto; }
.form-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border-lt);
    border-radius: var(--r-xl);
    box-shadow: var(--sh);
    padding: 2rem;
}
.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.03em;
    margin-bottom: .5rem;
}
.form-subtitle {
    font-size: .9375rem;
    color: var(--c-text-2);
    margin-bottom: 1.75rem;
}
.form-group { margin-bottom: 1.125rem; }
label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: .375rem;
}
.req-star { color: var(--c-error); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: .625rem .8125rem;
    border: 1.5px solid var(--c-border);
    border-radius: var(--r-sm);
    background: var(--c-surface);
    color: var(--c-text);
    font: inherit;
    font-size: .9375rem;
    transition: border-color var(--t), box-shadow var(--t);
}
.form-control:focus {
    outline: none;
    border-color: var(--p-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-primary) 18%, transparent);
}
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: calc(100% - 14px) center;
    padding-right: 38px;
}

.checkbox-group { display: flex; flex-direction: column; gap: .5rem; padding: .25rem 0; }
.checkbox-row {
    display: flex; align-items: center; gap: .625rem;
    padding: .5rem .75rem;
    background: var(--c-surface-alt);
    border: 1px solid var(--c-border-lt);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all var(--t);
}
.checkbox-row:hover { border-color: var(--p-primary); }
.checkbox-row input[type=checkbox] {
    width: 18px; height: 18px;
    accent-color: var(--p-primary);
    cursor: pointer;
}
.checkbox-row span { font-size: .9375rem; }

.form-actions {
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    margin-top: 1.75rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    padding: .625rem 1.25rem;
    border: 1.5px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--c-text);
    font: inherit;
    font-size: .9375rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--t);
}
.btn-primary {
    background: var(--p-primary);
    border-color: var(--p-primary);
    color: var(--p-text);
}
.btn-primary:hover { background: var(--p-hover); border-color: var(--p-hover); }
.btn-ghost { color: var(--c-text-2); }
.btn-ghost:hover { background: var(--c-muted-bg); color: var(--c-text); }
.btn-secondary { background: #fff; border-color: var(--c-border); }
.btn-secondary:hover { border-color: var(--p-primary); color: var(--p-ink, var(--p-primary)); }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }

.flash {
    padding: .75rem 1rem;
    border-radius: var(--r-sm);
    font-size: .875rem;
    margin-bottom: 1rem;
}
.flash-error { background: var(--c-error-bg); color: var(--c-error); border: 1px solid color-mix(in srgb, var(--c-error) 25%, transparent); }
.flash-success { background: var(--c-success-bg); color: var(--c-success); border: 1px solid color-mix(in srgb, var(--c-success) 25%, transparent); }

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.site-footer {
    background: #fafafa;
    border-top: 1px solid var(--c-border-lt);
    padding: 1.25rem 1.5rem;
    margin-top: auto;
}
.footer-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: .8125rem;
    color: var(--c-text-2);
}
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--c-text-2); text-decoration: none; }
.footer-links a:hover { color: var(--c-text); }

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN
   ═══════════════════════════════════════════════════════════════════════════ */
.admin-body { background: var(--c-bg); }
.admin-header {
    background: #fff;
    border-bottom: 1px solid var(--c-border-lt);
    padding: 0 1.5rem;
}
.admin-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.admin-brand { display: flex; align-items: center; gap: .625rem; text-decoration: none; color: var(--c-text); font-weight: 700; }
.admin-brand img { height: 36px; }
.admin-nav { display: flex; gap: 1rem; align-items: center; }
.admin-nav a {
    font-size: .875rem; font-weight: 500;
    color: var(--c-text-2); text-decoration: none;
    padding: .5rem .75rem;
    border-radius: 6px;
    transition: all var(--t);
}
.admin-nav a:hover { color: var(--c-text); background: var(--c-muted-bg); }
.admin-nav a.active { color: #1d1d1f; background: #f2f2f7; }
.admin-nav .admin-logout { color: var(--c-error); }

.admin-main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-table-wrap {
    background: #fff;
    border: 1px solid var(--c-border-lt);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td {
    padding: .875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--c-border-lt);
    font-size: .875rem;
}
.admin-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-text-3); background: #fafafa; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafafa; }

.product-badge {
    display: inline-block;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 100px;
    background: var(--p-light);
    color: var(--p-ink, var(--p-primary));
}

.login-card {
    max-width: 380px;
    width: 100%;
    background: #fff;
    border: 1px solid var(--c-border-lt);
    border-radius: var(--r-xl);
    padding: 2.25rem 2.25rem 1.875rem;
    box-shadow: var(--sh);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL (Bestaetigungs-Dialog)
   ═══════════════════════════════════════════════════════════════════════════ */
.modal {
    position: fixed; inset: 0;
    background: rgba(20,20,20,.45);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}
.modal.open { display: flex; animation: modalFade .15s ease; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    max-width: 440px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-title { font-size: 1.0625rem; font-weight: 700; margin-bottom: .375rem; }
.modal-text  { font-size: .9375rem; color: var(--c-text-2); margin-bottom: 1.25rem; line-height: 1.5; }
.modal-actions { display: flex; gap: .625rem; justify-content: flex-end; }
.btn-danger { background: var(--c-error); border-color: var(--c-error); color: #fff; }
.btn-danger:hover { background: #cc1f17; border-color: #cc1f17; }

/* ═══════════════════════════════════════════════════════════════════════════
   HTML-EDITOR (WYSIWYG)
   ═══════════════════════════════════════════════════════════════════════════ */
.rt {
    border: 1.5px solid var(--c-border);
    border-radius: var(--r-sm);
    overflow: hidden;
    background: #fff;
}
.rt:focus-within { border-color: var(--p-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-primary) 18%, transparent); }
.rt-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: var(--c-surface-alt);
    border-bottom: 1px solid var(--c-border-lt);
    flex-wrap: wrap;
}
.rt-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--c-text);
    padding: 4px 9px;
    font-size: .8125rem;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--t), border-color var(--t);
    min-width: 28px;
}
.rt-btn:hover { background: #fff; border-color: var(--c-border-lt); }
.rt-sep { display: inline-block; width: 1px; height: 18px; background: var(--c-border-lt); margin: 0 4px; }
.rt-content {
    min-height: 180px;
    padding: 12px 14px;
    font-size: .9375rem;
    line-height: 1.55;
    outline: none;
}
.rt-content:focus { outline: none; }
.rt-content > *:first-child { margin-top: 0; }
.rt-content h2 { font-size: 1.125rem; font-weight: 700; margin: .75rem 0 .5rem; }
.rt-content h3 { font-size: 1rem; font-weight: 700; margin: .625rem 0 .375rem; }
.rt-content p  { margin: .375rem 0; }
.rt-content ul, .rt-content ol { margin: .375rem 0 .375rem 1.25rem; }
.rt-content a  { color: var(--p-ink, var(--p-primary)); text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
@media (max-width: 560px) {
    .landing-title { font-size: 1.625rem; }
    .form-card { padding: 1.5rem 1.25rem; }
    .header-inner { min-height: 60px; }
    .form-actions { flex-direction: column-reverse; gap: .5rem; }
    .form-actions .btn { width: 100%; }
}
