/* =========================================================
   BIBLIOTEKA.KG PROFILE PAGE
   Личный кабинет читателя
   ========================================================= */

.profile-page {
    position: relative;
    padding: 24px 0 56px;
    color: var(--text);
}

.profile-hero,
.profile-panel,
.profile-stat-card {
    position: relative;
    overflow: hidden;
    color: var(--text);
    background: rgba(var(--surface-rgb), var(--glass-alpha));
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: var(--shadow);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.05);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.05);
}

.profile-hero::before,
.profile-panel::before,
.profile-stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(900px 320px at 0% -14%, rgba(103, 232, 249, .17), transparent 62%),
        radial-gradient(700px 280px at 110% 110%, rgba(var(--tint-rgb), .18), transparent 62%);
    pointer-events: none;
}

.profile-hero-inner,
.profile-panel > *,
.profile-stat-card > * {
    position: relative;
    z-index: 2;
}

/* =========================================================
   COMMON
   ========================================================= */

.profile-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 7px 12px;
    color: var(--bg);
    background: var(--accent);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.profile-primary-btn,
.profile-outline-btn {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
    transition:
        color .18s ease,
        background-color .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

.profile-primary-btn {
    color: var(--bg) !important;
    background: var(--accent);
    border: 1px solid var(--accent);
    box-shadow: 0 10px 24px rgba(103, 232, 249, .22);
}

.profile-primary-btn:hover,
.profile-primary-btn:focus {
    color: var(--accent) !important;
    background: var(--bg);
    border-color: var(--accent);
    box-shadow: 0 0 22px rgba(103, 232, 249, .42);
    transform: translateY(-1px);
}

.profile-outline-btn {
    color: var(--text) !important;
    background: rgba(var(--surface-rgb), .62);
    border: 1px solid var(--border);
}

.profile-outline-btn:hover,
.profile-outline-btn:focus {
    color: var(--bg) !important;
    background: var(--text);
    border-color: var(--text);
    transform: translateY(-1px);
}

.profile-muted {
    color: var(--muted) !important;
}

/* =========================================================
   HERO
   ========================================================= */

.profile-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: center;
    padding: 34px;
}

.profile-user-card {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 24px;
    align-items: center;
}

.profile-avatar-wrap {
    width: 132px;
    height: 132px;
}

.profile-avatar {
    width: 132px;
    height: 132px;
    object-fit: cover;
    display: block;
    border: 3px solid rgba(103, 232, 249, .45);
    box-shadow: 0 18px 38px rgba(103, 232, 249, .16);
}

.profile-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    background: var(--accent);
    font-size: 56px;
    font-weight: 950;
    text-transform: uppercase;
}

.profile-user-info h1 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: clamp(36px, 4.5vw, 64px);
    font-weight: 950;
    line-height: .96;
    letter-spacing: -.045em;
}

.profile-user-info p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.6;
}

.profile-user-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-user-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    color: var(--text);
    background: rgba(var(--surface-rgb), .58);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 800;
}

.profile-user-meta i {
    color: var(--accent);
}

.profile-hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* =========================================================
   PANELS
   ========================================================= */

.profile-panel {
    padding: 30px;
}

.profile-panel-head {
    margin-bottom: 22px;
}

.profile-panel-head h2 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: clamp(28px, 3.2vw, 46px);
    font-weight: 950;
    line-height: 1.04;
    letter-spacing: -.03em;
}

.profile-panel-head p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
}

/* =========================================================
   ACCESS PANEL
   ========================================================= */

.profile-access-status {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding: 22px;
    background:
        linear-gradient(135deg, rgba(103, 232, 249, .20), rgba(var(--surface-rgb), .50)),
        rgba(var(--surface-rgb), .54);
    border: 1px solid rgba(103, 232, 249, .34);
}

.profile-access-icon {
    width: 76px;
    height: 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    background: var(--accent);
    font-size: 32px;
}

.profile-access-status span {
    display: block;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.profile-access-status h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 25px;
    font-weight: 950;
    line-height: 1.08;
}

.profile-access-status p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.profile-access-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.profile-access-details div {
    padding: 18px;
    background: rgba(var(--surface-rgb), .48);
    border: 1px solid var(--border);
}

.profile-access-details strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text);
    font-size: 32px;
    font-weight: 950;
    line-height: 1;
}

.profile-access-details span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

/* =========================================================
   CONTINUE READING
   ========================================================= */

.profile-continue-card {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
    padding: 22px;
    background: rgba(var(--surface-rgb), .48);
    border: 1px solid var(--border);
}

.profile-book-cover-wrap {
    min-height: 220px;
    background: rgba(var(--surface-rgb), .42);
    border: 1px solid var(--border);
}

.profile-book-cover {
    width: 100%;
    height: 100%;
    min-height: 220px;
    object-fit: cover;
    display: block;
}

