/* Общи стилове за всички страници */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: #333;
    font-size: 24px;
    margin-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.btn:hover {
    background: #0056b3;
}

.btn-block {
    display: block;
    width: 100%;
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 15px;
}

/* Специфични стилове за страницата за вход */
.login-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.65rem;
    margin-top: 15px;
    font-size: 14px;
    max-width: 100%;
}

/* Споделена тема: профил, вход, регистрация (банер + цветова палитра) */
html:has(body.login-page),
html:has(body.register-page),
html:has(body.forgot-page),
html:has(body.reset-page) {
    overflow-x: hidden;
    max-width: 100%;
}

body.profile-page,
body.login-page,
body.register-page,
body.forgot-page,
body.reset-page {
    --profile-cream: #faf6f2;
    --profile-plum: #5e3a4d;
    --profile-rose: #9a5c72;
    --profile-dusty-rose: #c08497;
    --profile-lavender: #b8a0b8;
    --profile-gold: #c9a962;
    --profile-panel-bg: rgba(255, 252, 250, 0.88);
    --profile-panel-border: rgba(192, 132, 151, 0.45);

    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: var(--profile-plum);
    background-color: var(--profile-cream);
    background-image: var(--profile-bg-url, url("images/baner.png"));
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: scroll;
}

body.profile-page {
    height: 100dvh;
    max-height: 100vh;
    overflow: hidden;
}

body.profile-page::before,
body.login-page::before,
body.register-page::before,
body.forgot-page::before,
body.reset-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(250, 246, 242, 0.5) 0%,
        rgba(255, 252, 250, 0.38) 45%,
        rgba(250, 246, 242, 0.52) 100%
    );
    pointer-events: none;
    z-index: 0;
}

body.profile-page *,
body.profile-page *::before,
body.profile-page *::after,
body.login-page *,
body.login-page *::before,
body.login-page *::after,
body.register-page *,
body.register-page *::before,
body.register-page *::after,
body.forgot-page *,
body.forgot-page *::before,
body.forgot-page *::after,
body.reset-page *,
body.reset-page *::before,
body.reset-page *::after {
    box-sizing: border-box;
}

/* Вход, регистрация, забравена/нова парола — компактна карта върху банера */
body.login-page,
body.register-page,
body.forgot-page,
body.reset-page {
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
    min-height: 100dvh;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-items: safe center;
    justify-content: safe center;
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
        max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
}

body.login-page .auth-container,
body.register-page .auth-container,
body.forgot-page .auth-container,
body.reset-page .auth-container {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: min(380px, 100%);
    max-width: min(380px, calc(100vw - 1.5rem));
    max-height: calc(100dvh - 1.5rem);
    max-height: calc(100svh - 1.5rem);
    margin: auto;
    padding: clamp(0.9rem, 2.5vw, 1.15rem) clamp(0.95rem, 3vw, 1.2rem);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--profile-panel-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--profile-panel-border);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(94, 58, 77, 0.18);
    flex-shrink: 0;
}

body.register-page .auth-container {
    width: min(420px, 100%);
    max-width: min(420px, calc(100vw - 1.5rem));
}

body.register-page {
    align-items: flex-start;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

body.register-page .auth-container form,
body.login-page .auth-container form,
body.forgot-page .auth-container form,
body.reset-page .auth-container form {
    min-width: 0;
    max-width: 100%;
}

body.login-page .auth-header,
body.register-page .auth-header,
body.forgot-page .auth-header,
body.reset-page .auth-header {
    margin-bottom: 0.85rem;
}

body.login-page .auth-header h1,
body.register-page .auth-header h1,
body.forgot-page .auth-header h1,
body.reset-page .auth-header h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--profile-plum);
    line-height: 1.25;
}

body.login-page .form-group,
body.register-page .form-group,
body.forgot-page .form-group,
body.reset-page .form-group {
    margin-bottom: 0.7rem;
}

body.register-page .form-group {
    margin-bottom: 0.55rem;
}

body.login-page .form-group label,
body.register-page .form-group label,
body.forgot-page .form-group label,
body.reset-page .form-group label {
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--profile-rose);
}

body.login-page .form-control,
body.register-page .form-control,
body.forgot-page .form-control,
body.reset-page .form-control {
    width: 100%;
    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
    color: var(--profile-plum);
    border: 1px solid rgba(192, 132, 151, 0.55);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.78);
}

body.login-page .form-control:focus,
body.register-page .form-control:focus,
body.forgot-page .form-control:focus,
body.reset-page .form-control:focus {
    outline: none;
    border-color: var(--profile-dusty-rose);
    box-shadow: 0 0 0 2px rgba(192, 132, 151, 0.35);
}

body.login-page .btn,
body.register-page .btn,
body.forgot-page .btn,
body.reset-page .btn {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--profile-dusty-rose) 0%, var(--profile-rose) 100%);
    border: 1px solid var(--profile-gold);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
}

