﻿/* =========================================================
   Checklist Component
   Design: segmented tabs + section header + item card
   File: checklist.css
   ========================================================= */

.checklist {
    /* Local tokens */
    --checklist-card-bg: #ffffff;
    --checklist-muted: #6c757d;
    --checklist-border: #e6e9ef;
    --checklist-border-soft: #eef1f5;
    /* Brand from site theme */
    --checklist-brand: var(--brand-primary, #0d2a6b);
    --checklist-brand-contrast: #ffffff;
    /* Tab colors */
    --checklist-tab-bg: #f1f3f5;
    --checklist-tab-text: #6b7280;
    --checklist-tab-active-bg: var(--checklist-brand);
    --checklist-tab-active-text: var(--checklist-brand-contrast);
    /* Radii */
    --checklist-radius-md: 8px;
    --checklist-radius-sm: 6px;
    font-family: var(--font-family-hind-madurai);
    max-width: 570px;
    margin: 24px auto;
/*    padding: 0 12px;*/
}

/* Card wrapper */
.checklist__card {
    background: var(--checklist-card-bg);
    border: 1px solid var(--checklist-border);
    border-radius: var(--checklist-radius-md);
    padding: 28px 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

/* Header */
.checklist__header {
    margin-bottom: 14px;
}

.checklist__title {
    font-family: var(--font-family-montserrat);
    font-weight: var(--font-weight-regular);
    font-size: 26px;
    margin: 0 0 4px 0;
    word-wrap: break-word
}

.checklist__subtitle {
    font-size: 1rem;
    color: #111827;
    opacity: .9;
    margin: 0;
}

/* =========================================================
   Branded loading spinner (inherits brand primary)
   ========================================================= */
.checklist__loading-spinner {
    color: var(--checklist-brand); /* = var(--brand-primary, #0d2a6b) */
}

/* =========================================================
   Segmented Tabs (Bootstrap buttons)
   ========================================================= */
.checklist__pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 18px 0 22px 0;
}

.pill {
    width: 100%;
    text-align: center;
    padding: 10px 12px;
    border-radius: 3px;
    border: 1px solid var(--checklist-border);
    background: var(--checklist-tab-bg);
    color: var(--checklist-tab-text);
    font-size: .9rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.pill--active {
    background: var(--checklist-tab-active-bg);
    color: var(--checklist-tab-active-text);
    border-color: var(--checklist-tab-active-bg);
    box-shadow: 0 2px 0 rgba(0,0,0,.06);
}

/* Optional dot (keep harmless if unused) */
.pill__dot {
    display: none;
}

/* =========================================================
   Sections (Action Required tab)
   ========================================================= */
.section {
    padding: 14px 0;
    border-top: 1px solid var(--checklist-border-soft);
}

    .section:first-of-type {
        border-top: 0;
        padding-top: 0;
    }

.section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0 10px 0;
}

/* Left side of heading (icon + title) */
.section__head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Section icon */
.section__icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
    color: var(--brand-primary, #0d2a6b);
}

    /* size the svg */
    .section__icon svg {
        width: 32px;
        height: 32px;
        display: block;
    }

        /* stroke icons */
        .section__icon svg path {
            stroke: var(--brand-primary, #0d2a6b);
        }

            /* safety for fill icons */
            .section__icon svg path[fill]:not([fill="none"]) {
                fill: var(--brand-primary, #0d2a6b);
            }

/* Title */
.section__title {
    font-family: var(--font-family-montserrat);
    font-weight: var(--font-weight-bold);
    font-size: 1.05rem;
    margin: 0;
    color: var(--checklist-brand);
}

/* Chevron rotation state */
.section__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 180ms ease;
    transform-origin: 50% 50%;
}

    .section__chevron .chevron-down {
        transition: transform 180ms ease;
        transform: rotate(0deg);
    }

        .section__chevron .chevron-down path {
            stroke: var(--brand-primary, #0d2a6b);
        }

        .section__chevron.is-open .chevron-down {
            transform: rotate(180deg);
        }

/* =========================================================
   Item Card Rows (Action Required tab)
   ========================================================= */
.item {
    padding: 14px 14px;
    background: #fbfcfe;
    border: 1px solid var(--checklist-border-soft);
    border-radius: var(--checklist-radius-md);
}

    .item + .item {
        margin-top: 10px;
    }

.item__content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.item__title {
    font-family: var(--font-family-hind-madurai);
    font-weight: var(--font-weight-semibold);
    font-size: .98rem;
    margin: 0 0 2px 0;
    color: #111827;
}

.item__desc {
    font-family: var(--font-family-hind-madurai);
    font-size: .88rem;
    color: #111827;
    opacity: .85;
    margin: 0;
}

/* Hide old status dots */
.item--done .item__title::before,
.item--pending .item__title::before {
    content: none;
}

/* =========================================================
   Buttons (outlined, squared)
   ========================================================= */
.item__btn.btn {
    font-size: .85rem;
    font-weight: var(--font-weight-semibold);
    padding: 7px 14px;
    border-radius: var(--checklist-radius-sm);
    line-height: 1.2;
    align-self: center;
    white-space: nowrap;
}

.item__btn.btn-outline-primary {
    color: #111827;
    background: #fff;
    border: 2px solid #374151;
}

    .item__btn.btn-outline-primary:hover {
        background: #f3f4f6;
        border-color: #111827;
        color: #111827;
    }

/* Focus visibility */
.item__btn:focus-visible,
.pill:focus-visible {
    outline: 3px solid rgba(0,0,0,.15);
    outline-offset: 2px;
}

/* =========================================================
   TAB PANELS
   ========================================================= */
.checklist__tab {
    padding-top: 6px;
}

    .checklist__tab .card {
        padding: 10%;
    }

    .checklist__tab .card .empty-state {
        color: rgba(99, 115, 129, 0.50);
        font-size: 16px;
        font-weight: var(--font-weight-medium);
    }


    /* =========================================================
   SUBMITTED TAB (FIXED — uses base .section/.item)
   ========================================================= */
    /* layout */
    .checklist #tab-submitted .submitted {
        display: flex;
        flex-direction: column;
        /*gap: 12px;*/
    }

/* make submitted headers brand colored */
.checklist #tab-submitted .section__title {
    color: var(--checklist-brand);
}

/* cream item cards */
.checklist #tab-submitted .item.submitted-item {
    background: #FFF7E6;
    border: 1px solid #F3E4C6;
    border-radius: var(--checklist-radius-sm);
}