.profile-continue-content span {
    display: block;
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.profile-continue-content h3 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: clamp(26px, 3vw, 42px);
    font-weight: 950;
    line-height: 1.08;
}

.profile-continue-content p {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.65;
}

/* =========================================================
   STATS
   ========================================================= */

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.profile-stat-card {
    padding: 22px;
}

.profile-stat-icon {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--bg);
    background: var(--accent);
    font-size: 24px;
}

.profile-stat-card strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 38px;
    font-weight: 950;
    line-height: 1;
}

.profile-stat-card span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 850;
}

/* =========================================================
   HISTORY
   ========================================================= */

.profile-history-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.profile-history-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 16px;
    background: rgba(var(--surface-rgb), .46);
    border: 1px solid var(--border);
}

.profile-history-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: rgba(103, 232, 249, .10);
    border: 1px solid rgba(103, 232, 249, .28);
    font-size: 22px;
}

.profile-history-content h3 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 17px;
    font-weight: 950;
    line-height: 1.25;
}

.profile-history-content p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.profile-mini-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    color: var(--bg);
    background: var(--accent);
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
}

.profile-mini-link:hover,
.profile-mini-link:focus {
    color: var(--accent);
    background: var(--bg);
}

/* =========================================================
   EMPTY
   ========================================================= */

.profile-empty-card {
    padding: 24px;
    background: rgba(var(--surface-rgb), .48);
    border: 1px solid var(--border);
}

.profile-empty-small {
    padding: 18px;
}

.profile-empty-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--bg);
    background: var(--accent);
    font-size: 28px;
}

.profile-empty-card h3 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 24px;
    font-weight: 950;
}

.profile-empty-card p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

/* =========================================================
   INFO / SUPPORT
   ========================================================= */

.profile-info-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.profile-info-list div {
    padding: 15px;
    background: rgba(var(--surface-rgb), .46);
    border: 1px solid var(--border);
}

.profile-info-list strong {
    display: block;
    margin-bottom: 5px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.profile-info-list span {
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
}

.profile-support-card {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding: 20px;
    background:
        linear-gradient(135deg, rgba(103, 232, 249, .16), rgba(var(--surface-rgb), .46)),
        rgba(var(--surface-rgb), .48);
    border: 1px solid rgba(103, 232, 249, .28);
}

.profile-support-icon {
    width: 68px;
    height: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    background: var(--accent);
    font-size: 28px;
}

.profile-support-card h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 23px;
    font-weight: 950;
}

