/* Shared UI building blocks, built on the tokens in theme.css. Added alongside Bootstrap, not
   replacing it — existing Bootstrap grid/form classes stay in use; new/restyled markup reaches
   for these instead of ad-hoc one-off classes. */

/* Buttons */
.btn-app {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 48px;
    padding: 0 var(--space-5);
    border-radius: var(--r-btn);
    font-size: var(--fs-base);
    font-weight: 700;
    line-height: 1;
    border: 1.5px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.btn-app:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-app--full {
    width: 100%;
    height: 52px;
}

.btn-app--primary {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}

.btn-app--primary:hover:not(:disabled) {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
}

.btn-app--secondary {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn-app--secondary:hover:not(:disabled) {
    border-color: var(--brand);
}

.btn-app--tonal {
    background: var(--brand-tint);
    border-color: transparent;
    color: var(--brand);
}

.btn-app--text {
    background: transparent;
    border-color: transparent;
    color: var(--brand);
    height: auto;
    padding: var(--space-2) var(--space-3);
}

.btn-app--danger {
    background: transparent;
    border-color: transparent;
    color: var(--danger);
}

/* Cards */
.card-app {
    background: var(--surface);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-4);
}

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 34px;
    padding: 0 var(--space-3);
    border-radius: var(--r-chip);
    font-size: var(--fs-meta);
    font-weight: 600;
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    color: var(--ink-2);
    white-space: nowrap;
    cursor: pointer;
}

.chip--selected {
    border-color: var(--brand);
    background: var(--brand-tint);
    color: var(--brand);
}

/* Status badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--fs-overline);
    font-weight: 700;
    padding: 5px 10px;
    border-radius: var(--r-chip);
    line-height: 1;
}

.badge-status--success { background: var(--success-bg); color: var(--success-ink); }
.badge-status--warning { background: var(--warning-bg); color: var(--warning-ink); }
.badge-status--danger { background: var(--danger-bg); color: var(--danger-ink); }
.badge-status--neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
.badge-status--premium { background: var(--premium-bg); color: var(--premium-ink); }

.badge-status--dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* Segmented control */
.segmented {
    display: inline-flex;
    background: var(--surface-2);
    padding: 4px;
    border-radius: 14px;
    gap: 2px;
}

.segmented-item {
    border: none;
    background: transparent;
    color: var(--ink-2);
    font-size: var(--fs-meta);
    font-weight: 600;
    padding: var(--space-2) var(--space-4);
    border-radius: 10px;
    cursor: pointer;
    min-height: 44px;
}

.segmented-item.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(28, 25, 23, .08);
}

/* Form fields */
.field {
    display: block;
    margin-bottom: var(--space-4);
}

.field-label {
    display: block;
    font-size: var(--fs-meta);
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: var(--space-2);
}

.field-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.field-input-wrap .field-icon {
    position: absolute;
    left: var(--space-4);
    display: flex;
    color: var(--ink-3);
    pointer-events: none;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    height: 52px;
    border-radius: var(--r-input);
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    padding: 0 var(--space-4);
    font-size: var(--fs-base);
    font-family: var(--font);
}

.field textarea {
    height: auto;
    padding: var(--space-3) var(--space-4);
}

.field-input-wrap .field-icon + input {
    padding-left: calc(var(--space-4) * 2 + 18px);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-tint);
}

/* Overline label */
.overline {
    font-size: var(--fs-overline);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-3);
}

/* Empty state: icon + one line + an action */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-2);
    padding: var(--space-8) var(--space-4);
    color: var(--ink-3);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-3);
}

/* Sticky save bar for long settings/edit forms */
.form-sticky-bar {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: var(--space-3) 0;
    margin-top: var(--space-4);
}

/* Simple 64px list row with a trailing chevron */
.list-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 64px;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: var(--ink);
}

.list-row:last-child {
    border-bottom: none;
}

.list-row-main {
    flex: 1;
    min-width: 0;
}

.list-row-chevron {
    flex: 0 0 auto;
    color: var(--ink-3);
}

/* Avatar placeholder */
.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-tint);
    color: var(--brand);
    font-weight: 700;
    font-family: var(--font);
}

/* "Me" page profile summary card */
.me-profile-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.me-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    font-size: 1.3rem;
    flex: 0 0 auto;
}

.me-profile-avatar-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
}

.me-profile-info {
    min-width: 0;
}

.send-invitation-modal {
    font-size: 0.875rem;
}

.send-invitation-modal h4 {
    font-size: 1.05rem;
}

.send-invitation-modal .field-label {
    font-size: 0.8rem;
}

.send-invitation-modal .form-select,
.send-invitation-modal textarea {
    font-size: 0.875rem;
}

.terms-privacy-scroll {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--r-input);
    padding: var(--space-3);
}

.home-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}
