/* ==========================================
   KEBRICK - PROFILE STYLES
========================================== */


/* ==========================================
   PROFILE AVATAR
========================================== */

#headerAvatar,
#profilePreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

#headerAvatar {
    width: 42px;
    height: 42px;
}


/* ==========================================
   PROFILE IMAGE UPLOAD
========================================== */

#profileAvatarInput {
    display: none;
}


/* ==========================================
   PROFILE MODAL
========================================== */

#profileModal {
    display: none;
}

#profileModal.active {
    display: flex;
}


/* ==========================================
   DARK MODE
========================================== */

body.dark-mode #profileModal {
    color: #f5f5f5;
}

body.dark-mode #profileModal input,
body.dark-mode #profileModal textarea {
    background: #292929;
    color: #ffffff;
    border-color: #555;
}

body.dark-mode #profileModal input::placeholder,
body.dark-mode #profileModal textarea::placeholder {
    color: #aaa;
}


/* ==========================================
   RESPONSIVE
========================================== */

@media (max-width: 768px) {

    #headerAvatar {
        width: 36px;
        height: 36px;
    }

    #profileModal {
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }

}

@media (max-width: 480px) {

    #headerAvatar {
        width: 32px;
        height: 32px;
    }

}
/* ==========================================
   KEBRICK PROFILE PAGE + SETTINGS
========================================== */
.profile-page {
    padding-top: 38px;
    padding-bottom: 64px;
    min-height: 100%;
}
.profile-page-heading,
.profile-card-heading,
.profile-form-footer,
.profile-overview-card .profile-avatar-edit,
.profile-stats-row {
    display: flex;
    align-items: center;
}
.profile-page-heading {
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}
.profile-level-pill {
    padding: 10px 15px;
    border: 1px solid rgba(255, 212, 59, .5);
    border-radius: 999px;
    color: #8a6900;
    background: rgba(255, 212, 59, .15);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}
.profile-page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    padding: 8px;
    margin-bottom: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}
