/*
 * myaccount.css
 *
 * UI-Core Styles für Login, Registrierung, MyAccount, Profil, Rechnungen
 * und die mobile MyAccount-Tab-Navigation.
 *
 * Bereinigt:
 * - alte mobile Sidebar-Drawer-Regeln entfernt
 * - globale Header-Nutzung berücksichtigt
 * - bestehende Formular-/Rechnungs-/Profil-Styles beibehalten
 */

.myaccount-page {
    max-width: 1180px;
    margin: 34px auto 70px;
    padding: 0 20px;
}

.myaccount-auth-page {
    max-width: 560px;
    margin: 40px auto 70px;
    padding: 0 20px;
}

.myaccount-card {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.06);
}

.myaccount-card h1 {
    margin: 0 0 10px;
    font-size: 28px;
}

.myaccount-subtitle {
    color: #666;
    margin-bottom: 24px;
    line-height: 1.55;
}

.myaccount-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

.myaccount-sidebar {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 18px;
    padding: 20px;
    height: fit-content;
    box-shadow: 0 10px 24px rgba(0,0,0,0.05);
    position: sticky;
    top: 20px;
}

.myaccount-sidebar h3 {
    margin-top: 0;
    margin-bottom: 16px;
}

.myaccount-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.myaccount-menu a {
    text-decoration: none;
    color: #111;
    padding: 12px 14px;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.myaccount-menu a:hover,
.myaccount-menu a.active {
    background: #f5f5f5;
    font-weight: 600;
}

.myaccount-content {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.05);
}

.myaccount-form {
    display: flex;
    flex-direction: column;
    /*gap: 14px;*/
}

.myaccount-form label {
    font-weight: 600;
    font-size: 14px;
}

.myaccount-form input[type="email"],
.myaccount-form input[type="password"],
.myaccount-form input[type="text"],
.myaccount-form input[type="tel"] {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 15px;
    box-sizing: border-box;
}

.myaccount-form input:focus {
    outline: none;
    border-color: #111;
}

.myaccount-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: #333;
}

.myaccount-checkbox input {
    margin-top: 3px;
}

.myaccount-btn {
    margin-top: 8px;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: #111;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.myaccount-btn:hover {
    background: #333;
}

.myaccount-link-row {
    margin-top: 18px;
    text-align: center;
}

.myaccount-link-row a {
    color: #111;
}

.myaccount-message-error {
    background: #fff4f4;
    border: 1px solid #f1caca;
    color: #a11a1a;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.myaccount-message-success {
    background: #f3fff5;
    border: 1px solid #cfe8d2;
    color: #176329;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.myaccount-user-box {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 14px;
    background: #fafafa;
    border: 1px solid #efefef;
}

.myaccount-user-box strong {
    display: block;
    margin-bottom: 6px;
}

.myaccount-secondary-btn {
    margin-top: 10px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: #111;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.myaccount-secondary-btn:hover {
    background: #333;
    border-color: #bbb;
}

.myaccount-resend-form {
    margin-top: 10px;
}

.profile-section {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.05);
}

.profile-section h1,
.profile-section h2 {
    margin-top: 0;
    margin-bottom: 18px;
}

.profile-item {
    padding: 18px 0;
    border-bottom: 1px solid #f0f0f0;
}

.profile-item:last-child {
    border-bottom: none;
}

.profile-label {
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-value {
    font-size: 16px;
    color: #111;
    margin-bottom: 8px;
}

.profile-hint {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    max-width: 700px;
    line-height: 1.5;
}

.profile-edit-btn {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-weight: 600;
}

.profile-edit-btn:hover {
    background: #f7f7f7;
}

.profile-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.profile-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.profile-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.legal-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.legal-row:last-child {
    border-bottom: none;
}

.consent-item {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    padding: 18px 0;
    border-bottom: 1px solid #f0f0f0;
}

.consent-item:last-child {
    border-bottom: none;
}

.consent-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}

.consent-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.consent-switch span {
    position: absolute;
    inset: 0;
    background: #d8d8d8;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.consent-switch span::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 4px;
    top: 4px;
    border-radius: 50%;
    background: white;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.consent-switch input:checked + span {
    background: #111;
}

.consent-switch input:checked + span::before {
    transform: translateX(22px);
}

.cookie-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cookie-overlay.hidden {
    display: none;
}

.cookie-modal {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.18);
}

.cookie-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.cookie-modal-header h3 {
    margin: 0;
}