/* badges */
.checklist #tab-submitted .submitted-badge {
    font-family: var(--font-family-hind-madurai);
    font-size: .85rem; /* same as .item__btn */
    font-weight: var(--font-weight-semibold);
    line-height: 1.2; /* same feel as button */

    align-self: center;
    padding: 7px 14px; /* match button padding */
    border-radius: var(--checklist-radius-sm);
    white-space: nowrap;
    background: #F0E6CF;
    border: 1px solid #E6D9B7;
    color: #111827; /* closer to button text */
}
/* =========================================================
   COMPLETED TAB (same base structure)
   ========================================================= */

/* layout */
.checklist #tab-completed .completed {
    display: flex;
    flex-direction: column;
}

/* completed item cards (green) */
.checklist #tab-completed .item.item--completed {
    background: #EEF6EF;
    border: 1px solid #CFE3D1;
    border-radius: var(--checklist-radius-md);
    display: block;
}

/* title + check row */
.checklist #tab-completed .completed-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* green check */
.checklist #tab-completed .completed-check {
    color: #2E7D32;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

/* full width file row inside green card */
.checklist #tab-completed .completed-file {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #D7DCE3;
    background: transparent;
    border-radius: var(--checklist-radius-sm);
    box-sizing: border-box;
    color: #637381;
    text-decoration: underline;
}

