/* AlphaVima Volunteer Script: link above the application form + the Assigned Schedules calendar and popup.
   The site theme styles bare links, buttons and tables, so everything below is scoped and resets what it needs. */

:root {
    --avs-brand: #1f5f8b;
    --avs-brand-dark: #174a6c;
    --avs-navy: #1d3557;
    --avs-work: #1f7a4d;
    --avs-work-bg: #e3f4ea;
    --avs-work-ink: #135a37;
    --avs-training: #b5651d;
    --avs-training-bg: #fdecd9;
    --avs-training-ink: #86470e;
    --avs-ink: #26323f;
    --avs-muted: #647486;
    --avs-line: #e3e9ef;
    --avs-soft: #f5f8fb;
    --avs-ok: #1d6b44;
    --avs-bad: #a8341f;
}

/* ---------- link above the application form ---------- */
.avs-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 24px;
}

.avs-btn {
    display: inline-block;
    padding: 12px 22px;
    border: 2px solid var(--avs-brand);
    border-radius: 8px;
    background: var(--avs-brand);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.avs-btn:hover,
.avs-btn:focus {
    background: var(--avs-brand-dark);
    border-color: var(--avs-brand-dark);
    color: #fff;
}

.avs-notice {
    padding: 24px;
    border: 1px solid var(--avs-line);
    border-radius: 12px;
    background: var(--avs-soft);
}

/* ================================================================= page card */
.avs-app {
    max-width: 1100px;
    margin: 32px auto 48px;
    padding: 28px 28px 32px;
    box-sizing: border-box;
    border: 1px solid var(--avs-line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(29, 53, 87, .08);
    color: var(--avs-ink);
}

.avs-app .avs-title {
    margin: 0 0 6px;
    color: var(--avs-navy);
    font-size: 32px;
    line-height: 1.15;
}

.avs-app .avs-intro {
    margin: 0 0 18px;
    color: var(--avs-muted);
    font-size: 17px;
}

.avs-preview {
    margin-bottom: 18px;
    padding: 10px 14px;
    border: 1px solid #f1d3b0;
    border-left: 4px solid var(--avs-training);
    border-radius: 8px;
    background: #fff8ef;
    color: #6b3d0c;
    font-size: 14px;
    line-height: 1.45;
}

.avs-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.avs-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--avs-soft);
    color: var(--avs-ink);
    font-size: 13px;
    font-weight: 600;
}

.avs-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.avs-dot.avs-work { background: var(--avs-work); }
.avs-dot.avs-training { background: var(--avs-training); }

/* ================================================================= calendar */
.avs-app .fc {
    --fc-border-color: var(--avs-line);
    --fc-today-bg-color: #eef6fc;
    --fc-neutral-bg-color: var(--avs-soft);
    font-size: 15px;
}

/* reset what the theme does to links, tables and buttons inside the calendar */
.avs-app .fc a,
.avs-app .fc a:hover,
.avs-app .fc a:focus,
.avs-app .fc a:active {
    color: inherit;
    text-decoration: none !important;      /* the theme underlines every link */
    border-bottom: 0 !important;
    box-shadow: none;
}

.avs-app .fc table {
    margin: 0;
    border-spacing: 0;
}

.avs-app .fc th,
.avs-app .fc td {
    padding: 0;
    vertical-align: top;
}

/* toolbar */
.avs-app .fc .fc-toolbar {
    gap: 10px;
    margin-bottom: 18px;
}

