/*
 * MZJ Group — Housing Disrepair Specialists
 * File    : public/assets/css/components.css
 * Purpose : Reusable UI components: buttons, badges, cards, form elements,
 *           status chips, data tables, pagination, steps, testimonials.
 *           No page-specific styles — everything here is used in multiple places.
 */

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
    line-height: 1;
    padding: 0.75em 1.5em;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background-color var(--transition-base),
        color var(--transition-base),
        border-color var(--transition-base),
        box-shadow var(--transition-base),
        transform var(--transition-fast);
    letter-spacing: 0.01em;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active { transform: translateY(1px); }

.btn svg {
    width: 1.1em;
    height: 1.1em;
    fill: currentColor;
    flex-shrink: 0;
}

/* Primary — red fill */
.btn--primary {
    background-color: var(--clr-red);
    color: var(--clr-white);
    border-color: var(--clr-red);
}
.btn--primary:hover {
    background-color: var(--clr-red-dark);
    border-color: var(--clr-red-dark);
    color: var(--clr-white);
    box-shadow: var(--shadow-red);
}

/* Outline — red border, transparent fill */
.btn--outline {
    background-color: transparent;
    color: var(--clr-red);
    border-color: var(--clr-red);
}
.btn--outline:hover {
    background-color: var(--clr-red);
    color: var(--clr-white);
}

/* Ghost — subtle, no border */
.btn--ghost {
    background-color: transparent;
    color: var(--clr-grey);
    border-color: var(--clr-silver-light);
}
.btn--ghost:hover {
    background-color: var(--clr-grey-light);
    color: var(--clr-black);
    border-color: var(--clr-silver);
}

/* White — for use on dark backgrounds */
.btn--white {
    background-color: var(--clr-white);
    color: var(--clr-red);
    border-color: var(--clr-white);
}
.btn--white:hover {
    background-color: var(--clr-grey-light);
    color: var(--clr-red-dark);
}

/* Outline white — dark background ghost */
.btn--outline-white {
    background-color: transparent;
    color: var(--clr-white);
    border-color: rgba(255,255,255,0.5);
}
.btn--outline-white:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: var(--clr-white);
}

/* Sizes */
.btn--sm  { font-size: var(--text-sm);  padding: 0.55em 1em; }
.btn--lg  { font-size: var(--text-md);  padding: 0.9em 2em;  }
.btn--full { width: 100%; }

/* Submit state */
.btn--submit:disabled,
.btn--submit.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════ */

.form__group {
    margin-bottom: var(--sp-5);
}

.form__row {
    display: grid;
    gap: var(--sp-5);
}

.form__row--two {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 600px) {
    .form__row--two { grid-template-columns: 1fr; }
}

.form__label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    color: var(--clr-black);
    margin-bottom: var(--sp-2);
    letter-spacing: 0.01em;
}

.form__label span[aria-hidden] {
    color: var(--clr-red);
    margin-left: 2px;
}

.form__optional {
    font-weight: var(--fw-regular);
    color: var(--clr-grey);
    font-size: var(--text-xs);
}

.form__hint {
    font-size: var(--text-sm);
    color: var(--clr-grey);
    margin-bottom: var(--sp-2);
    line-height: var(--lh-snug);
}

.form__input,
.form__select,
.form__textarea {
    width: 100%;
    padding: 0.7rem 0.875rem;
    font-size: var(--text-base);
    font-family: var(--font-body);
    color: var(--clr-black);
    background-color: var(--clr-white);
    border: 1.5px solid var(--clr-silver-light);
    border-radius: var(--radius-md);
    transition:
        border-color var(--transition-base),
        box-shadow var(--transition-base);
    -webkit-appearance: none;
    appearance: none;
    line-height: var(--lh-normal);
}

.form__input:hover,
.form__select:hover,
.form__textarea:hover {
    border-color: var(--clr-silver);
}

.form__input:focus,
.form__select:focus,
.form__textarea:focus {
    outline: none;
    border-color: var(--clr-red);
    box-shadow: 0 0 0 3px rgba(215,25,32,0.12);
}

.form__input::placeholder,
.form__textarea::placeholder {
    color: var(--clr-silver);
}

.form__select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236B6B6B'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form__textarea {
    resize: vertical;
    min-height: 120px;
}

