/* ==========================================================================
   Account settings: layout only. Cards, fields, chips, buttons and the dialog come from components/ui.css and Web Awesome.
   Also the avatar crop dialog (components/avatar_crop_modal.html), which this screen opens.
   ========================================================================== */
@layer app-pages {

    /* The two cards sit side by side where there is room */
    .account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(26rem, 100%), 1fr)); gap: 1.25rem; align-items: start; }
    .account-grid .ui-card-title { margin-top: 1.25rem; }
    .account-grid .ui-card > .ui-card-title:first-child { margin-top: 0; }

    /* Profile header: photo, name and badges, photo buttons */
    .account-avatar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--d26-line); }
    .account-avatar-meta { flex: 1 1 12rem; min-width: 0; }
    .account-avatar-meta h3 { margin: 0 0 0.375rem; font-size: 1.125rem; overflow-wrap: anywhere; }
    .account-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
    .account-code { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.8125rem; color: var(--d26-ink-2); }
    .account-avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
    wa-button[hidden] { display: none; }           /* a wa-button sets its own display, so hidden needs this */
    #settingsAvatarImg { width: 100%; height: 100%; object-fit: cover; }

    /* "Change photo": a label that looks like an outlined button; the native file input is visually hidden but stays focusable. */
    .account-file-btn {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        min-height: var(--d26-target);
        padding: 0 1rem;
        background: #fff;
        border: 1px solid var(--d26-line);
        border-radius: var(--d26-radius-control);
        color: var(--d26-ink);
        font-weight: 600;
        cursor: pointer;
    }
    .account-file-btn:hover { border-color: var(--d26-accent); }
    .account-file-btn:focus-within { outline: 2px solid var(--d26-accent); outline-offset: 2px; }
    .account-file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

    /* The password fields are type="text" on purpose (so the browser's password manager leaves them alone); this class hides
       what is typed. The show/hide button adds .account-secret--shown. Firefox ignores text-security, as it did before. */
    wa-input.account-secret::part(input) { -webkit-text-security: disc; text-security: disc; }
    wa-input.account-secret.account-secret--shown::part(input) { -webkit-text-security: none; text-security: none; }

    /* ---- Avatar crop dialog ---- */
    .account-crop { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
    .account-crop .ui-hint { margin: 0; text-align: center; }
    .account-crop-frame {
        position: relative;
        width: 280px;
        max-width: 100%;
        aspect-ratio: 1;
        overflow: hidden;
        background: #0f172a;
        border-radius: var(--d26-radius-control);
        cursor: grab;
        user-select: none;
    }
    .account-crop-frame canvas { display: block; width: 100%; height: 100%; touch-action: none; }
    .account-crop-zoom { width: 100%; max-width: 290px; }
    .account-crop-zoom-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; font-size: 0.8125rem; font-weight: 700; color: var(--d26-ink-2); }
    .account-crop-zoom-head #cropZoomValueText { color: var(--d26-accent); }
    .account-crop-range { width: 100%; min-height: var(--d26-target); accent-color: var(--d26-accent); cursor: pointer; }
    .account-crop-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
}