.avs-app .fc .fc-toolbar-title {
    margin: 0;
    color: var(--avs-navy);
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.avs-app .fc .fc-button {
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 8px 14px;
    border: 1px solid #d3dce5;
    border-radius: 0;
    background: #fff;
    color: var(--avs-navy);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
    transition: background .15s, border-color .15s;
}

.avs-app .fc .fc-button:first-child { border-radius: 9px 0 0 9px; }
.avs-app .fc .fc-button:last-child { border-radius: 0 9px 9px 0; }
.avs-app .fc .fc-button:only-child { border-radius: 9px; }
.avs-app .fc .fc-button + .fc-button { margin-left: -1px; }

.avs-app .fc .fc-button:hover {
    border-color: #b9c6d3;
    background: #f1f6fa;
    color: var(--avs-navy);
}

.avs-app .fc .fc-button:focus-visible {
    outline: 3px solid rgba(31, 95, 139, .35);
    outline-offset: 1px;
}

.avs-app .fc .fc-button-primary:not(:disabled).fc-button-active,
.avs-app .fc .fc-button-primary:not(:disabled):active {
    border-color: var(--avs-brand);
    background: var(--avs-brand);
    color: #fff;
}

.avs-app .fc .fc-button:disabled {
    opacity: .45;
}

.avs-app .fc .fc-icon {
    font-size: 1.35em;
    line-height: 1;
}

/* month grid */
.avs-app .fc .fc-scrollgrid {
    border-radius: 12px;
    overflow: hidden;
}

.avs-app .fc .fc-col-header-cell {
    background: var(--avs-soft);
}

.avs-app .fc .fc-col-header-cell-cushion {
    display: block;
    padding: 11px 4px;
    color: var(--avs-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.avs-app .fc .fc-daygrid-day-frame {
    min-height: 104px;
}

.avs-app .fc .fc-daygrid-day-top {
    flex-direction: row;
}

.avs-app .fc .fc-daygrid-day-number {
    margin: 6px 6px 2px;
    padding: 0;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--avs-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 28px;
    text-align: center;
}

.avs-app .fc .fc-day-other .fc-daygrid-day-number {
    color: #b3bfcb;
    font-weight: 500;
}

.avs-app .fc .fc-day-today {
    background: var(--fc-today-bg-color);
}

.avs-app .fc .fc-day-today .fc-daygrid-day-number {
    background: var(--avs-brand);
    color: #fff;
}

.avs-app .fc .fc-daygrid-day-events {
    padding-bottom: 4px;
}

/* events: soft tinted chips with a coloured edge */
.avs-app .fc .fc-event {
    margin: 2px 6px;
    padding: 3px 7px;
    border: 0;
    border-left: 4px solid var(--avs-work);
    border-radius: 6px;
    background: var(--avs-work-bg);
    color: var(--avs-work-ink);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
    box-shadow: none;
    transition: transform .12s, box-shadow .12s;
}

.avs-app .fc .fc-event.avs-training {
    border-left-color: var(--avs-training);
    background: var(--avs-training-bg);
    color: var(--avs-training-ink);
}

.avs-app .fc .fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(29, 53, 87, .18);
}

.avs-app .fc .fc-event .fc-event-main,
.avs-app .fc .fc-event .fc-event-title,
.avs-app .fc .fc-event .fc-event-time {
    color: inherit;
}

.avs-app .fc .fc-event .fc-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* what is already recorded */
.avs-app .fc .fc-event.avs-present .fc-event-title::before {
    content: "\2713\00a0";
    font-weight: 800;
}

.avs-app .fc .fc-event.avs-absent {
    opacity: .72;
    border-left-style: dashed;
}

.avs-app .fc .fc-event.avs-absent .fc-event-title::before {
    content: "\2715\00a0";
    font-weight: 800;
}

.avs-app .fc .fc-more-link {
    margin: 0 6px;
    color: var(--avs-brand);
    font-size: 12px;
    font-weight: 700;
}

/* week and list views */
.avs-app .fc .fc-timegrid-slot-label-cushion,
.avs-app .fc .fc-timegrid-axis-cushion {
    color: var(--avs-muted);
    font-size: 12px;
}

.avs-app .fc .fc-list {
    border-radius: 12px;
    overflow: hidden;
}

.avs-app .fc .fc-list-day-cushion {
    padding: 10px 14px;
    background: var(--avs-soft);
    color: var(--avs-navy);
    font-weight: 700;
}

.avs-app .fc .fc-list-event td {
    padding: 10px 12px;
}

.avs-app .fc .fc-list-event:hover td {
    background: #f1f6fa;
}

.avs-app .fc .fc-list-event {
    cursor: pointer;
}

.avs-app .fc .fc-list-event-dot {
    border-color: var(--avs-work);
}

.avs-app .fc .fc-list-event.avs-training .fc-list-event-dot {
    border-color: var(--avs-training);
}

.avs-app .fc .fc-list-event-title a {
    font-weight: 600;
}

/* recorded attendance in the list view, same marks as the month grid */
.avs-app .fc .fc-list-event.avs-present .fc-list-event-title a::before {
    content: "\2713\00a0";
    color: var(--avs-ok);
    font-weight: 800;
}

.avs-app .fc .fc-list-event.avs-absent .fc-list-event-title a::before {
    content: "\2715\00a0";
    color: var(--avs-bad);
    font-weight: 800;
}

.avs-app .fc .fc-list-event.avs-absent td {
    opacity: .75;
}

.avs-app .fc .fc-timegrid-event {
    min-height: 28px;
}

.avs-app .fc .fc-list-empty {
    background: var(--avs-soft);
    color: var(--avs-muted);
}

.avs-empty {
    margin: 14px 0 0;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--avs-soft);
    color: var(--avs-muted);
    font-size: 15px;
    text-align: center;
}

.avs-empty[hidden] {
    display: none;
}

/* ================================================================= popup */
.avs-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(20, 32, 48, .58);
    backdrop-filter: blur(2px);
}