/* icon */
.checklist #tab-completed .completed-file__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #111827;
    flex: 0 0 auto;
}

/* name truncation if long */
.checklist #tab-completed .completed-file__name {
    font-family: var(--font-family-hind-madurai);
    font-size: .9rem;
    font-weight: var(--font-weight-regular);
    white-space: pre-wrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* safety: allow file row to truly fill width */
.checklist #tab-completed .item__content {
    min-width: 0;
    gap: 0;
}


/* ===== Upload UI ===== */
.upload-ui {
    border-top: 1px solid #eee;
    padding-top: .75rem;
}

.upload-row {
    background: rgba(0, 0, 0, 0.05);
    padding-top: 8px;
    border-radius: 4px;
    color: #637381;
    font-size: 12px;
    font-weight: var(--font-weight-medium);
}

    .upload-row[data-ready=true] {
        padding-bottom: 5px;
    }

    .upload-row > div:first-child {
        padding: 5px 15px;
    }

    .upload-row .upload-name {
        font-size: 13px;
        max-width: 70%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .upload-row .upload-delete-btn {
        background: transparent;
        border: none;
        position:relative;
        bottom: 3px;
    }

        .upload-row .upload-delete-btn svg path {
            stroke: var(--brand-primary, #0d2a6b);
        }

    /* Spinner base */
    .upload-spinner {
        display: inline-block;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        vertical-align: middle;
        border: 2px solid #cfd6de;
        border-top-color: #0d6efd; /* bootstrap primary */
    }

    /* Spinning state */
    .upload-spinner.is-spinning {
        animation: uploadSpin .9s linear infinite;
    }

    /* Done state = checkmark bubble */
    .upload-spinner.is-done {
        border-color: #198754;
        background: #198754;
        position: relative;
        animation: none;
    }

        .upload-spinner.is-done::after {
            content: "";
            position: absolute;
            left: 3px;
            top: 1px;
            width: 4px;
            height: 8px;
            border: solid #fff;
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
        }

    /* Error state = red X bubble */
    .upload-spinner.is-error {
        border-color: #dc3545;
        background: #dc3545;
        position: relative;
        animation: none;
        border:none;
        top: -2px;
    }

        .upload-spinner.is-error::after {
            content: "×";
            position: absolute;
            inset: 0;
            color: #fff;
            font-size: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 1;
            top:2px;
        }

@keyframes uploadSpin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   Responsive tweaks
   ========================================================= */
@media (max-width: 576px) {
    .checklist__card {
        background: unset;
        border: unset;
        border-radius: unset;
        padding: unset;
        box-shadow: unset;
    }

        .checklist__card {
            padding: 0 10px;
        }


    .checklist__pills {
        display: flex;
        gap: 6px;
        /* horizontal scroll only */
        overflow-x: auto;
        overflow-y: visible; /* let pill shadows show above/below */
        -webkit-overflow-scrolling: touch;
        /* hide scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 8px; /* room for shadow at bottom */
        padding-right: 16px; /* room for rightmost pill shadow */
        margin-right: -16px; /* keep visual alignment with layout */
        margin-bottom: 10px;
    }
        .checklist__pills::-webkit-scrollbar {
            display: none;
        }


    .pill {
        flex: 0 0 45%;
        min-height: 50px;
        box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
        border-radius: 4px;
        font-size: .85rem;
    }

    .item {
        grid-template-columns: 1fr;
        align-items: start;
        box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
    }

    .item__btn.btn {
        justify-self: start;
    }

    .checklist #tab-submitted .item.submitted-item {
        grid-template-columns: 1fr;
    }

    .checklist #tab-submitted .submitted-badge {
        justify-self: start;
        margin-top: 4px;
    }


    .checklist #tab-completed .item.completed-item {
        grid-template-columns: 1fr auto;
    }

    .checklist #tab-completed .completed-file {
        white-space: normal;
    }
}