.profile-page-tab {
    padding: 12px 17px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--muted);
    background: transparent;
    font: 700 12px "DM Sans", sans-serif;
    cursor: pointer;
    transition: .2s ease;
}
.profile-page-tab:hover { color: var(--text); background: var(--surface-2); }
.profile-page-tab.active {
    color: #171717;
    border-color: rgba(255, 212, 59, .8);
    background: var(--yellow);
    box-shadow: 0 0 20px rgba(255, 212, 59, .22);
}
.profile-panel { display: none; }
.profile-panel.active { display: block; }
.profile-overview-card,
.profile-form-card {
    padding: 25px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.profile-overview-card { margin-bottom: 18px; }
.profile-overview-card .profile-avatar-edit { gap: 18px; margin: 0; }
.profile-overview-card .profile-avatar-edit > div { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.profile-overview-card .profile-avatar-edit strong { color: var(--text); font: 700 20px "Space Grotesk", sans-serif; }
.profile-overview-card .profile-avatar-edit span { color: var(--muted); font-size: 12px; }
.profile-overview-card .profile-avatar-edit img { width: 88px; height: 88px; }
.profile-stats-row {
    justify-content: flex-end;
    gap: 0;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.profile-stats-row > div { min-width: 125px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.profile-stats-row > div + div { border-left: 1px solid var(--line); }
.profile-stats-row strong { color: var(--text); font: 700 22px "Space Grotesk", sans-serif; }
.profile-stats-row span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.profile-card-heading { justify-content: space-between; margin-bottom: 18px; }
.profile-card-heading h3 { margin: 4px 0 0; color: var(--text); font: 700 22px "Space Grotesk", sans-serif; }
.profile-card-heading h3 span { color: #d2a900; }
.profile-card-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #8a6900; background: rgba(255, 212, 59, .2); font-size: 20px; }
.profile-form-card .profile-field { box-sizing: border-box; }
.profile-form-footer { justify-content: space-between; gap: 14px; margin-top: 18px; }
.profile-form-footer .profile-save-note { margin: 0; font-size: 11px; }
.profile-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.profile-setting-select { cursor: pointer; }
.settings-hint { margin-top: 15px; color: var(--muted); font-size: 11px; }
.settings-theme-card p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.settings-theme-card .secondary-button { margin-top: 8px; cursor: pointer; }
#changePasswordForm .profile-field { display: block; }
.minifigure-profile-card .customizer-heading { margin-bottom: 22px; }
.minifigure-profile-card .customizer-heading h3 { margin: 5px 0; color: var(--text); font: 700 24px "Space Grotesk", sans-serif; }
.minifigure-profile-card .customizer-heading h3 span { color: #d2a900; }
.minifigure-profile-card .customizer-heading p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.profile-page [hidden] { display: none !important; }
body.dark-mode .profile-overview-card,
body.dark-mode .profile-form-card,
body.dark-mode .profile-page-tabs { background: var(--surface); }
body.dark-mode .profile-level-pill { color: #ffe17a; }
@media (max-width: 760px) {
    .profile-page { padding-top: 24px; }
    .profile-page-heading { align-items: flex-start; flex-direction: column; }
    .profile-settings-grid { grid-template-columns: 1fr; }
    .profile-stats-row { justify-content: space-around; }
    .profile-stats-row > div { min-width: 0; flex: 1; }
    .profile-form-footer { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 480px) {
    .profile-overview-card, .profile-form-card { padding: 17px; }
    .profile-page-tab { flex: 1 1 auto; padding: 10px; font-size: 10px; }
    .profile-overview-card .profile-avatar-edit img { width: 68px; height: 68px; }
    .profile-stats-row strong { font-size: 18px; }
    .profile-stats-row span { font-size: 8px; }
}

/* PROFILE REFINEMENT — compact avatar, rank and pencil editing */
.profile-overview-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(230px, .8fr);
    align-items: center;
    gap: 24px;
}
.profile-overview-card .profile-avatar-edit {
    align-items: center;
    gap: 15px;
}
.profile-overview-card .profile-avatar-edit img,
#profilePreview {
    width: 66px !important;
    height: 66px !important;
    min-width: 66px;
    border-radius: 50%;
    object-fit: cover;
}
.profile-avatar-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.profile-rank-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 196, 0, .35);
    border-radius: 15px;
    background: linear-gradient(120deg, rgba(255,212,59,.13), rgba(156,123,255,.08));
}
.profile-rank-card > span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.profile-rank-card strong { color: var(--text); font: 700 17px "Space Grotesk", sans-serif; }
.profile-rank-card small { color: var(--muted); font-size: 11px; }
.profile-stats-row { justify-content: space-around; }
.profile-stats-row > div { min-width: 105px; }
.profile-edit-field { margin-top: 15px; }
.profile-edit-control { position: relative; display: flex; align-items: flex-start; gap: 9px; }
.profile-edit-control .profile-field { flex: 1; padding-right: 14px; }
.profile-edit-control .profile-field[readonly] { cursor: default; opacity: .88; }
.profile-edit-control .profile-field.is-editing { border-color: var(--yellow-deep); box-shadow: 0 0 0 3px rgba(255,212,59,.13); }
.profile-pencil-button {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255,212,59,.45);
    border-radius: 10px;
    color: #6e5200;
    background: rgba(255,212,59,.18);
    font-size: 19px;
    cursor: pointer;
    transition: .2s ease;
}
.profile-pencil-button:hover { transform: translateY(-2px); background: var(--yellow); box-shadow: 0 5px 18px rgba(255,212,59,.25); }
.profile-logout-button {
    display: block;
    margin-top: 14px;
    padding: 10px 13px;
    border: 1px solid rgba(229,72,72,.25);
    border-radius: 10px;
    color: #d94141;
    background: rgba(229,72,72,.07);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.profile-logout-button:hover { background: rgba(229,72,72,.14); }
@media (max-width: 760px) {
    .profile-overview-main { grid-template-columns: 1fr; gap: 16px; }
    .profile-overview-card .profile-avatar-edit img, #profilePreview { width: 58px !important; height: 58px !important; min-width: 58px; }
}


/* Collector rank — title-only premium badge */
.profile-rank-card {
    min-height: 82px;
    justify-content: center;
    align-items: flex-start;
    padding: 18px 24px;
    border: 1px solid rgba(255, 205, 35, .65);
    border-radius: 18px;
    background: linear-gradient(115deg, #fff2ad 0%, #ffe06a 48%, #f8c92c 100%);
    box-shadow: 0 10px 28px rgba(225, 169, 0, .18), inset 0 1px 0 rgba(255,255,255,.8);
}
.profile-rank-card strong {
    color: #332600;
    font-family: "Space Grotesk", "Arial", sans-serif;
    font-size: clamp(19px, 2vw, 25px);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.2;
    text-shadow: 0 1px 0 rgba(255,255,255,.45);
}
body.dark-mode .profile-rank-card {
    background: linear-gradient(115deg, #4b3a08 0%, #71570a 52%, #9a7400 100%);
    border-color: rgba(255, 214, 77, .58);
    box-shadow: 0 10px 28px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.1);
}
body.dark-mode .profile-rank-card strong { color: #fff2bd; }