/* Small variant — admin filters */
.form__input--sm,
.form__select--sm {
    padding: 0.45rem 0.7rem;
    font-size: var(--text-sm);
}

.form__input--postcode { max-width: 180px; }
.form__input--date { max-width: 220px; }

/* Error state */
.form__group--error .form__input,
.form__group--error .form__select,
.form__group--error .form__textarea {
    border-color: var(--clr-red);
    background-color: var(--clr-red-light);
}

.form__error {
    display: block;
    font-size: var(--text-xs);
    color: var(--clr-red);
    margin-top: var(--sp-1);
    font-weight: var(--fw-medium);
}

/* Checkbox */
.form__checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--clr-grey);
    line-height: var(--lh-snug);
}

.form__checkbox input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--clr-silver);
    border-radius: var(--radius-sm);
    cursor: pointer;
    accent-color: var(--clr-red);
    margin-top: 2px;
}

.form__checkbox--required span strong { color: var(--clr-red); }

/* Radio */
.form__radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-top: var(--sp-2);
}

.form__radio {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--clr-grey);
    padding: var(--sp-3) var(--sp-4);
    border: 1.5px solid var(--clr-silver-light);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-base), background var(--transition-base);
}

.form__radio:hover {
    border-color: var(--clr-red);
    background: var(--clr-red-light);
}

.form__radio input[type="radio"] {
    accent-color: var(--clr-red);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.form__radio:has(input:checked) {
    border-color: var(--clr-red);
    background: var(--clr-red-light);
    color: var(--clr-black);
    font-weight: var(--fw-medium);
}

/* Privacy note under form */
.form__privacy-note {
    font-size: var(--text-xs);
    color: var(--clr-grey);
    text-align: center;
    margin-top: var(--sp-3);
}
.form__privacy-note a { color: var(--clr-red); text-decoration: underline; }

/* Form error summary */
.form-error-summary {
    display: flex;
    gap: var(--sp-4);
    background: var(--clr-red-light);
    border: 1.5px solid var(--clr-red);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    margin-bottom: var(--sp-6);
}
.form-error-summary svg { width: 20px; height: 20px; fill: var(--clr-red); flex-shrink: 0; margin-top: 2px; }
.form-error-summary strong { color: var(--clr-red); display: block; margin-bottom: var(--sp-2); }
.form-error-summary ul { padding-left: var(--sp-5); list-style: disc; }
.form-error-summary li { color: var(--clr-red); font-size: var(--text-sm); margin-bottom: var(--sp-1); }

/* ═══════════════════════════════════════════════════════════
   STATUS BADGES
   ═══════════════════════════════════════════════════════════ */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.65em;
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
    white-space: nowrap;
    text-transform: capitalize;
}

.status-badge--lg {
    font-size: var(--text-sm);
    padding: 0.35em 0.9em;
}

.status--new         { background: var(--clr-status-new-bg);         color: var(--clr-status-new); }
.status--reviewing   { background: var(--clr-status-reviewing-bg);   color: var(--clr-status-reviewing); }
.status--in-progress { background: var(--clr-status-progress-bg);    color: var(--clr-status-progress); }
.status--completed   { background: var(--clr-status-completed-bg);   color: var(--clr-status-completed); }
.status--rejected    { background: var(--clr-status-rejected-bg);    color: var(--clr-status-rejected); }

/* Issue tags */
.issue-tag {
    display: inline-flex;
    align-items: center;
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
    background: var(--clr-grey-light);
    color: var(--clr-grey);
    border-radius: var(--radius-full);
    padding: 0.15em 0.6em;
    margin: 2px;
    white-space: nowrap;
}

/* Role badges */
.role-badge { @extend .status-badge; }
.role-badge--superadmin { background: #FFF3CD; color: #856404; }
.role-badge--admin      { background: var(--clr-status-new-bg); color: var(--clr-status-new); }
.role-badge--viewer     { background: var(--clr-grey-light); color: var(--clr-grey); }

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */

.card {
    background: var(--clr-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--clr-silver-light);
    padding: var(--sp-6);
    box-shadow: var(--shadow-sm);
}

/* Detail card — admin view sections */
.detail-card {
    background: var(--clr-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--clr-silver-light);
    padding: var(--sp-6);
    margin-bottom: var(--sp-5);
    box-shadow: var(--shadow-sm);
}

.detail-card__title {
    font-size: var(--text-md);
    font-weight: var(--fw-semibold);
    color: var(--clr-black);
    margin-bottom: var(--sp-5);
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--clr-silver-light);
    letter-spacing: 0;
}