body.login-page .btn:hover,
body.register-page .btn:hover,
body.forgot-page .btn:hover,
body.reset-page .btn:hover {
    background: linear-gradient(135deg, #b07688 0%, #8a5268 100%);
}

body.login-page .alert,
body.register-page .alert,
body.forgot-page .alert,
body.reset-page .alert {
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
}

body.login-page .alert-success,
body.register-page .alert-success,
body.forgot-page .alert-success,
body.reset-page .alert-success {
    background: rgba(255, 252, 250, 0.92);
    color: #4a6b52;
    border: 1px solid rgba(154, 180, 160, 0.65);
}

body.login-page .alert-error,
body.register-page .alert-error,
body.forgot-page .alert-error,
body.reset-page .alert-error {
    background: rgba(255, 248, 248, 0.92);
    color: #8b3d52;
    border: 1px solid rgba(192, 132, 151, 0.65);
}

body.login-page .login-options {
    margin-top: 0.85rem;
    font-size: 0.82rem;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 0.55rem;
}

@media (max-width: 360px) {
    body.login-page .login-options span {
        display: none;
    }
}

body.login-page .login-options a {
    color: var(--profile-rose);
    text-decoration: none;
    font-weight: 600;
}

body.login-page .login-options a:hover {
    color: var(--profile-plum);
    text-decoration: underline;
}

body.login-page .login-options span {
    color: rgba(94, 58, 77, 0.35);
}

body.register-page .text-center,
body.forgot-page .text-center,
body.reset-page .text-center {
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: var(--profile-plum);
}

body.register-page .text-center a,
body.forgot-page .text-center a,
body.reset-page .text-center a {
    color: var(--profile-rose);
    font-weight: 600;
    text-decoration: none;
}

body.register-page .text-center a:hover,
body.forgot-page .text-center a:hover,
body.reset-page .text-center a:hover {
    color: var(--profile-plum);
    text-decoration: underline;
}

body.forgot-page .auth-header p,
body.reset-page .auth-header p {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--profile-rose);
    line-height: 1.4;
    text-align: center;
}

body.reset-page .auth-header p a {
    color: var(--profile-plum);
    font-weight: 600;
}

body.reset-page .auth-header p a:hover {
    color: var(--profile-rose);
}

/* Select2 — регистрация (без хоризонтално раздуване) */
body.register-page .select2-container {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
}

body.register-page .select2-container--default .select2-selection--single {
    height: 38px;
    border: 1px solid rgba(192, 132, 151, 0.55);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    background: rgba(255, 255, 255, 0.78);
}

body.register-page .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

body.register-page .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    padding-left: 0;
    color: var(--profile-plum);
}

body.register-page .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--profile-dusty-rose);
}

/* Модал: регистрация само за клубове */
#club-only-notice-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
        max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(94, 58, 77, 0.82);
    backdrop-filter: blur(6px);
}

#club-only-notice-overlay[hidden] {
    display: none !important;
}

.club-only-notice-dialog {
    width: min(720px, calc(100vw - 2rem));
    max-width: 100%;
    max-height: min(90dvh, 800px);
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(255, 252, 250, 0.98);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(94, 58, 77, 0.25);
    padding: clamp(1.25rem, 3vw, 2rem);
    text-align: center;
    border: 1px solid rgba(201, 169, 98, 0.55);
}

.club-only-notice-dialog h2 {
    margin: 0 0 0.85rem;
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    color: var(--profile-plum);
    line-height: 1.35;
}

.club-only-notice-dialog .club-only-notice-emphasis {
    margin: 0 0 0.85rem;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 700;
    color: var(--profile-rose);
    line-height: 1.45;
}

.club-only-notice-dialog .club-only-notice-detail {
    margin: 0 0 1.25rem;
    font-size: clamp(0.9rem, 2vw, 1.05rem);
    color: #6d5568;
    line-height: 1.6;
    text-align: left;
}

.club-only-notice-dialog .btn-dismiss-notice {
    display: inline-block;
    min-width: 220px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--profile-dusty-rose) 0%, var(--profile-rose) 100%);
    border: 1px solid var(--profile-gold);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(154, 92, 114, 0.35);
}

.club-only-notice-dialog .btn-dismiss-notice:hover {
    filter: brightness(1.05);
}

.club-only-notice-dialog .btn-dismiss-notice:focus {
    outline: 3px solid rgba(192, 132, 151, 0.5);
    outline-offset: 2px;
}

body.register-page.club-notice-open {
    overflow: hidden;
}

.profile-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    max-height: calc(100dvh - 0.75rem);
    margin: 0 auto;
    padding: 0.35rem 0.55rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    justify-content: center;
}

.profile-hero {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 0.5rem;
    row-gap: 0;
    flex-shrink: 0;
    padding: 0.4rem 0.55rem 0.35rem;
    margin-bottom: 0.35rem;
    color: #fff;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(94, 58, 77, 0.92) 0%, rgba(154, 92, 114, 0.9) 100%);
    border: 1px solid rgba(201, 169, 98, 0.45);
    box-shadow: 0 4px 18px rgba(94, 58, 77, 0.25);
}

