/* AFSS-50 — large inspection date panel and pre-submit confirmation.
   Posted values stay on the original inputs (Y-m-d and HH:MM). */

.afss-dt-datewrap,
.afss-dt-timewrap {
    position: relative;
    width: 100%;
    min-width: 0;
}

.afss-dt-datebtn,
.afss-dt-timeface {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 8px 14px;
    border: 1.5px solid #d5deea;
    border-radius: 10px;
    background: #fff;
    color: #1a2845;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    box-sizing: border-box;
}

.afss-dt-datebtn {
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.afss-dt-datebtn:hover,
.afss-dt-timewrap:hover .afss-dt-timeface {
    border-color: #9bb0cc;
}

.afss-dt-datebtn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.afss-dt-datelabel,
.afss-dt-timelabel {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.afss-dt-datelabel.is-empty,
.afss-dt-timelabel.is-empty {
    color: #8b97a8;
    font-weight: 400;
}

.afss-dt-icon {
    flex: 0 0 auto;
    color: #5c6b80;
}

.afss-dt-datewrap > input.afss-dt-date {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: 0 !important;
}

.afss-dt-timewrap > input.afss-dt-time {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    border: 0;
    font-size: 16px;
}

.afss-dt-panel {
    position: fixed;
    z-index: 2000900;
    display: flex;
    width: min(760px, calc(100vw - 16px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    color: #1a2845;
    font-family: inherit;
}

.afss-dt-panel[hidden] {
    display: none !important;
}

.afss-dt-card {
    flex: 0 0 210px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 28px 22px 22px;
    background: linear-gradient(165deg, #1d4ed8 0%, #1e3a8a 55%, #172554 100%);
    color: #fff;
}

.afss-dt-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    opacity: 0.85;
}

.afss-dt-bignum {
    margin-top: 18px;
    font-size: 72px;
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -1px;
}

.afss-dt-monyear {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.25;
}

.afss-dt-week {
    margin-top: 14px;
    font-size: 18px;
    font-weight: 500;
}

.afss-dt-ok {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.afss-dt-tick {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.afss-dt-cal {
    flex: 1;
    min-width: 0;
    padding: 18px 18px 14px;
    display: flex;
    flex-direction: column;
}

.afss-dt-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.afss-dt-title {
    flex: 1;
    text-align: center;
    font-size: 22px;
    font-weight: 750;
    font-weight: 700;
}

.afss-dt-nav button {
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1.5px solid #d5deea;
    background: #fff;
    color: #1a2845;
    font-size: 18px;
    cursor: pointer;
}

.afss-dt-today {
    padding: 0 14px;
    font-size: 15px !important;
    font-weight: 600;
    color: #1d4ed8 !important;
}

.afss-dt-dow,
.afss-dt-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.afss-dt-dow {
    margin-top: 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #8b97a8;
}

.afss-dt-grid {
    margin-top: 6px;
}

.afss-dt-day {
    height: 40px;
    border: 0;
    background: transparent;
    border-radius: 50%;
    color: #1a2845;
    font-size: 15px;
    cursor: pointer;
}

.afss-dt-day:hover:not(:disabled) {
    background: #eef3fb;
}

.afss-dt-day.is-out {
    color: #c5ceda;
}

.afss-dt-day.is-today:not(.is-sel) {
    box-shadow: inset 0 0 0 1.5px #93c5fd;
}

.afss-dt-day.is-sel {
    background: #2563eb;
    color: #fff;
    font-weight: 700;
}

.afss-dt-day:disabled {
    cursor: default;
    color: #d5deea;
    background: transparent;
}

.afss-dt-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e6edf5;
}

.afss-dt-hint {
    flex: 1;
    color: #64748b;
    font-size: 13px;
}

.afss-dt-cancel,
.afss-dt-use {
    height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.afss-dt-cancel {
    border: 1.5px solid #c5d0e0;
    background: #fff;
    color: #1d4ed8;
}

.afss-dt-use {
    border: 0;
    background: #2563eb;
    color: #fff;
}

.afss-dt-use:disabled {
    opacity: 0.45;
    cursor: default;
}

.afss-cf-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000950;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.afss-cf-overlay[hidden] {
    display: none !important;
}

.afss-cf {
    width: min(920px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    padding: 22px 24px 18px;
    color: #1a2845;
}

.afss-cf-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.afss-cf-title {
    flex: 1;
    margin: 0;
    font-size: 26px;
    font-weight: 750;
    font-weight: 700;
    color: #1e3a8a;
}

.afss-cf-x {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.afss-cf-sub {
    margin: 4px 0 16px;
    color: #64748b;
    font-size: 15px;
}

.afss-cf-card {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    padding: 4px 0;
}

.afss-cf-cell {
    flex: 1 1 120px;
    min-width: 0;
    padding: 12px 16px;
    border-left: 1px solid #e2e8f0;
}

.afss-cf-cell:has(.afss-cf-line) {
    flex: 0 0 auto;
    min-width: max-content;
}

.afss-cf-cell:first-child {
    border-left: 0;
}

.afss-cf-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    white-space: nowrap;
}

.afss-cf-value {
    font-size: 13px;
    font-weight: 650;
    font-weight: 600;
    color: #1a2845;
    word-break: break-word;
}

.afss-cf-line {
    white-space: nowrap;
}

.afss-cf-line + .afss-cf-line {
    margin-top: 4px;
}

.afss-cf-file {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.afss-cf-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dcfce7;
    color: #15803d;
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 13px;
    font-weight: 650;
    font-weight: 600;
}

.afss-cf-preview {
    color: #1d4ed8;
    font-weight: 650;
    font-weight: 600;
    text-decoration: underline;
}

.afss-cf-coverbtn {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 8px;
    background: #17a2b8;
    color: #fff !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    line-height: 1.3;
}

.afss-cf-coverbtn:hover {
    background: #138496;
    color: #fff !important;
}

.afss-cf-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e6edf5;
}

.afss-cf-note {
    margin: 0;
    color: #334155;
    font-size: 14px;
}

.afss-cf-actions {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.afss-cf-back,
.afss-cf-go {
    min-height: 44px;
    padding: 8px 18px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.afss-cf-back {
    background: #fff;
    color: #1e3a8a;
    border: 1.5px solid #93c5fd;
}

.afss-cf-go {
    background: #15803d;
    color: #fff;
    border: 0;
}

.afss-cf-go:disabled {
    opacity: 0.6;
    cursor: default;
}

@media (max-width: 720px) {
    .afss-dt-panel {
        flex-direction: column;
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        overflow: auto;
    }

    .afss-dt-card {
        flex: none;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 16px;
        padding: 16px;
    }

    .afss-dt-bignum {
        margin-top: 0;
        font-size: 48px;
    }

    .afss-dt-monyear,
    .afss-dt-week,
    .afss-dt-ok {
        margin-top: 0;
        padding-top: 0;
        border-top: 0;
    }

    .afss-dt-foot {
        flex-wrap: wrap;
    }

    .afss-dt-hint {
        flex: 1 1 100%;
    }

    #dates_wrap > .field_row,
    #reinspection_dates_wrap > .field_row,
    #repairs_reinspection_dates_wrap > .field_row {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        grid-template-columns: 1fr !important;
    }

    #dates_wrap > .field_row > div,
    #reinspection_dates_wrap > .field_row > [class*="col-"],
    #repairs_reinspection_dates_wrap > .field_row > [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 auto;
    }

    .afss-cf-foot {
        flex-direction: column;
        align-items: stretch;
    }

    .afss-cf-actions {
        justify-content: flex-end;
    }

    .afss-cf-cell,
    .afss-cf-cell:has(.afss-cf-line) {
        flex: 1 1 100%;
        min-width: 0;
        border-left: 0;
        border-top: 1px solid #e2e8f0;
    }

    .afss-cf-line {
        white-space: normal;
    }

    .afss-cf-cell:first-child {
        border-top: 0;
    }
}
