/* ===========================================
   BASIS-LAYOUT ACCOUNT-SEITE
   =========================================== */

.account-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 16px 48px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    color: #111827;
}

/* Kopfbereich */
.account-header h1 {
    font-size: 2.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #2E4F20;
}

.account-subtitle {
    margin: 0;
    font-size: 0.98rem;
    color: #4b5563;
}

/* ===========================================
   TABS
   =========================================== */

.account-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.account-tab {
    border: 1px solid #d1d5db;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ffffff;
    color: #374151;
    font-size: 0.9rem;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
    white-space: nowrap;
}

.account-tab--active {
    background: #2E4F20;
    color: #ffffff;
    border-color: #2E4F20;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.08);
}

/* ===========================================
   CARD / INHALTSBEREICH
   =========================================== */

.account-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px 24px 28px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid #e5e7eb;
    margin-top: 8px;
}

.account-tab-content {
    display: none;
}

.account-tab-content.active {
    display: block;
}

/* ===========================================
   SECTION-TITEL & TEXT
   =========================================== */

.account-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 18px 0 4px;
    color: #111827;
}

.account-text {
    margin: 0 0 14px;
    font-size: 0.92rem;
    color: #6b7280;
}

/* Trennlinie */
.account-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 22px 0 20px;
}

/* ===========================================
   FORMULARELEMENTE (Profil & Auth)
   =========================================== */

/* Generisches Formular-Layout (auch für .form aus älteren Templates) */
.account-form,
.form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field {
    margin-bottom: 12px;
}

.field-inline {
    width: 100%;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: #374151;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 0.92rem;
    color: #111827;
    background: #ffffff;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: #2E4F20;
    box-shadow: 0 0 0 1px rgba(46, 79, 32, 0.18);
    outline: none;
    background: #ffffff;
}

/* kleine Hinweise unter Feldern (z.B. im Login) */
.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.78rem;
    color: #6b7280;
}

/* Fehlermeldungen */
.error {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #b91c1c;
}

/* Messages (Django messages framework) */
.messages {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
}

.messages li {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.messages li.success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.messages li.error,
.messages li.warning {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ===========================================
   KUNDENTYP – RADIO-BUTTONS
   =========================================== */

.customer-type-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-top: 4px;
}

.customer-type-radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    margin-bottom: 0;
}

.customer-type-radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #2E4F20;
    cursor: pointer;
}

/* ===========================================
   BUSINESS-ONLY BLÖCKE
   =========================================== */

.business-only {
    transition: opacity 0.15s ease;
}

/* Sichtbare business-only Bereiche können etwas „sanft“ eingeblendet sein */
.business-only:not([style*="display: none"]) {
    opacity: 1;
}

/* ===========================================
   CHECKBOX: ABWEICHENDE RECHNUNGSADRESSE
   =========================================== */

.billing-toggle {
    margin-top: 12px;
    margin-bottom: 12px;
}

/* Label + Checkbox nebeneinander */
.billing-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #1f2937;
    cursor: pointer;
}

/* Checkbox sichtbar erzwingen */
.billing-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;

    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    opacity: 1 !important;
    position: static !important;
    display: inline-block !important;

    accent-color: #2E4F20;
}

/* Block für Rechnungsadresse (wird per JS/HTMX ein-/ausgeblendet) */
.billing-address-block {
    margin-top: 1rem;
}

/* ===========================================
   BUTTONS (Profil & Auth)
   =========================================== */

.account-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

/* Basis-Button – auch für Login/Passwort-Seiten */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    background: #2E4F20;
    color: #ffffff;
    transition:
        background 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.05s ease;
}

.btn:hover {
    background: #243d19;
    box-shadow: 0 10px 20px rgba(46, 79, 32, 0.25);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(46, 79, 32, 0.18);
}

.btn.btn-secondary {
    background: #ffffff;
    color: #111827;
    border-color: #d1d5db;
    box-shadow: none;
}

.btn.btn-secondary:hover {
    background: #f3f4f6;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}


/* ==========================================================
   PASSWORT ÄNDERN – SEPARATE SEITE
   /konto/passwort-aendern/
========================================================== */

/* schmale, fokussierte Seite */
.auth--narrow {
    max-width: 420px;
}

/* Header */
.auth--narrow .account-header {
    text-align: center;
    margin-bottom: 16px;
}

.auth--narrow .account-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2E4F20;
}

.auth--narrow .account-subtitle {
    font-size: 0.95rem;
    color: #4b5563;
    margin-top: 6px;
}

/* Card */
.auth--narrow .account-card {
    padding: 22px 20px 24px;
}

/* Formular */
.auth--narrow .form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Felder */
.auth--narrow .field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.auth--narrow .field input {
    padding: 11px 12px;
    font-size: 0.95rem;
    border-radius: 10px;
}

/* Passwort-Hinweise */
.auth--narrow .field-hint {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.45;
}

/* Fehler */
.auth--narrow .error {
    font-size: 0.82rem;
    margin-top: 4px;
}

/* Actions */
.auth--narrow .account-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

