/* 
   CUSTOM FONTS 
   Place your .woff2 files in src/main/resources/static/fonts/
*/
@font-face {
    font-family: 'BMWGroup-Regular';
    src: url('../fonts/BMWGroupTNPro-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #0166B1;
    --accent-dark: #004d85;
    --line: #e2e8f0;
    --danger: #ef4444;
    --radius: 16px;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Font Stack - Exclusive use of the BMW font */
    --font-ui: 'BMWGroup-Regular', sans-serif;
    --font-mono: 'BMWGroup-Regular', monospace;
}

* {
    font-family: var(--font-ui);
}

body {
    font-family: var(--font-ui);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    background-color: #f1f5f9;
    padding: 16px;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.page-dashboard {
    background: radial-gradient(circle at top left, #e2e8f0, transparent 40%),
                radial-gradient(circle at bottom right, #cbd5e1, transparent 40%),
                #f1f5f9;
}

.lang-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1200;
    display: flex;
    gap: 0.45rem;
    padding: 0.3rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(10px);
}

.lang-switch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.lang-switch-btn:hover {
    background: #eaf4ff;
    color: var(--accent);
    transform: translateY(-1px);
}

.lang-switch-btn.is-active {
    background: var(--accent);
    color: #ffffff;
}

/* ID-CARD BASIS */
.id-card {
    background: var(--surface);
    width: 100%;
    max-width: 550px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    padding: 1.5rem;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* LAYOUT GRID - Standard Mobile */
.id-layout-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* PROFIL HEADER */
.id-profile-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.id-image-section {
    flex: 0 0 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.profile-img-container {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f1f5f9;
    border: 1px solid var(--line);
}

.profile-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.id-names-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.id-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 2px;
}

.id-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.id-value.big-name {
    font-size: 1.3rem;
    line-height: 1.2;
}

/* DETAILS SECTION */
.id-details-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    text-align: left;
    margin-top: 1.5rem;
}

.id-data-block {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--surface-soft);
    padding-bottom: 0.5rem;
}

.id-inline-action-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    margin-top: 0.2rem;
}

.id-inline-action-row-stacked {
    margin-top: 0;
    margin-bottom: 0.55rem;
}

.id-inline-edit-btn {
    background-color: var(--accent);
    color: #ffffff;
    border: 1px solid var(--accent);
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.75rem;
    min-height: 30px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
}

.id-inline-edit-btn:hover {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
}

.id-details-section .id-value {
    font-size: 1.15rem;
    word-break: break-word; /* Verhindert Überlaufen bei langen Clubs */
}

.id-value.mono {
    font-family: var(--font-mono);
    color: var(--accent);
    letter-spacing: 0.05em;
    padding: 0;
    background: transparent;
    display: inline-block;
    margin-top: 4px;
}

/* QR AREA */
.id-qr-area {
    border-top: 1px dashed var(--line);
    padding-top: 2rem;
    text-align: center;
    background: linear-gradient(to bottom, transparent, var(--surface-soft));
    border-radius: 0 0 var(--radius) var(--radius);
    margin: 0 -1.5rem -1.5rem -1.5rem;
    padding-bottom: 1.5rem;
}

/* MOBILE OPTIMIZATION (Up to 600px) */
@media (max-width: 600px) {
    .id-card {
        padding: 1.25rem;
    }

    .id-profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .id-names-section {
        width: 100%;
    }

    .id-value.big-name {
        font-size: 1.5rem;
    }

    .id-data-block {
        align-items: flex-start;
    }

    .id-inline-action-row {
        align-items: center;
        gap: 0.6rem;
    }

    .id-qr-area {
        margin-top: 1rem;
    }
    
    .qr-container img {
        width: 180px;
        height: 180px;
    }
}

.qr-container {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    display: inline-block;
    border: 1px solid var(--line);
}

.qr-container img {
    width: 160px;
    height: 160px;
    display: block;
    cursor: pointer;
}

.qr-progress-container {
    width: 100%;
    height: 4px;
    background-color: #f1f5f9;
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.qr-progress-bar {
    height: 100%;
    width: 100%;
    background-color: var(--accent);
    transition: width 0.1s linear;
}

.modal-progress {
    max-width: 600px;
    margin: 0 auto 20px auto;
}

.qr-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.id-vorderseite-container {
    margin-top: 1.5rem;
    width: 100%;
    text-align: center;
}

.id-vorderseite-img {
    width: 100%;
    max-width: 320px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.logout-container-inline {
    margin-top: 1rem;
}

/* GLOBAL ACTIONS (Bottom) */
.id-global-actions {
    border-top: 1px solid var(--line);
    padding-top: 1.25rem;
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Increased from 1rem */
}

/* BUTTONS */
.btn {
    display: inline-block;
    width: 100%;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.btn-primary { background-color: var(--accent); color: white; }
.btn-secondary { background-color: #f1f5f9; color: #475569; border: 1px solid var(--line); }
.btn-outline-danger { background: transparent; color: var(--danger); border: 1px solid #fee2e2; }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; width: auto; }

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrap input {
    padding-right: 3.2rem;
}

.password-toggle {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex: 0 0 2rem;
    z-index: 2;
}

.password-toggle:hover {
    color: var(--accent);
    background: transparent;
}

.password-toggle:active {
    transform: translateY(-50%);
}

.password-toggle svg {
    width: 1.2rem;
    height: 1.2rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* DESKTOP UPGRADE */
@media (min-width: 1024px) {
    .id-card {
        max-width: 1000px;
        width: 85%;
        padding: 3rem;
    }

    .id-layout-grid {
        flex-direction: row;
        gap: 4rem;
    }

    .id-left-column {
        flex: 1.2;
    }

    .id-right-column {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        border-left: 1px dashed var(--line);
        padding-left: 4rem;
    }

    .id-image-section {
        flex: 0 0 220px;
    }

    .profile-img-container {
        width: 220px;
        height: 220px;
    }

    .id-qr-area {
        border-top: none;
        padding-top: 0;
        margin-top: -1rem;
    }

    .qr-container img {
        width: 220px;
        height: 220px;
    }

    .id-global-actions {
        flex-direction: row;
        max-width: none;
        gap: 1.5rem;
    }
}

/* LOGIN */
.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px;
}

.login-container {
    background: var(--surface);
    padding: 3rem 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.login-logo-container {
    width: 100%;
    text-align: center;
    margin-bottom: 2rem;
}

.login-signet {
    max-width: 220px;
    height: auto;
    object-fit: contain;
}

.page-login input { width: 100%; padding: 1rem; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 1.5rem; box-sizing: border-box; background-color: var(--surface-soft); font-size: 1rem; }
.page-login .password-input-wrap {
    margin-bottom: 1.5rem;
}

.page-login .password-input-wrap input {
    margin-bottom: 0;
}

.page-login button { background-color: var(--accent); color: white; padding: 1rem; width: 100%; border-radius: 8px; border: none; font-weight: 700; font-size: 1.1rem; cursor: pointer; transition: transform 0.2s; }
.page-login .lang-switch-btn { width: auto; }
.page-login button:hover { background-color: var(--accent-dark); }
.page-login button:active { transform: scale(0.98); }
.page-login .password-toggle {
    width: 2rem;
    min-width: 2rem;
    padding: 0;
    margin: 0;
    background: transparent;
    color: #64748b;
    border-radius: 999px;
    flex: 0 0 2rem;
}

.page-login .password-toggle:hover {
    background: transparent;
    color: var(--accent);
}

.page-login .password-toggle:active {
    transform: translateY(-50%);
}
.btn-register-link {
    margin-top: 0.9rem;
    background-color: #f1f5f9;
    color: var(--accent);
    border: 1px solid var(--line);
}
.btn-register-link:hover {
    background-color: #e2e8f0;
}

/* MODAL */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.98); 
    display: none;
    align-items: center; 
    justify-content: center; 
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Zoomed Card State */
.id-card.zoomed {
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
    border: 2px solid var(--line);
    transform: scale(1.05);
    margin-bottom: 20px;
}

/* Modal UI Elements */
.modal-content img#modal-img {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    image-rendering: pixelated; 
}

.modal-close-area {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.id-card-zoom-trigger {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.id-card-zoom-trigger:hover {
    transform: translateY(-2px);
}

.id-card-zoom-trigger button, 
.id-card-zoom-trigger input,
.id-card-zoom-trigger a {
    cursor: pointer; /* Buttons etc. sollen normal bleiben */
}

.visually-hidden-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.error {
    background-color: #fef2f2; color: var(--danger); padding: 0.75rem;
    border-radius: 8px; border: 1px solid #fee2e2; font-size: 0.85rem;
    font-weight: 600; margin-bottom: 1.5rem; display: none;
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    font-size: 1rem;
    box-sizing: border-box;
}

.modal-actions {
    width: 100%;
    display: flex;
    gap: 0.9rem;
    margin-top: 0.5rem;
}

.modal-actions .btn {
    flex: 1;
}

.modal-title {
    margin: 0;
    color: var(--text-main);
    font-size: 1.45rem;
    font-weight: 800;
}

.modal-hint {
    width: 100%;
    margin: -0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.5;
}
.iti {
    width: 100%;
}

.iti__tel-input {
    width: 100%;
}

.success-msg,
.error-msg {
    width: 100%;
    box-sizing: border-box;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
}

.success-msg {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #dcfce7;
}

.error-msg {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fee2e2;
}

.join-club-row {
    width: 100%;
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 1rem;
    align-items: end;
}

.join-country-group,
.join-club-group {
    margin-bottom: 0;
    width: 100%;
}

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

.join-country-select {
    width: 100%;
    padding: 0.95rem 2.75rem 0.95rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    font-size: 1rem;
    color: var(--text-main);
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--accent) 50%),
        linear-gradient(135deg, var(--accent) 50%, transparent 50%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px),
        0 0;
    background-size:
        6px 6px,
        6px 6px,
        100% 100%;
    background-repeat: no-repeat;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.join-country-select:focus {
    outline: none;
    border-color: rgba(1, 102, 177, 0.55);
    box-shadow: 0 0 0 4px rgba(1, 102, 177, 0.12);
    background-image:
        linear-gradient(45deg, transparent 50%, var(--accent) 50%),
        linear-gradient(135deg, var(--accent) 50%, transparent 50%),
        linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-input {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    font-size: 1rem;
    box-sizing: border-box;
    color: var(--text-main);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.searchable-select-input:focus {
    outline: none;
    border-color: rgba(1, 102, 177, 0.55);
    box-shadow: 0 0 0 4px rgba(1, 102, 177, 0.12);
    background: #ffffff;
}

.searchable-select.is-open .searchable-select-input {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.searchable-select-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(14px);
    z-index: 30;
    padding: 0.4rem;
}

.searchable-select.is-open .searchable-select-menu {
    display: flex;
}

.searchable-select-option,
.searchable-select-empty {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
    box-sizing: border-box;
}

.searchable-select-option {
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.searchable-select-option:hover,
.searchable-select-option.is-active {
    background: #eef6ff;
}

.searchable-select-option-title {
    display: block;
    color: var(--text-main);
    font-weight: 700;
}

.searchable-select-option-meta {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.searchable-select-empty {
    color: var(--text-muted);
    font-size: 0.92rem;
}

@media (max-width: 640px) {
    .modal-actions {
        flex-direction: column;
    }

    .join-club-row {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .edit-contact-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .lang-switch {
        top: 0.75rem;
        right: 0.75rem;
    }
}