.cookie-close {
    border: none;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.cookie-banner-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.myaccount-link-row-left {
    text-align: left;
    /* margin-top: -4px; */
    margin-bottom: 4px;
}

@media (max-width: 900px) {
    .myaccount-grid {
        grid-template-columns: 1fr;
    }

    .myaccount-sidebar {
        position: static;
    }

    .profile-grid-2,
    .profile-grid-3 {
        grid-template-columns: 1fr;
    }

    .consent-item,
    .legal-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================================================
   Profilformular: Fehlermeldungen und fehlerhafte Felder
   ========================================================= */

.field-error {
    min-height: 18px;
    margin-top: 6px;
    font-size: 13px;
    color: #b42318;
    line-height: 1.4;
}

.input-error {
    border-color: #d92d20 !important;
    background: #fff7f7;
}

/* Kundennummer-Box etwas sauberer hervorheben */
.profile-static-box {
    margin-bottom: 24px;
}

/* Formulargitter für 2er und 3er Spalten */
.profile-grid {
    display: grid;
    gap: 16px;
}

.profile-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Mobile Anpassung */
@media (max-width: 768px) {
    .profile-grid-2,
    .profile-grid-3 {
        grid-template-columns: 1fr;
    }
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 48px;
}

.toggle-password-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.toggle-password-btn svg {
    width: 20px;
    height: 20px;
    fill: #555;
}

.toggle-password-btn:hover svg {
    fill: #000;
}

.hidden {
    display: none;
}

#passwordFormError {
    margin-bottom: 4px;
}

#passwordFormSuccess {
    margin-bottom: 12px;
}


/* =========================================================
   Zentrale Formular-Meldungen innerhalb des jeweiligen Forms
   ========================================================= */