.profile-support-card p {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.profile-support-card a {
    color: var(--accent);
    font-weight: 950;
    text-decoration: none;
}

.profile-support-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* =========================================================
   DARK MODE
   ========================================================= */

html.theme-dark .profile-user-meta span,
body.theme-dark .profile-user-meta span,
html.theme-dark .profile-access-details div,
body.theme-dark .profile-access-details div,
html.theme-dark .profile-continue-card,
body.theme-dark .profile-continue-card,
html.theme-dark .profile-history-item,
body.theme-dark .profile-history-item,
html.theme-dark .profile-info-list div,
body.theme-dark .profile-info-list div,
html.theme-dark .profile-empty-card,
body.theme-dark .profile-empty-card {
    background: rgba(255, 255, 255, .045);
}

/* =========================================================
   NO RADIUS
   ========================================================= */

.profile-hero,
.profile-panel,
.profile-stat-card,
.profile-kicker,
.profile-primary-btn,
.profile-outline-btn,
.profile-avatar,
.profile-user-meta span,
.profile-access-status,
.profile-access-icon,
.profile-access-details div,
.profile-continue-card,
.profile-book-cover-wrap,
.profile-book-cover,
.profile-stat-icon,
.profile-history-item,
.profile-history-icon,
.profile-mini-link,
.profile-empty-card,
.profile-empty-icon,
.profile-info-list div,
.profile-support-card,
.profile-support-icon {
    border-radius: 0 !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1199.98px) {
    .profile-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .profile-hero-inner {
        grid-template-columns: 1fr;
    }

    .profile-hero-actions {
        max-width: 420px;
    }

    .profile-continue-card {
        grid-template-columns: 130px minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    .profile-page {
        padding-top: 20px;
    }

    .profile-hero-inner,
    .profile-panel {
        padding: 24px 20px;
    }

    .profile-user-card {
        grid-template-columns: 1fr;
    }

    .profile-avatar-wrap,
    .profile-avatar {
        width: 112px;
        height: 112px;
    }

    .profile-access-status,
    .profile-continue-card,
    .profile-support-card {
        grid-template-columns: 1fr;
    }

    .profile-history-item {
        grid-template-columns: 54px minmax(0, 1fr);
    }

    .profile-mini-link {
        grid-column: 1 / -1;
        width: max-content;
    }

    .profile-support-actions .btn,
    .profile-hero-actions .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .profile-user-info h1 {
        font-size: 34px;
    }

    .profile-panel-head h2 {
        font-size: 29px;
    }

    .profile-stats-grid {
        grid-template-columns: 1fr;
    }

    .profile-access-details {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   PROFILE EDIT PAGE
   Редактирование профиля
   ========================================================= */

.profile-edit-page {
    position: relative;
}

.profile-edit-avatar-wrap {
    position: relative;
    cursor: pointer;
}

.profile-edit-avatar {
    cursor: pointer;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease;
}

.profile-edit-avatar-wrap:hover .profile-edit-avatar {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow:
        0 22px 44px rgba(103, 232, 249, .22),
        0 0 0 8px rgba(103, 232, 249, .08);
}

.profile-edit-avatar-badge {
    position: absolute;
    right: -6px;
    bottom: -6px;
    z-index: 3;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    background: var(--accent);
    border: 3px solid rgba(var(--surface-rgb), .95);
    font-size: 18px;
    box-shadow: 0 12px 24px rgba(103, 232, 249, .20);
}

.profile-edit-form-panel,
.profile-edit-side-panel {
    display: flex;
    flex-direction: column;
}

.profile-edit-form {
    position: relative;
    z-index: 2;
}

.profile-edit-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
}

.profile-edit-field {
    margin-bottom: 18px;
}

.profile-edit-label {
    margin-bottom: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.profile-edit-input {
    min-height: 52px;
    padding: 12px 14px;
    color: var(--text);
    background: rgba(var(--surface-rgb), .62);
    border: 1px solid var(--border);
    font-size: 15px;
    font-weight: 700;
    box-shadow: none;
}

.profile-edit-input:focus {
    color: var(--text);
    background: rgba(var(--surface-rgb), .72);
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(103, 232, 249, .18);
}

.profile-edit-input::placeholder {
    color: var(--muted);
    opacity: .78;
}

.profile-edit-file-input {
    padding-top: 13px;
}

.profile-edit-avatar-field {
    position: relative;
    z-index: 2;
    margin-bottom: 18px;
    padding: 18px;
    background:
        linear-gradient(180deg, rgba(103, 232, 249, .09), rgba(var(--surface-rgb), .44)),
        rgba(var(--surface-rgb), .46);
    border: 1px solid rgba(103, 232, 249, .26);
}

.profile-edit-avatar-help {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.55;
}

.profile-edit-avatar-help i {
    margin-top: 2px;
    color: var(--accent);
}

.profile-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.profile-edit-tips {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.profile-edit-tip {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(var(--surface-rgb), .44)),
        rgba(var(--surface-rgb), .46);
    border: 1px solid rgba(255, 255, 255, .15);
}

.profile-edit-tip::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(300px 140px at 0% 0%, rgba(103, 232, 249, .12), transparent 65%);
    pointer-events: none;
}

.profile-edit-tip > * {
    position: relative;
    z-index: 2;
}

.profile-edit-tip-icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: rgba(103, 232, 249, .12);
    border: 1px solid rgba(103, 232, 249, .30);
    font-size: 22px;
}

.profile-edit-tip h3 {
    margin: 0 0 7px;
    color: var(--text);
    font-size: 18px;
    font-weight: 950;
    line-height: 1.16;
}

.profile-edit-tip p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.55;
}

.profile-edit-support-card {
    margin-top: auto;
}

/* Yii validation */
.profile-edit-page .help-block,
.profile-edit-page .invalid-feedback {
    margin-top: 7px;
    color: #ff8a8a;
    font-size: 13px;
    font-weight: 750;
}

.profile-edit-page .has-error .profile-edit-input,
.profile-edit-page .is-invalid {
    border-color: #ff8a8a;
}

.profile-edit-page .has-success .profile-edit-input,
.profile-edit-page .is-valid {
    border-color: rgba(103, 232, 249, .45);
}

/* Dark mode */
html.theme-dark .profile-edit-input,
body.theme-dark .profile-edit-input,
html.theme-dark .profile-edit-avatar-field,
body.theme-dark .profile-edit-avatar-field,
html.theme-dark .profile-edit-tip,
body.theme-dark .profile-edit-tip {
    background: rgba(255, 255, 255, .045);
}

/* No radius */
.profile-edit-avatar-badge,
.profile-edit-input,
.profile-edit-avatar-field,
.profile-edit-tip,
.profile-edit-tip-icon {
    border-radius: 0 !important;
}

/* Responsive */
@media (max-width: 767.98px) {
    .profile-edit-form-grid {
        grid-template-columns: 1fr;
    }

    .profile-edit-actions .btn {
        width: 100%;
    }

    .profile-edit-tip {
        grid-template-columns: 1fr;
    }
}