.avs-modal[hidden] {
    display: none;
}

.avs-dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 18px;
    background: #fff;
    color: var(--avs-ink);
    box-shadow: 0 24px 60px rgba(10, 20, 35, .35);
    outline: none;
    animation: avs-pop .16s ease-out;
}

@keyframes avs-pop {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: none; }
}

.avs-dialog::before {
    content: "";
    display: block;
    height: 6px;
    background: var(--avs-work);
}

.avs-dialog[data-kind="training"]::before {
    background: var(--avs-training);
}

.avs-body {
    padding: 22px 24px 26px;
}

.avs-modal .avs-close {
    position: absolute;
    top: 16px;
    right: 14px;
    width: 34px;
    height: 34px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    font-size: 26px;
    line-height: 34px;
    text-align: center;
    cursor: pointer;
    color: var(--avs-muted);
}

.avs-modal .avs-close:hover {
    background: #eef2f6;
    color: #111;
}

.avs-modal .avs-close:focus-visible {
    outline: 3px solid rgba(31, 95, 139, .35);
}

/* The theme styles every h3/h4 very large (45px / 35px, weight 900). The doubled class outranks it inside the popup. */
.avs-modal.avs-modal .avs-dialog h3 {
    margin: 0 36px 10px 0;
    color: var(--avs-navy);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
}

.avs-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.avs-badge {
    display: inline-block;
    padding: 3px 11px;
    border-radius: 999px;
    background: var(--avs-work-bg);
    color: var(--avs-work-ink);
    font-size: 12.5px;
    font-weight: 700;
}

