/* =========================================================
   ForYOU NEWS — Account Settings
   Brand colours, standard system font, no icons.
   Each section: a short title on the left, the settings
   on the right (stacked on phones).
   ========================================================= */


/* =========================================================
   TOKENS
   ========================================================= */

:root {
    --brown: #412e03;
    --brown-dark: #2c1f02;
    --gold: #d89b00;
    --gold-dark: #a87700;
    --gold-soft: #fdf6e3;

    --bg: #fafafa;
    --white: #ffffff;
    --line: #e6e6e3;
    --line-soft: #efefec;
    --field: #d6d4cf;

    --text: #1f1c16;
    --text-soft: #5f5c55;
    --muted: #8a877f;

    --red: #b42318;
    --red-soft: #fff1f0;
    --green: #177245;
    --green-soft: #eef8f1;

    --radius: 8px;
}


/* =========================================================
   GLOBAL
   ========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;

    background: var(--bg);
    color: var(--text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.avatar-upload:focus-within {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute;

    width: 1px;
    height: 1px;

    overflow: hidden;

    clip: rect(0 0 0 0);
    white-space: nowrap;
}


/* =========================================================
   HEADER (same pattern as the dashboard)
   ========================================================= */

.settings-header {
    position: sticky;
    top: 0;
    z-index: 100;

    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.settings-header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;

    width: min(1000px, calc(100% - 40px));
    min-height: 64px;
    margin: 0 auto;
}

.header-back {
    justify-self: start;

    padding: 8px 0;

    color: var(--brown);

    font-size: 14px;
    font-weight: 600;

    transition: color 0.2s ease;
}

.header-back:hover {
    color: var(--gold-dark);
}

.header-back-short {
    display: none;
}

.header-title {
    justify-self: center;

    color: var(--brown);
    opacity: 0.5;

    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;

    user-select: none;
}

.header-home {
    justify-self: end;

    display: inline-flex;

    padding: 4px;

    transition: opacity 0.2s ease, transform 0.2s ease;
}

.header-home:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.header-logo {
    display: block;

    width: 40px;
    height: 40px;

    object-fit: contain;
}


/* =========================================================
   MAIN + HEADING
   ========================================================= */

.settings-main {
    padding: 30px 0 56px;
}

.settings-container {
    width: min(1000px, calc(100% - 40px));
    margin: 0 auto;
}

.settings-heading {
    margin-bottom: 22px;
}