.detail-card__empty {
    color: var(--clr-grey);
    font-size: var(--text-sm);
    font-style: italic;
}

/* Detail list (definition list in claim view) */
.detail-list {}
.detail-list__row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: var(--sp-3);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--clr-grey-light);
    align-items: baseline;
}
.detail-list__row:last-child { border-bottom: none; }
.detail-list__row dt {
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    color: var(--clr-grey);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    font-size: var(--text-xs);
}
.detail-list__row dd { font-size: var(--text-sm); color: var(--clr-black); }
.detail-list__prose { line-height: var(--lh-relaxed); white-space: pre-wrap; }
.detail-list__tags  { display: flex; flex-wrap: wrap; gap: 4px; }

@media (max-width: 600px) {
    .detail-list__row { grid-template-columns: 1fr; gap: var(--sp-1); }
}

/* ═══════════════════════════════════════════════════════════
   DATA TABLES
   ═══════════════════════════════════════════════════════════ */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--clr-silver-light);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    background: var(--clr-white);
}

.data-table th {
    background: var(--clr-grey-light);
    color: var(--clr-grey);
    font-weight: var(--fw-semibold);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--ls-wide);
    padding: var(--sp-3) var(--sp-4);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--clr-silver-light);
}

.data-table td {
    padding: var(--sp-4);
    color: var(--clr-black);
    border-bottom: 1px solid var(--clr-grey-light);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafafa; }

.data-table__ref code { font-size: var(--text-xs); }
.data-table__sub {
    display: block;
    font-size: var(--text-xs);
    color: var(--clr-grey);
    margin-top: 2px;
}
.data-table__date { white-space: nowrap; color: var(--clr-grey); }

/* ═══════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════ */

.pagination {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    justify-content: center;
    margin-top: var(--sp-6);
}

.pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--clr-grey);
    border: 1px solid var(--clr-silver-light);
    transition: all var(--transition-base);
    text-decoration: none;
}

.pagination__link:hover {
    border-color: var(--clr-red);
    color: var(--clr-red);
}

.pagination__link--active {
    background: var(--clr-red);
    border-color: var(--clr-red);
    color: var(--clr-white);
}

/* ═══════════════════════════════════════════════════════════
   STEPS (how it works, thank you page)
   ═══════════════════════════════════════════════════════════ */

.steps {
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: relative;
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 var(--sp-4);
}

.step__marker {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--clr-red);
    color: var(--clr-white);
    font-size: var(--text-lg);
    font-weight: var(--fw-bold);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: var(--sp-4);
    box-shadow: var(--shadow-red);
}

.step__connector {
    flex: 0 0 40px;
    height: 2px;
    background: linear-gradient(90deg, var(--clr-red), var(--clr-silver-light));
    margin-top: 26px; /* Aligns with centre of marker */
}

.step__title {
    font-size: var(--text-md);
    font-weight: var(--fw-semibold);
    color: var(--clr-black);
    margin-bottom: var(--sp-2);
}

.step__desc {
    font-size: var(--text-sm);
    color: var(--clr-grey);
    line-height: var(--lh-relaxed);
}

/* Vertical steps — thank you page */
.steps--vertical {
    flex-direction: column;
    gap: 0;
    max-width: 560px;
    margin-inline: auto;
}
.steps--vertical .step {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
    gap: var(--sp-5);
    padding: 0 0 var(--sp-8) 0;
    position: relative;
}
.steps--vertical .step::before {
    content: '';
    position: absolute;
    left: 25px;
    top: 52px;
    bottom: 0;
    width: 2px;
    background: var(--clr-silver-light);
}
.steps--vertical .step:last-child::before { display: none; }
.steps--vertical .step__marker { margin-bottom: 0; flex-shrink: 0; }

@media (max-width: 700px) {
    .steps { flex-direction: column; align-items: center; }
    .step__connector { width: 2px; height: 32px; flex: 0 0 32px; margin-top: 0;
        background: linear-gradient(180deg, var(--clr-red), var(--clr-silver-light)); }
}

/* ═══════════════════════════════════════════════════════════
   TESTIMONIALS
   ═══════════════════════════════════════════════════════════ */

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-6);
}