.avs-badge.avs-training { background: var(--avs-training-bg); color: var(--avs-training-ink); }
.avs-badge.avs-ok { background: #dff3e8; color: var(--avs-ok); }
.avs-badge.avs-bad { background: #fbe4df; color: var(--avs-bad); }
.avs-badge.avs-info { background: #e5eef7; color: var(--avs-brand-dark); }

.avs-details {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 8px 14px;
    margin: 0 0 6px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--avs-soft);
}

.avs-details dt {
    margin: 0;
    color: var(--avs-muted);
    font-size: 13px;
    font-weight: 600;
}

.avs-details dd {
    margin: 0;
    color: var(--avs-ink);
    font-size: 15px;
    font-weight: 600;
}

.avs-section {
    margin-top: 22px;
}

.avs-modal.avs-modal .avs-section h4 {
    margin: 0 0 10px;
    color: var(--avs-muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.avs-section label {
    display: block;
    margin: 12px 0 5px;
    color: var(--avs-ink);
    font-size: 14px;
    font-weight: 600;
}

.avs-section input[type="number"],
.avs-section textarea {
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #cdd7e1;
    border-radius: 10px;
    background: #fff;
    color: var(--avs-ink);
    font: inherit;
    font-size: 15px;
    box-sizing: border-box;
    box-shadow: none;
}

.avs-section textarea {
    resize: vertical;
    min-height: 64px;
}

.avs-section input:focus,
.avs-section textarea:focus {
    border-color: var(--avs-brand);
    outline: 3px solid rgba(31, 95, 139, .18);
}

/* Present / Absent: a clear two-way switch */
.avs-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.avs-modal .avs-choice .avs-btn {
    margin: 0;
    padding: 12px 10px;
    border: 2px solid #cdd7e1;
    border-radius: 12px;
    background: #fff;
    color: var(--avs-ink);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    box-shadow: none;
}

.avs-modal .avs-choice .avs-btn:hover {
    border-color: #9fb2c4;
    background: #f5f8fb;
    color: var(--avs-ink);
}

.avs-modal .avs-choice .avs-btn.avs-yes.is-active {
    border-color: var(--avs-ok);
    background: var(--avs-ok);
    color: #fff;
}

.avs-modal .avs-choice .avs-btn.avs-no.is-active {
    border-color: var(--avs-bad);
    background: var(--avs-bad);
    color: #fff;
}

.avs-modal .avs-save {
    display: block;
    width: 100%;
    margin: 14px 0 0;
    padding: 13px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--avs-brand);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: none;
    cursor: pointer;
}

.avs-modal .avs-save:hover {
    background: var(--avs-brand-dark);
    color: #fff;
}

.avs-modal .avs-save[disabled] {
    opacity: .6;
    cursor: wait;
}

/* recorded / locked states */
.avs-state {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14.5px;
    line-height: 1.45;
}

.avs-state::before {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
    line-height: 22px;
    text-align: center;
}

.avs-state.is-done {
    background: #e8f6ee;
    color: #14543a;
}

.avs-state.is-done::before {
    content: "\2713";
    background: var(--avs-ok);
    color: #fff;
}

.avs-state.is-absent {
    background: #fdecea;
    color: #7d2a1b;
}

.avs-state.is-absent::before {
    content: "\2715";
    background: var(--avs-bad);
    color: #fff;
}

.avs-state.is-locked {
    background: var(--avs-soft);
    color: var(--avs-muted);
}

.avs-state.is-locked::before {
    content: "i";
    background: #cbd6e1;
    color: #fff;
    font-style: italic;
}

.avs-msg {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
}

.avs-msg.is-error { background: #fdecea; color: #7d2a1b; }
.avs-msg.is-ok { background: #e8f6ee; color: #14543a; }

.avs-app > .avs-msg { margin: 0 0 14px; }

/* ================================================================= page loader */
.avs-loader {
    position: fixed;
    inset: 0;
    z-index: 100001;                 /* above the popup (100000) */
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(3px);
    cursor: progress;
}

.avs-loader.is-on {
    display: flex;
}

.avs-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 26px 36px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(20, 32, 48, .22);
}

.avs-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid #dbe6ef;
    border-top-color: var(--avs-brand);
    border-radius: 50%;
    animation: avs-spin .8s linear infinite;
}

.avs-loader-text {
    color: var(--avs-navy);
    font-size: 15px;
    font-weight: 600;
}

@keyframes avs-spin {
    to { transform: rotate(360deg); }
}

/* Failsafe: if the script never starts (for example the calendar library is blocked), the server-rendered
   loader stops covering the page after 40 seconds. The script clears this class as soon as it runs. */
.avs-loader.is-initial {
    animation: avs-failsafe 0s linear 40s forwards;
}

@keyframes avs-failsafe {
    to { visibility: hidden; opacity: 0; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
    .avs-spinner { animation-duration: 2.4s; }
}
/* ================================================================= small screens */
@media (max-width: 700px) {
    .avs-app {
        margin: 12px 8px 32px;
        padding: 18px 14px 22px;
        border-radius: 14px;
    }

    .avs-app .avs-title { font-size: 26px; }

    .avs-app .fc .fc-toolbar {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .avs-app .fc .fc-toolbar-title { font-size: 1.15rem; }
    .avs-app .fc .fc-footer-toolbar { margin: 14px 0 0; justify-content: center; }
    .avs-app .fc .fc-daygrid-day-frame { min-height: 74px; }
    .avs-app .fc .fc-event { margin: 1px 2px; padding: 2px 4px; font-size: 11px; }

    .avs-dialog { border-radius: 16px; }
    .avs-body { padding: 18px 16px 22px; }
    .avs-details { grid-template-columns: 104px 1fr; gap: 6px 10px; padding: 12px 14px; }
}