/* Buttons auf Mobile untereinander */
@media (max-width: 480px) {
    .auth--narrow .account-actions {
        flex-direction: column;
    }

    .auth--narrow .btn {
        width: 100%;
    }
}

/* ==========================================================
   SUCCESS-SEITE: Passwort geändert
========================================================== */

.auth--narrow .account-text {
    text-align: center;
    font-size: 0.95rem;
    color: #374151;
    margin-bottom: 16px;
}

/* ===========================================
   BESTELLUNGEN (Profil-Seite / Orders UI)
   – robust + mobilfreundlich + a11y
   =========================================== */

/* Optionaler Wrapper (empfohlen, wenn Tabelle horizontal scrollen darf) */
.orders-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

/* Fokus-Outline für Wrapper (falls tabindex gesetzt) */
.orders-table-wrap:focus {
    outline: 2px solid rgba(46, 79, 32, 0.35);
    outline-offset: 4px;
}

/* Tabelle */
.orders {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Kopfzeile */
.orders thead {
    background: #f3f4f6;
}

.orders th,
.orders td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

/* bessere Lesbarkeit + sticky head optional */
.orders th {
    font-weight: 700;
    color: #374151;
    font-size: 0.86rem;
    letter-spacing: 0.02em;
}

/* Zebra + Hover (Hover nur wenn Gerät es unterstützt) */
.orders tbody tr:nth-child(even) {
    background: #fcfcfd;
}

@media (hover: hover) and (pointer: fine) {
    .orders tbody tr:hover {
        background: #f9fafb;
    }
}

/* Links */
.orders a {
    color: #2E4F20;
    text-decoration: none;
    font-weight: 600;
}

.orders a:hover {
    text-decoration: underline;
}

.orders a:focus-visible {
    outline: 2px solid rgba(46, 79, 32, 0.35);
    outline-offset: 3px;
    border-radius: 6px;
}

/* Kleine Meta-Zeilen in Zellen */
.order-meta {
    color: #6b7280;
    font-size: 0.82rem;
    margin-top: 6px;
    line-height: 1.35;
}

/* Status-Pill (neutral genug, gute Kontraste) */
.order-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    background: #ecfdf3;
    color: #166534;
    font-weight: 700;
}

/* Optional: unterschiedliche Status-Farben (ohne Systemfarben zu ändern) */
.order-status--pending {
    background: #fff7ed;
    color: #9a3412;
}
.order-status--processing {
    background: #eff6ff;
    color: #1d4ed8;
}
.order-status--shipped {
    background: #ecfdf3;
    color: #166534;
}
.order-status--canceled {
    background: #fef2f2;
    color: #b91c1c;
}

/* Leerer Zustand */
.orders-empty {
    margin-top: 10px;
    font-size: 0.95rem;
    color: #6b7280;
}

/* Buttons im Tabellen-Kontext (Tracking etc.) */
.btn.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
}

/* ===========================================
   AUTH-SEITEN (Login, Register, Reset etc.)
   =========================================== */

/* Falls einige Templates noch <section class="auth"> benutzen */
.auth {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 16px 48px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    color: #111827;
}

.auth--narrow {
    max-width: 420px;
}

.auth h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #2E4F20;
}

.auth-subtitle {
    margin: 0 0 18px;
    font-size: 0.95rem;
    color: #4b5563;
}

/* gleiche Styles wie bei Profil-Formularen – .form wird oben mitgestylt */
.auth .form {
    margin-top: 6px;
}

/* Footer unter Login/Passwort-Formularen */
.auth-footer {
    margin-top: 16px;
    font-size: 0.95rem;
    color: #4b5563;
}

.auth-footer a {
    color: #2E4F20;
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-footer a:focus-visible {
    outline: 2px solid rgba(46, 79, 32, 0.35);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ===========================================
   RESPONSIVE – TABLETS & HANDYS
   =========================================== */

@media (max-width: 1024px) {
    .account-page {
        padding: 28px 16px 40px;
    }

    .account-card {
        padding: 20px 18px 24px;
        border-radius: 14px;
    }
}

@media (max-width: 768px) {
    .account-page {
        padding: 24px 12px 32px;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .account-actions {
        justify-content: flex-start;
    }

    .account-page .btn {
        width: 100%;
        justify-content: center;
    }

    .account-tabs {
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .auth {
        padding: 28px 16px 36px;
    }

    /* Tabelle auf Mobile: lieber scrollen als quetschen */
    .orders {
        font-size: 0.92rem;
        min-width: 720px; /* nur wirksam, wenn in .orders-table-wrap */
    }

    .orders th,
    .orders td {
        padding: 10px 8px;
    }
}

@media (max-width: 640px) {
    .account-page {
        padding: 20px 10px 28px;
    }

    .account-header h1 {
        font-size: 1.6rem;
    }

    .account-card {
        padding: 18px 14px 22px;
        border-radius: 12px;
    }

    .account-tabs {
        font-size: 0.85rem;
    }

    .auth {
        padding: 24px 12px 30px;
    }

    .auth h1 {
        font-size: 1.4rem;
    }
}

/* ===========================================
   A11Y: prefers-reduced-motion
   =========================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