.section-label {
    margin-bottom: 4px;

    color: var(--gold-dark);

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.settings-heading h1 {
    color: var(--text);

    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
}

.settings-heading p:not(.section-label) {
    margin-top: 4px;

    color: var(--text-soft);

    font-size: 14px;
}


/* =========================================================
   CARDS: title on the left, settings on the right
   ========================================================= */

.settings-card {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 28px;

    margin-bottom: 16px;
    padding: 24px;

    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card-intro h2 {
    color: var(--text);

    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.card-intro p {
    margin-top: 6px;

    color: var(--text-soft);

    font-size: 13px;
}

.card-body {
    min-width: 0;
}


/* =========================================================
   PROFILE PHOTO
   ========================================================= */

.avatar-row {
    display: flex;
    align-items: center;
    gap: 18px;

    padding-bottom: 20px;
    margin-bottom: 20px;

    border-bottom: 1px solid var(--line-soft);
}

.avatar {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;

    width: 88px;
    height: 88px;

    overflow: hidden;

    background: #f1efe9;
    border: 2px solid var(--line);
    border-radius: 50%;
}

.avatar img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.avatar-initials {
    color: var(--brown);

    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* While uploading */
.avatar.is-busy::after {
    content: "";

    position: absolute;
    inset: 0;

    background: rgba(255, 255, 255, 0.6);
}

.avatar-title {
    margin-bottom: 8px;

    color: var(--text);

    font-size: 14px;
    font-weight: 600;
}

.avatar-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.avatar-controls small {
    display: block;

    margin-top: 8px;

    color: var(--muted);

    font-size: 12px;
}

.avatar-upload {
    cursor: pointer;
}

.avatar-upload.is-disabled {
    opacity: 0.6;
    pointer-events: none;
}


/* =========================================================
   FORMS
   ========================================================= */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;

    min-width: 0;
}

.form-group-wide {
    grid-column: 1 / -1;
}

.form-group label {
    margin-bottom: 6px;

    color: var(--text);

    font-size: 13px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;

    background: var(--white);
    border: 1px solid var(--field);
    border-radius: 6px;

    color: var(--text);

    font-size: 14px;

    outline: none;

    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    border-color: var(--brown);
    box-shadow: 0 0 0 3px rgba(65, 46, 3, 0.1);
}

.form-group input[readonly] {
    background: var(--bg);
    border-color: var(--line);

    color: var(--text-soft);

    cursor: default;
}

.form-group small {
    margin-top: 5px;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.4;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.form-actions {
    display: flex;
    justify-content: flex-end;

    margin-top: 20px;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;
    padding: 0 18px;

    border-radius: 6px;

    font-size: 13.5px;
    font-weight: 600;

    cursor: pointer;

    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.primary-button {
    background: var(--brown);
    border: 1px solid var(--brown);

    color: var(--white);
}

.primary-button:hover {
    background: var(--brown-dark);
    border-color: var(--brown-dark);
}

.secondary-button {
    background: var(--white);
    border: 1px solid var(--field);

    color: var(--brown);
}

.secondary-button:hover {
    background: var(--gold-soft);
    border-color: var(--brown);
}

.text-button {
    padding: 8px 4px;

    background: none;
    border: 0;

    color: var(--text-soft);

    font-size: 13.5px;
    font-weight: 600;

    cursor: pointer;
}

.text-button:hover {
    color: var(--red);
}

.primary-button:disabled,
.secondary-button:disabled,
.text-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.form-message {
    display: none;

    margin-top: 16px;
    padding: 10px 12px;

    border-radius: 6px;

    font-size: 13px;
    font-weight: 600;
}

.form-message.success {
    display: block;

    background: var(--green-soft);
    border: 1px solid #bfe3cb;

    color: var(--green);
}

.form-message.error {
    display: block;

    background: var(--red-soft);
    border: 1px solid #f6c9c4;

    color: var(--red);
}

#avatar-message {
    margin: -8px 0 18px;
}


/* =========================================================
   NOTIFICATION TOGGLES
   ========================================================= */

.notification-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 14px 0;

    border-bottom: 1px solid var(--line-soft);
}

.notification-setting:first-child {
    padding-top: 0;
}

.notification-setting-content {
    min-width: 0;
}

.notification-setting-content h3 {
    color: var(--text);

    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.notification-setting-content p {
    margin-top: 2px;

    color: var(--text-soft);

    font-size: 12.5px;
}

.notification-toggle {
    position: relative;

    display: inline-block;
    flex: 0 0 44px;

    width: 44px;
    height: 24px;

    cursor: pointer;
}

.notification-toggle input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;
}

.notification-toggle-slider {
    position: absolute;
    inset: 0;

    background: #d6d4cf;
    border-radius: 999px;

    transition: background-color 0.2s ease;
}

.notification-toggle-slider::before {
    content: "";

    position: absolute;
    top: 3px;
    left: 3px;

    width: 18px;
    height: 18px;

    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);

    transition: transform 0.2s ease;
}

.notification-toggle input:checked + .notification-toggle-slider {
    background: var(--brown);
}

.notification-toggle input:checked + .notification-toggle-slider::before {
    transform: translateX(20px);
}

.notification-toggle input:focus-visible + .notification-toggle-slider {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}

.notification-toggle:hover .notification-toggle-slider {
    box-shadow: 0 0 0 3px rgba(65, 46, 3, 0.1);
}


/* =========================================================
   ACCOUNT INFORMATION
   ========================================================= */

.account-information {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.information-item {
    min-width: 0;
    padding: 14px;

    background: var(--bg);
    border: 1px solid var(--line-soft);
    border-radius: 6px;
}

.information-item dt {
    margin-bottom: 4px;

    color: var(--muted);

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.information-item dd {
    color: var(--text);

    font-size: 13.5px;
    font-weight: 600;

    overflow-wrap: anywhere;
}

.user-id {
    font-size: 12px !important;
    font-weight: 500 !important;

    color: var(--text-soft) !important;
}


/* =========================================================
   BOTTOM LINK + FOOTER
   ========================================================= */

.bottom-navigation {
    padding-top: 8px;

    text-align: center;
}

.bottom-navigation a {
    color: var(--brown);

    font-size: 14px;
    font-weight: 600;
}

.bottom-navigation a:hover {
    color: var(--gold-dark);
}

.settings-footer {
    padding: 20px;

    border-top: 1px solid var(--line);

    color: var(--muted);

    font-size: 12px;
    text-align: center;
}


/* =========================================================
   TABLETS
   ========================================================= */

@media (max-width: 820px) {

    .settings-card {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .account-information {
        grid-template-columns: 1fr 1fr;
    }

    .information-item:last-child {
        grid-column: 1 / -1;
    }
}


/* =========================================================
   PHONES
   ========================================================= */

@media (max-width: 560px) {

    .settings-header-inner,
    .settings-container {
        width: calc(100% - 28px);
    }

    .settings-header-inner {
        min-height: 58px;
        gap: 8px;
    }

    .header-back {
        font-size: 13px;
        white-space: nowrap;
    }

    .header-back-long {
        display: none;
    }

    .header-back-short {
        display: inline;
    }

    .header-title {
        font-size: 12px;
        letter-spacing: 0.2em;
    }

    .header-logo {
        width: 36px;
        height: 36px;
    }

    .settings-main {
        padding: 20px 0 40px;
    }

    .settings-heading h1 {
        font-size: 21px;
    }

    .settings-card {
        padding: 16px;
    }

    .avatar-row {
        align-items: flex-start;
        gap: 14px;
    }

    .avatar {
        width: 72px;
        height: 72px;
    }

    .avatar-initials {
        font-size: 23px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .form-actions .primary-button {
        width: 100%;
    }

    .account-information {
        grid-template-columns: 1fr;
    }

    .notification-setting {
        gap: 14px;
    }
}


@media (max-width: 380px) {

    .header-back {
        font-size: 12px;
    }

    .header-title {
        letter-spacing: 0.14em;
    }
}
