
:root {
    --primary: #111111;
    --secondary: #555555;
    --muted: #777777;
    --border: #e5e5e5;
    --background: #f7f7f7;
    --white: #ffffff;
    --success: #16803c;
    --success-background: #edf8f1;
    --danger: #c62828;
    --danger-background: #fff1f1;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    --radius: 18px;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--primary);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
    display: block;
}

[hidden] {
    display: none !important;
}


/* =========================================================
   HEADER
   ========================================================= */

.profile-header {
    width: 100%;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.header-container {
    width: min(1100px, calc(100% - 40px));
    min-height: 78px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.brand img {
    width: 150px;
    height: auto;
}

.back-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.back-button:hover {
    opacity: 0.65;
}

.back-button span:first-child {
    font-size: 20px;
    line-height: 1;
}


/* =========================================================
   PAGE
   ========================================================= */

.profile-page {
    width: 100%;
    padding: 70px 20px 80px;
}

.profile-container {
    width: min(760px, 100%);
    margin: 0 auto;
}

.page-heading {
    margin-bottom: 35px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    color: var(--muted);
}

.page-heading h1 {
    margin: 0 0 10px;
    font-size: clamp(32px, 5vw, 46px);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.page-heading p {
    margin: 0;
    color: var(--secondary);
    font-size: 16px;
    line-height: 1.6;
}


/* =========================================================
   LOADING
   ========================================================= */

.auth-loading {
    min-height: 260px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.auth-loading p {
    margin: 0;
    color: var(--secondary);
    font-size: 14px;
}

.loading-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   ERROR
   ========================================================= */

.profile-error {
    background: var(--danger-background);
    border: 1px solid #f0caca;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.error-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: var(--danger);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.profile-error h2 {
    margin: 0 0 6px;
    font-size: 17px;
}

.profile-error p {
    margin: 0;
    color: var(--secondary);
    font-size: 14px;
    line-height: 1.5;
}


/* =========================================================
   PROFILE CARD
   ========================================================= */

.profile-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profile-cover {
    height: 145px;
    background:
        linear-gradient(
            135deg,
            #111111,
            #383838
        );
    position: relative;
}

.profile-avatar-wrapper {
    position: absolute;
    left: 35px;
    bottom: -52px;
}

.profile-avatar,
.profile-avatar-fallback {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    border: 5px solid var(--white);
}

.profile-avatar {
    object-fit: cover;
    background: var(--background);
}

.profile-avatar-fallback {
    background: #eeeeee;
    color: #555555;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
}

.profile-card-content {
    padding: 75px 35px 35px;
}

.profile-identity h2 {
    margin: 0 0 5px;
    font-size: 25px;
    letter-spacing: -0.02em;
}

.profile-identity p {
    margin: 0 0 12px;
    color: var(--secondary);
    font-size: 14px;
}

.account-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--success-background);
    color: var(--success);
    font-size: 12px;
    font-weight: 700;
}


/* =========================================================
   DIVIDER
   ========================================================= */

.profile-divider {
    height: 1px;
    background: var(--border);
    margin: 32px 0;
}


/* =========================================================
   FORM
   ========================================================= */

.profile-form {
    display: flex;
    flex-direction: column;
}

.form-section + .form-section {
    margin-top: 38px;
}

.section-heading {
    margin-bottom: 22px;
}

.section-heading h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 22px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
}

.form-group input {
    width: 100%;
    min-height: 50px;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    outline: none;
    padding: 0 14px;
    color: var(--primary);
    background: var(--white);
    transition: var(--transition);
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.form-group input[readonly] {
    background: #f5f5f5;
    color: var(--muted);
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}


/* =========================================================
   ACCOUNT INFORMATION
   ========================================================= */

.account-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.info-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    background: #fafafa;
}

.info-label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.info-item strong {
    display: block;
    font-size: 14px;
}

.status-active {
    color: var(--success);
}


/* =========================================================
   FORM MESSAGE
   ========================================================= */

.form-message {
    margin-top: 24px;
    border-radius: 10px;
    padding: 13px 15px;
    font-size: 13px;
    line-height: 1.5;
}

.form-message.success {
    background: var(--success-background);
    color: var(--success);
    border: 1px solid #c9e8d3;
}

.form-message.error {
    background: var(--danger-background);
    color: var(--danger);
    border: 1px solid #f0caca;
}


/* =========================================================
   FORM ACTIONS
   ========================================================= */

.form-actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.primary-button,
.secondary-button,
.logout-button {
    min-height: 46px;
    border-radius: 9px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
}

.primary-button {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--white);
}

.primary-button:hover {
    background: #333333;
}

.primary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.secondary-button {
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--primary);
}

.secondary-button:hover {
    background: #f5f5f5;
}


/* =========================================================
   ACCOUNT ACTIONS
   ========================================================= */

.account-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.danger-info h3 {
    margin: 0 0 5px;
    font-size: 16px;
}

.danger-info p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.logout-button {
    border: 1px solid #e0bcbc;
    background: var(--white);
    color: var(--danger);
    white-space: nowrap;
}

.logout-button:hover {
    background: var(--danger-background);
}


/* =========================================================
   FOOTER
   ========================================================= */

.profile-footer {
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto;
    padding: 0 0 35px;
    text-align: center;
}

.profile-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 700px) {
    .profile-page {
        padding: 45px 15px 60px;
    }

    .header-container {
        width: calc(100% - 30px);
        min-height: 68px;
    }

    .brand img {
        width: 125px;
    }

    .back-button span:last-child {
        display: none;
    }

    .page-heading {
        margin-bottom: 25px;
    }

    .page-heading h1 {
        font-size: 34px;
    }

    .profile-cover {
        height: 125px;
    }

    .profile-avatar-wrapper {
        left: 22px;
    }

    .profile-avatar,
    .profile-avatar-fallback {
        width: 92px;
        height: 92px;
    }

    .profile-card-content {
        padding: 67px 22px 25px;
    }

    .account-info-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .primary-button,
    .secondary-button {
        width: 100%;
    }

    .account-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .logout-button {
        width: 100%;
    }

    .profile-footer {
        width: calc(100% - 30px);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}