/* ADMIN-BEREICH: PREMIUM ROW-CARD DESIGN */

:root {
    --admin-surface: #ffffff;
    --admin-bg: #f8fafc;
    --admin-text: #0f172a;
    --admin-muted: #64748b;
    --admin-accent: #0166B1;
    --admin-line: #e2e8f0;
    --admin-radius: 12px;
}

.admin-card {
    background: var(--admin-surface);
    width: 95%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: var(--admin-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    border: 1px solid var(--admin-line);
    box-sizing: border-box;
}

/* TABS */
.admin-tabs { display: flex; gap: 1rem; margin-bottom: 2rem; border-bottom: 1px solid var(--admin-line); padding-bottom: 1rem; }
.tab-btn { padding: 0.75rem 1.5rem; border: none; background: transparent; cursor: pointer; font-weight: 700; color: var(--admin-muted); border-radius: 8px; transition: all 0.2s; text-align: left; }
.tab-btn.active { background: #f0f7ff; color: var(--admin-accent); }
.tab-eyebrow { display: block; font-size: 0.65rem; text-transform: uppercase; margin-bottom: 2px; }
.tab-label { display: block; font-size: 1rem; }
.tab-label-row { display: flex; align-items: center; gap: 0.55rem; }
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}

/* MESSAGES */
.success, .error { display: none; padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-weight: 600; font-size: 0.9rem; text-align: center; }
.success { background: #f0fdf4; color: #16a34a; border: 1px solid #dcfce7; }
.error { background: #fef2f2; color: #ef4444; border: 1px solid #fee2e2; }

/* CLUB GROUPS */
.club-group { margin-bottom: 3rem; background: var(--admin-bg); padding: 1.5rem; border-radius: 16px; border: 1px solid var(--admin-line); }
.evaluation-search-shell {
    margin-bottom: 1.5rem;
    padding: 1.1rem;
    border: 1px solid var(--admin-line);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.evaluation-search-input {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid var(--admin-line);
    border-radius: 12px;
    background: #ffffff;
    color: var(--admin-text);
    font-size: 1rem;
    box-sizing: border-box;
}
.evaluation-search-input:focus {
    outline: none;
    border-color: rgba(1, 102, 177, 0.55);
    box-shadow: 0 0 0 4px rgba(1, 102, 177, 0.12);
}
.evaluation-search-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}
.evaluation-search-count {
    color: var(--admin-text);
    font-size: 0.9rem;
    font-weight: 700;
}
.evaluation-search-hint {
    color: var(--admin-muted);
    font-size: 0.82rem;
    text-align: right;
}
.evaluation-search-results {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.95rem;
}
.evaluation-search-card {
    width: 100%;
    border: 1px solid var(--admin-line);
    border-radius: 12px;
    background: #ffffff;
    padding: 0.95rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.evaluation-search-card:hover {
    border-color: rgba(1, 102, 177, 0.35);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}
.evaluation-search-name {
    display: block;
    color: var(--admin-accent);
    font-weight: 800;
    font-size: 1rem;
    text-transform: uppercase;
}
.evaluation-search-meta-line {
    display: block;
    margin-top: 0.2rem;
    color: var(--admin-text);
    font-size: 0.92rem;
    font-weight: 700;
}
.evaluation-search-email {
    display: block;
    margin-top: 0.2rem;
    color: var(--admin-muted);
    font-size: 0.88rem;
}
.user-item.user-item-match {
    border-color: rgba(1, 102, 177, 0.45);
    box-shadow: 0 0 0 4px rgba(1, 102, 177, 0.10);
}
.club-title {
    font-weight: 800; font-size: 1.4rem; color: var(--admin-text);
    padding-bottom: 1rem; margin-bottom: 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer; user-select: none;
}
.club-title::before { content: '▼'; font-size: 0.9rem; margin-right: 12px; color: var(--admin-accent); transition: transform 0.2s; }
.club-group.collapsed .club-title::before { transform: rotate(-90deg); }
.club-group.collapsed .role-group { display: none; }

/* ROLE SECTIONS */
.role-group { margin-bottom: 2rem; }
.role-title {
    font-size: 0.85rem; font-weight: 800; text-transform: uppercase;
    color: var(--admin-muted); margin-bottom: 1rem; padding-left: 4px;
    display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.role-title::before { content: '▼'; font-size: 0.7rem; transition: transform 0.2s; }
.role-group.collapsed .role-title::before { transform: rotate(-90deg); }
.role-group.collapsed .user-item { display: none; }
.role-title::after { content: ''; flex: 1; height: 1px; background: var(--admin-line); }

/* USER CARD */
.user-item {
    background: white; border-radius: 10px; border: 1px solid var(--admin-line);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); margin-bottom: 8px; overflow: hidden;
}

.user-summary {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; cursor: pointer; transition: background 0.2s;
}
.user-summary:hover { background: #fcfdfe; }

.user-name { font-weight: 800; color: var(--admin-accent); font-size: 1.1rem; text-transform: uppercase; }

.user-summary-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 15px;
    min-width: 100px;
    text-align: center;
}

.role-pill {
    background: transparent;
    color: var(--admin-text);
    padding: 0;
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
}
.member-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.member-status-pill.is-active {
    background: #dcfce7;
    color: #166534;
}
.member-status-pill.is-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.user-id-small.mono { color: #94a3b8; font-weight: 700; font-size: 0.9rem; }
.expand-arrow { color: var(--admin-muted); font-size: 0.8rem; transition: transform 0.3s; }

.user-item.expanded .expand-arrow { transform: rotate(180deg); }

/* DETAILS EXPANDED */
.user-details-expanded {
    padding: 1.5rem; border-top: 1px dashed var(--admin-line);
    background: #fafbfc; display: flex; flex-direction: column; gap: 12px;
}

.detail-field { display: flex; flex-direction: column; gap: 2px; }
.detail-field label { font-size: 0.65rem; text-transform: uppercase; color: var(--admin-muted); font-weight: 800; }
.detail-field span { font-weight: 700; color: var(--admin-text); font-size: 1rem; }
.detail-field span.mono { color: var(--admin-accent); }
.role-edit-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.role-edit-field {
    min-width: 220px;
    flex: 1 1 220px;
}
.role-edit-field select {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--admin-line);
    background: #ffffff;
    color: var(--admin-text);
    font-size: 0.95rem;
    font-weight: 700;
}
.role-save-btn {
    border: 1px solid var(--admin-accent);
    background: var(--admin-accent);
    color: #ffffff;
    padding: 0.72rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}
.role-save-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.action-row .btn,
.action-row button {
    width: auto;
    max-width: 100%;
}

.btn-extend {
    background: #0f766e;
    color: #ffffff;
    border: none;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

/* EMPTY STATE */
.user-item.empty-state { background: transparent; border: 1px dashed #cbd5e1; box-shadow: none; padding: 1rem 1.5rem; }
.user-item.empty-state .user-name { color: #94a3b8; }

/* FORMULAR */
.form-group { margin-bottom: 1.25rem; text-align: left; }
.form-group label { display: block; font-size: 0.75rem; text-transform: uppercase; font-weight: 700; color: var(--admin-muted); margin-bottom: 0.5rem; }
.form-group input, .form-group select { width: 100%; padding: 0.8rem; border-radius: 8px; border: 1px solid var(--admin-line); background: #f8fafc; font-size: 1rem; box-sizing: border-box; }
.password-policy-hint {
    margin: -0.45rem 0 1.25rem;
    padding: 0.8rem 0.95rem;
    border-left: 3px solid rgba(1, 102, 177, 0.55);
    background: #f8fafc;
    border-radius: 8px;
}
.consent-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.consent-option {
    display: flex !important;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0 !important;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    background: #f8fafc;
    text-transform: none !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: var(--admin-text) !important;
    line-height: 1.5;
}
.consent-option span {
    flex: 1;
}
.consent-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0.1rem 0 0;
    padding: 0;
    flex: 0 0 18px;
    accent-color: var(--admin-accent);
}
.consent-option a {
    color: var(--admin-accent);
}
.consent-copy {
    font-weight: 400;
    font-size: 0.92rem;
    line-height: 1.6;
}
.consent-copy p {
    margin: 0 0 0.75rem;
}
.consent-copy p:last-child {
    margin-bottom: 0;
}
.legal-modal-trigger {
    color: var(--admin-accent);
    text-decoration: underline;
}
.legal-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
}
.legal-modal[hidden] {
    display: none;
}
.legal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(4px);
}
.legal-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    max-height: min(88vh, 920px);
    overflow: hidden;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.28);
}
.legal-modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.9rem;
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}
.legal-modal-title {
    margin: 0;
    padding: 1.4rem 3.5rem 0.75rem 1.4rem;
    font-size: 1.25rem;
    line-height: 1.3;
    color: #0f172a;
}
.legal-modal-content {
    max-height: calc(min(88vh, 920px) - 72px);
    overflow-y: auto;
    padding: 0 1.4rem 1.4rem;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #334155;
}
.legal-modal-content p {
    margin: 0 0 0.9rem;
}
.legal-modal-content p:last-child {
    margin-bottom: 0;
}
@media (max-width: 600px) {
    .legal-modal {
        align-items: flex-start;
        padding: 1rem;
    }
    .legal-modal-dialog {
        width: 100%;
        max-height: calc(100dvh - 2rem);
        margin: 0 auto;
    }
    .legal-modal-content {
        max-height: calc(100dvh - 7rem);
        -webkit-overflow-scrolling: touch;
    }
}
.admin-card .searchable-select-input {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-color: var(--admin-line);
}
.admin-card .searchable-select-menu {
    border-color: var(--admin-line);
}
.admin-card .searchable-select-option:hover,
.admin-card .searchable-select-option.is-active {
    background: #f0f7ff;
}
.form-submit-row { width: 100%; margin-top: 2rem; }
.admin-card button[type="submit"] { background: var(--admin-accent); color: white; border: none; padding: 1.25rem 2.5rem; border-radius: 8px; font-weight: 700; font-size: 1.2rem; cursor: pointer; width: 100%; max-width: 400px; margin: 2rem auto 0 auto; display: block; transition: transform 0.2s ease; }
.admin-card button[type="submit"]:active { transform: scale(0.98); }
.back-link { display: inline-block; margin-top: 2rem; color: var(--admin-muted); text-decoration: none; font-size: 0.9rem; font-weight: 600; }

@media (min-width: 1024px) {
    #create-user-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 1.5rem;
        row-gap: 0;
        align-items: end;
    }
    .form-submit-row {
        grid-column: 2;
        width: 100%;
        margin-top: 0;
    }
    .password-policy-hint {
        grid-column: 1 / -1;
    }
    #registration-consent-group {
        grid-column: 1 / -1;
    }
    .admin-card button[type="submit"] {
        width: 100%;
        max-width: none;
        margin: 0;
    }
}
@media (max-width: 600px) {
    .admin-card {
        width: calc(100% - 1rem);
        margin: 0.5rem auto;
        padding: 1rem;
    }
    .club-group {
        padding: 1rem;
    }
    .admin-tabs {
        flex-direction: column;
        gap: 0.65rem;
        padding-bottom: 0.85rem;
    }
    .tab-btn {
        width: 100%;
        padding: 0.9rem 1rem;
    }
    #evaluation-section > div:first-child {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.85rem;
        margin-bottom: 1rem !important;
    }
    #evaluation-section > div:first-child h1 {
        margin: 0;
    }
    #export-excel-btn {
        width: 100% !important;
    }
    .club-title {
        font-size: 1.05rem;
        gap: 0.75rem;
        align-items: flex-start;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }
    .user-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 0.9rem 1rem;
    }
    .user-name {
        width: 100%;
        font-size: 0.98rem;
        line-height: 1.25;
        text-transform: none;
        overflow-wrap: anywhere;
    }
    .user-summary-info {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        align-items: flex-start;
        margin-left: 0;
        margin-right: 0;
        text-align: left;
        gap: 0.45rem;
        min-width: 0;
    }
    .member-status-pill,
    .role-pill,
    .user-id-small.mono {
        justify-self: flex-start;
    }
    .user-id-small.mono {
        font-size: 0.82rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .member-status-pill,
    .role-pill {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .expand-arrow {
        align-self: flex-end;
    }
    .user-details-expanded {
        padding: 1rem;
    }
    .detail-field span {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .role-edit-row {
        flex-direction: column;
        align-items: stretch;
    }
    .role-edit-field {
        min-width: 0;
        width: 100%;
    }
    .role-save-btn {
        width: 100%;
    }
    .action-row {
        flex-direction: column;
        align-items: stretch;
    }
    .action-row .btn,
    .action-row button {
        width: 100%;
    }
    .evaluation-search-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    .evaluation-search-hint {
        text-align: left;
    }
    .evaluation-search-card {
        padding: 0.9rem;
    }
    .evaluation-search-name,
    .evaluation-search-meta-line,
    .evaluation-search-email {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}