.profile-avatar {
    grid-row: 1;
    align-self: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(201, 169, 98, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.profile-hero-main {
    min-width: 0;
    align-self: center;
}

.profile-hero-main h1 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.profile-hero-email {
    margin: 0;
    font-size: 0.78rem;
    opacity: 0.9;
    word-break: break-all;
    line-height: 1.25;
}

.profile-hero-actions {
    align-self: start;
}

.profile-role-badge {
    display: inline-block;
    margin-top: 0.15rem;
    padding: 0.1rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(201, 169, 98, 0.22);
    border-radius: 999px;
    border: 1px solid rgba(201, 169, 98, 0.5);
}

.profile-hero-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.3rem;
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.7rem;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.profile-meta-chip strong {
    font-weight: 600;
    opacity: 0.85;
}

.profile-sections {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.38rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--profile-dusty-rose) transparent;
}

.profile-panel {
    background: var(--profile-panel-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 10px;
    padding: 0.5rem 0.6rem 0.55rem;
    border: 1px solid var(--profile-panel-border);
    box-shadow: 0 2px 12px rgba(94, 58, 77, 0.1);
}

.profile-panel-header {
    margin: 0 0 0.35rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(192, 132, 151, 0.35);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--profile-plum);
    line-height: 1.15;
}

.profile-panel form {
    display: block;
}

.profile-page .form-group {
    margin-bottom: 0.38rem;
    min-width: 0;
}

.profile-page .form-group:last-of-type {
    margin-bottom: 0;
}

.profile-page .form-group label {
    display: block;
    margin-bottom: 0.12rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--profile-rose);
    line-height: 1.2;
}

.profile-page .form-control {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.32rem 0.5rem;
    font-size: 0.82rem;
    line-height: 1.25;
    color: var(--profile-plum);
    border: 1px solid rgba(192, 132, 151, 0.55);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.75);
}

.profile-panel .form-actions {
    margin-top: 0.38rem;
    padding-top: 0.38rem;
    border-top: 1px solid rgba(192, 132, 151, 0.3);
    display: flex;
    justify-content: flex-end;
}

.profile-page .auth-container {
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.profile-page .form-control:focus {
    outline: none;
    border-color: var(--profile-dusty-rose);
    box-shadow: 0 0 0 2px rgba(192, 132, 151, 0.35);
}

.profile-page .btn {
    padding: 0.32rem 0.7rem;
    background: linear-gradient(135deg, var(--profile-dusty-rose) 0%, var(--profile-rose) 100%);
    border: 1px solid var(--profile-gold);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.78rem;
    color: #fff;
}

.profile-page .btn:hover {
    background: linear-gradient(135deg, #b07688 0%, #8a5268 100%);
    filter: brightness(1.03);
}

.profile-page .btn-outline {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(201, 169, 98, 0.75);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.profile-page .btn-outline:hover {
    background: rgba(201, 169, 98, 0.22);
    border-color: var(--profile-gold);
    color: #fff;
}

.profile-page .alert {
    flex-shrink: 0;
    padding: 0.28rem 0.45rem;
    border-radius: 6px;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    line-height: 1.25;
}

.profile-page .alert-success {
    background: rgba(255, 252, 250, 0.92);
    color: #4a6b52;
    border: 1px solid rgba(154, 180, 160, 0.65);
}

.profile-page .alert-error {
    background: rgba(255, 248, 248, 0.92);
    color: #8b3d52;
    border: 1px solid rgba(192, 132, 151, 0.65);
}

@media (max-width: 899px) {
    body.profile-page {
        height: auto;
        max-height: none;
        overflow: auto;
        align-items: flex-start;
    }

    .profile-shell {
        max-height: none;
        justify-content: flex-start;
        padding-top: 0.5rem;
        padding-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .profile-shell {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

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

    .profile-hero-actions {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .profile-avatar {
        grid-row: 1;
    }

    .profile-hero-main {
        grid-column: 2;
    }
}

/* Стилове за формата за нулиране на парола */
.reset-instructions {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Стилове за съобщения за грешка и успех */
.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Респонсивни стилове (register, forgot и др. — без темата) */
@media (max-width: 480px) {
    body:not(.login-page):not(.profile-page):not(.register-page):not(.forgot-page):not(.reset-page) .auth-container {
        margin: 20px 10px;
        padding: 15px;
    }

    body:not(.login-page):not(.profile-page):not(.register-page):not(.forgot-page):not(.reset-page) .btn {
        padding: 8px 15px;
    }

    body.login-page .auth-container,
    body.register-page .auth-container,
    body.forgot-page .auth-container,
    body.reset-page .auth-container {
        width: 100%;
        max-width: calc(100vw - 1rem);
        max-height: calc(100svh - 1rem);
        padding: 0.95rem 1rem;
    }

    body.login-page .auth-header h1,
    body.register-page .auth-header h1,
    body.forgot-page .auth-header h1,
    body.reset-page .auth-header h1 {
        font-size: 1.05rem;
    }
}

@media (min-width: 900px) {
    body.login-page,
    body.register-page,
    body.forgot-page,
    body.reset-page {
        background-attachment: fixed;
    }
}