.testimonial {
    background: var(--clr-white);
    border-radius: var(--radius-lg);
    padding: var(--sp-8);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--clr-silver-light);
    border-top: 3px solid var(--clr-red);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.testimonial__stars { color: #F59E0B; font-size: var(--text-lg); letter-spacing: 2px; }
.testimonial__quote { color: var(--clr-grey); font-size: var(--text-sm); line-height: var(--lh-relaxed); flex: 1; }
.testimonial__footer { display: flex; align-items: center; gap: var(--sp-3); }
.testimonial__name { font-weight: var(--fw-semibold); color: var(--clr-black); font-size: var(--text-sm); }
.testimonial__location { font-size: var(--text-xs); color: var(--clr-grey); }
.testimonial__location::before { content: '·'; margin-right: var(--sp-2); }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: var(--sp-16) var(--sp-8);
    color: var(--clr-grey);
    background: var(--clr-grey-light);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--clr-silver);
}

.empty-state p { margin-bottom: var(--sp-4); }

/* ═══════════════════════════════════════════════════════════
   DOCUMENT LIST (claim detail)
   ═══════════════════════════════════════════════════════════ */

.doc-list { display: flex; flex-direction: column; gap: var(--sp-3); }

.doc-list__item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--clr-grey-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--clr-silver-light);
}

.doc-list__icon { width: 24px; height: 24px; fill: var(--clr-grey); flex-shrink: 0; }
.doc-list__info { flex: 1; min-width: 0; }
.doc-list__name {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--clr-black);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-list__meta { font-size: var(--text-xs); color: var(--clr-grey); }

/* ═══════════════════════════════════════════════════════════
   STATUS TIMELINE (claim history)
   ═══════════════════════════════════════════════════════════ */

.status-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.status-timeline__entry {
    padding: var(--sp-4) 0;
    border-bottom: 1px solid var(--clr-grey-light);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.status-timeline__entry:last-child { border-bottom: none; }
.status-timeline__from { font-size: var(--text-xs); color: var(--clr-grey); }
.status-timeline__meta { font-size: var(--text-xs); color: var(--clr-grey); }
.status-timeline__note {
    font-size: var(--text-xs);
    color: var(--clr-grey);
    font-style: italic;
    background: var(--clr-grey-light);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    margin-top: var(--sp-1);
}

/* ═══════════════════════════════════════════════════════════
   THANK YOU PAGE
   ═══════════════════════════════════════════════════════════ */

.thankyou__inner {
    text-align: center;
    max-width: 680px;
    margin-inline: auto;
    padding-block: var(--sp-12);
}

.thankyou__icon {
    width: 72px;
    height: 72px;
    background: #ECFDF5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--sp-6);
}
.thankyou__icon svg { width: 40px; height: 40px; fill: #059669; }

.thankyou__title {
    font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
    margin-bottom: var(--sp-3);
}
.thankyou__sub { font-size: var(--text-lg); color: var(--clr-grey); margin-bottom: var(--sp-8); }

.thankyou__reference {
    background: var(--clr-black);
    color: var(--clr-white);
    border-radius: var(--radius-lg);
    padding: var(--sp-6) var(--sp-8);
    margin-bottom: var(--sp-10);
}

.thankyou__reference-label {
    display: block;
    font-size: var(--text-xs);
    letter-spacing: var(--ls-widest);
    text-transform: uppercase;
    color: var(--clr-silver);
    margin-bottom: var(--sp-2);
}

.thankyou__reference-number {
    display: block;
    font-size: var(--text-3xl);
    font-weight: var(--fw-bold);
    color: var(--clr-red);
    letter-spacing: var(--ls-wide);
    margin-bottom: var(--sp-3);
}

.thankyou__reference-note {
    font-size: var(--text-xs);
    color: var(--clr-silver);
    margin: 0;
}

.thankyou__next { margin-bottom: var(--sp-10); text-align: left; }
.thankyou__next h2 { text-align: center; margin-bottom: var(--sp-8); }
.thankyou__contact { margin-bottom: var(--sp-8); color: var(--clr-grey); font-size: var(--text-sm); }
.thankyou__contact a { color: var(--clr-red); font-weight: var(--fw-semibold); }

/* Fix contact info icon sizes */
.contact-info__item svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
}

.about-grid__points li svg {
    width: 20px !important;
    height: 20px !important;
}