.form-message-center {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.form-message {
    width: 100%;
    max-width: 720px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 10px 24px rgba(0,0,0,0.04);
}

.form-message-error {
    background: linear-gradient(180deg, #fff8f8 0%, #fff4f4 100%);
    border-color: #f1caca;
    color: #a11a1a;
}

.form-message-success {
    background: linear-gradient(180deg, #f7fff8 0%, #f2fff4 100%);
    border-color: #cfe8d2;
    color: #176329;
}

.password-form-message {
    width: 100%;
    max-width: 720px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 10px 24px rgba(0,0,0,0.04);
}

.password-form-message-error {
    background: linear-gradient(180deg, #fff8f8 0%, #fff4f4 100%);
    border-color: #f1caca;
    color: #a11a1a;
}

.password-form-message-success {
    background: linear-gradient(180deg, #f7fff8 0%, #f2fff4 100%);
    border-color: #cfe8d2;
    color: #176329;
}

.hidden {
    display: none !important;
}

/* =========================================================
   MyAccount: globaler Header + mobile Tabs
   ========================================================= */

/*
 * Alte Spezial-Header/Drawer-Elemente werden nicht mehr verwendet.
 * Falls ältere Templates diese Klassen noch enthalten, stören sie nicht.
 */
.myaccount-mobile-topbar,
.myaccount-sidebar-overlay,
.myaccount-sidebar-mobile-head,
.myaccount-sidebar-close {
    display: none !important;
}

/*
 * Falls alte Templates noch einen Wrapper um den Header haben:
 * Der globale Shop-Header bleibt trotzdem sichtbar.
 */
.myaccount-desktop-header {
    display: contents !important;
}

/*
 * Falls ein altes Script body.myaccount-sidebar-open setzt,
 * darf die Seite dadurch nicht mehr blockiert werden.
 */
body.myaccount-sidebar-open {
    overflow: auto !important;
}

/*
 * Logout in der Desktop-Sidebar.
 * Auf Mobile wird dieser Button ausgeblendet, weil Logout im Header-Menü liegt.
 */
.myaccount-sidebar-logout-form {
    margin: 16px 0 0;
}

.myaccount-sidebar-logout-btn {
    width: 100%;
    min-height: 44px;
    border: none;
    border-radius: 14px;
    background: #111;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.myaccount-sidebar-logout-btn:hover {
    background: #333;
}

@media (max-width: 900px) {
    /*
     * Auth-Seiten und normale MyAccount-Seiten bekommen auf Mobile weniger Rand.
     */
    .myaccount-page,
    .myaccount-auth-page {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .myaccount-card {
        padding: 22px 18px;
        border-radius: 16px;
        box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    }

    .myaccount-card h1 {
        font-size: 24px;
    }

    /*
     * MyAccount-Layout wird einspaltig.
     */
    .myaccount-grid {
        display: block;
        width: 100%;
        margin: 0;
    }

    /*
     * Die Desktop-Sidebar wird auf Mobile zur horizontalen Tab-Leiste.
     */
    .myaccount-sidebar {
        position: sticky !important;
        top: 0;
        z-index: 2000;
        width: auto !important;
        height: auto !important;
        transform: none !important;
        border: none;
        border-radius: 0;
        padding: 10px 12px;
        background: #fff;
        box-shadow: 0 1px 0 #eee;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .myaccount-menu {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        width: max-content;
        min-width: 100%;
    }

    .myaccount-sidebar-section {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .myaccount-sidebar h3,
    .myaccount-sidebar-section h3 {
        display: none;
    }

    .myaccount-menu a {
        flex: 0 0 auto;
        min-height: 40px;
        padding: 0 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #eee;
        border-radius: 999px;
        background: #fff;
        color: #111;
        text-decoration: none;
        white-space: nowrap;
        font-size: 14px;
        font-weight: 800;
    }

    .myaccount-menu a.active {
        border-color: #111;
        background: #111;
        color: #fff;
    }

    /*
     * Mobile Logout bleibt im globalen Header-Menü.
     */
    .myaccount-sidebar-logout-form {
        display: none;
    }

    .myaccount-content {
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 24px 16px 40px;
        box-shadow: none;
    }

    .myaccount-content h1 {
        font-size: clamp(32px, 9vw, 48px);
        line-height: 1.05;
        margin-top: 10px;
    }

    .profile-section {
        border: 1px solid #ececec;
        border-radius: 18px;
        padding: 20px 18px;
        margin-bottom: 16px;
        box-shadow: 0 6px 16px rgba(0,0,0,0.04);
    }

    .profile-section h1,
    .profile-section h2 {
        margin-bottom: 14px;
        font-size: 18px;
        line-height: 1.3;
    }

    .profile-item {
        padding: 14px 0;
    }

    .profile-value {
        font-size: 15px;
    }

    .myaccount-form {
        gap: 8px;
    }

    .myaccount-form input[type="email"],
    .myaccount-form input[type="password"],
    .myaccount-form input[type="text"],
    .myaccount-form input[type="tel"] {
        font-size: 16px;
    }

    .myaccount-btn,
    .myaccount-secondary-btn {
        width: 100%;
    }

    .form-message,
    .password-form-message {
        max-width: 100%;
    }
}

/* =========================================================
   Rechnungen
   ========================================================= */

.invoice-empty-box {
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 14px;
    padding: 20px;
    color: #666;
}

.invoice-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.invoice-list-card {
    display: grid;
    grid-template-columns: 90px 84px minmax(0, 1fr) 24px;
    gap: 16px;
    align-items: center;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 16px;
    padding: 16px;
    text-decoration: none;
    color: #111;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.invoice-list-card:hover {
    box-shadow: 0 10px 24px rgba(0,0,0,0.07);
    transform: translateY(-1px);
}

.invoice-list-price {
    font-weight: 700;
    white-space: nowrap;
}

.invoice-list-image-wrap {
    width: 70px;
    height: 82px;
}

.invoice-list-image {
    width: 70px;
    height: 82px;
    object-fit: cover;
    border-radius: 10px;
    background: #f4f4f4;
}

.invoice-list-body {
    min-width: 0;
}

.invoice-status {
    display: inline-flex;
    width: fit-content;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.invoice-status.PAID {
    background: #eef7ee;
    color: #176329;
}

.invoice-status.OPEN {
    background: #fff5e6;
    color: #9a6400;
}

.invoice-product-name {
    font-weight: 700;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

.invoice-seller {
    margin-top: 6px;
    color: #666;
    font-size: 13px;
}

.invoice-list-arrow {
    font-size: 24px;
    color: #333;
}

.invoice-back-link {
    display: inline-block;
    color: #111;
    text-decoration: none;
    margin-bottom: 18px;
    font-weight: 600;
}

.invoice-back-link:hover {
    text-decoration: underline;
}

.invoice-detail-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    border-bottom: 1px solid #ececec;
    padding-bottom: 22px;
    margin-bottom: 22px;
}

.invoice-detail-header h1 {
    margin: 0 0 8px;
}

.invoice-pdf-btn {
    margin-top: 0;
    text-align: center;
}

.invoice-detail-section {
    border-top: 1px solid #ececec;
    padding-top: 22px;
    margin-top: 22px;
}

.invoice-detail-section h2 {
    margin: 0 0 16px;
}

.invoice-detail-item {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) 90px;
    gap: 14px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
}

.invoice-detail-item:last-child {
    border-bottom: none;
}

.invoice-detail-image-wrap {
    width: 64px;
    height: 76px;
    display: block;
}

.invoice-detail-image {
    width: 64px;
    height: 76px;
    object-fit: cover;
    border-radius: 10px;
    background: #f4f4f4;
}

.invoice-detail-product-name {
    color: #111;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 6px;
}

.invoice-detail-product-name:hover {
    text-decoration: underline;
}

.invoice-detail-price {
    text-align: right;
    font-weight: 700;
}

.invoice-summary-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 20px;
    margin-bottom: 10px;
}

.invoice-document-link {
    display: inline-flex;
    align-items: center;
    padding: 12px 14px;
    background: #f3f3f3;
    color: #111;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
}

.invoice-document-link:hover {
    background: #eaeaea;
}

@media (max-width: 720px) {
    .invoice-list-card {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .invoice-list-image-wrap,
    .invoice-list-image {
        width: 100%;
        height: 180px;
    }

    .invoice-list-arrow {
        display: none;
    }

    .invoice-detail-header {
        flex-direction: column;
    }

    .invoice-detail-item {
        grid-template-columns: 1fr;
    }

    .invoice-detail-image-wrap,
    .invoice-detail-image {
        width: 100%;
        height: 180px;
    }

    .invoice-detail-price {
        text-align: left;
    }

    .invoice-summary-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.myaccount-seller-box {
    margin-top: 24px;
    padding: 22px;
    border-radius: 16px;
    background: #f7f7f7;
}

.myaccount-seller-box h2 {
    margin-top: 0;
}