/* The profile (Components/Pages/Profile/Profile.razor): the tabs, the cards of fields on the account tab with the save
   bar that stays in view at the bottom, and the cards of the security tab. The page frame and head are the shared app
   page ones (WebbuilderUI css/app-page.css). Skeleton: Components/Skeletons/Profile/ProfileSkeleton.razor. */

/* ========
     tabs
   ======== */

.prf-tabs {
    margin-bottom: 20px;
}

/* ========
     cards
   ======== */

.prf-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
}

.prf-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--app-line);
    border-radius: 24px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
}

/* The billing address spans both columns */
.prf-card-wide {
    grid-column: 1 / -1;
}

/* The two smaller cards of the security tab, one above the other */
.prf-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.prf-card-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prf-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--app-text-strong);
}

.prf-card-title .bx {
    flex: none;
    font-size: 20px;
    color: var(--app-accent);
}

.prf-card-lead {
    max-width: 620px;
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--app-text-muted);
}

/* =========
     fields
   ========= */

.prf-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 18px 16px;
    margin: 0;
}

/* One field per row (the password form) */
.prf-fields-1 {
    grid-template-columns: minmax(0, 1fr);
}

/* The address: four columns on a wide screen, the two address lines across */
.prf-fields-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.prf-fields-4 .prf-wide {
    grid-column: span 2;
}

.prf-wide {
    grid-column: 1 / -1;
}

/* "Optional" after a label */
.prf-optional {
    margin-left: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--app-text-muted);
}

/* A row of buttons under a card's text or form */
.prf-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 0;
}

/* ============
     save bar
   ============ */

/* Under the last card; with unsaved changes it stays at the bottom of the screen while the fields scroll under it, so
   Save is in reach wherever the change was made */
.prf-savebar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 12px 12px 12px 22px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.prf-savebar-dirty {
    position: sticky;
    bottom: 16px;
    border-color: var(--app-accent);
    box-shadow: var(--app-shadow-menu);
}

.prf-savebar-state {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin: 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--app-text);
}

.prf-savebar-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--app-accent);
    animation: prf-dot-in 0.25s var(--app-ease-out) both;
}

@keyframes prf-dot-in {
    from {
        opacity: 0;
        transform: scale(0.4);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.prf-savebar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
}

/* ==============
     responsive
   ============== */

@media (max-width: 1199.98px) {
    .prf-fields-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Tablet: one card per row */
@media (max-width: 991.98px) {
    .prf-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Phone: one field per row; the save bar's buttons share its width and the note goes above them */
@media (max-width: 575.98px) {
    .prf-tabs {
        display: grid;
        width: 100%;
    }

    .prf-card {
        padding: 20px 18px;
    }

    .prf-fields,
    .prf-fields-4 {
        grid-template-columns: minmax(0, 1fr);
    }

    .prf-fields-4 .prf-wide {
        grid-column: 1 / -1;
    }

    /* Full width; a long label wraps (app-btn-wrap) instead of spilling out */
    .prf-actions .app-btn {
        width: 100%;
    }

    .prf-savebar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
        border-radius: 24px;
    }

    .prf-savebar-state:empty {
        display: none;
    }

    .prf-savebar-state {
        justify-content: center;
    }

    /* Two buttons share the bar */
    .prf-savebar-actions .app-btn {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* Phone inputs at 16px, so iOS does not zoom in when one is focused */
@media (max-width: 767.98px) {
    .prf-page .app-input {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .prf-savebar-dot {
        animation: none;
    }
}
