/**
 * Career Fair Mode — Styles  v2
 *
 * Design matches the screenshot:
 *  - Button: red/brownish pill in the footer (OFF state)
 *  - Button: green when ON
 *  - Popup: white card, no header title, just message text
 *  - Confirm: dark navy blue button (left)
 *  - Cancel:  red button (right)
 *  - No × close button (matches screenshot)
 *
 * @package CSA_Job_Board
 */

/* ── Wrapper ── */

.csa-cfm-wrapper {
    display: inline-block;
}

/* ── Button alignment ── */

.csa-cfm-btn-wrap {
    display:     flex;
    align-items: center;
    gap:         10px;
    justify-content: var(--cfm-justify, flex-start);
}

/* ── Toggle button ── */

.csa-cfm-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             7px;
    cursor:          pointer;
    position:        relative;
    overflow:        hidden;

    /* Shape */
    border-radius:   var(--cfm-btn-radius, 8px);
    border:          none !important;
    padding:         var(--cfm-btn-padding, 12px 24px);

    /* Typography */
    font-size:       var(--cfm-btn-size,   15px);
    font-weight:     var(--cfm-btn-weight, 600);
    line-height:     1.4;
    white-space:     nowrap;
    letter-spacing:  0.01em;

    /* OFF state — red (matches screenshot "Career Fair Mode" button) */
    background:      var(--cfm-btn-bg-off,  #b91c1c);
    color:           var(--cfm-btn-txt-off, #ffffff);

    transition:
        background   0.2s ease,
        color        0.2s ease,
        border-color 0.2s ease,
        box-shadow   0.2s ease,
        transform    0.1s ease;
}

.csa-cfm-btn:hover {
    filter:     brightness(1.1);
    transform:  translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.csa-cfm-btn:active {
    transform: translateY(0);
    filter:    brightness(0.96);
}

/* ON — green */
.csa-cfm-btn.is-on {
    background:   var(--cfm-btn-bg-on,  #16a34a);
    color:        var(--cfm-btn-txt-on, #ffffff);
    border-color: var(--cfm-btn-bdr-on, #16a34a);
    border: none !important;
}

/* Pulsing dot — only visible when ON */
.csa-cfm-status-dot {
    display:       none;
    width:         8px;
    height:        8px;
    border-radius: 50%;
    background:    rgba(255,255,255,0.9);
    flex-shrink:   0;
    animation:     cfm-pulse 1.8s ease-in-out infinite;
}

.csa-cfm-btn.is-on .csa-cfm-status-dot {
    display: inline-block;
}

@keyframes cfm-pulse {
    0%, 100% { opacity: 1;   transform: scale(1);    }
    50%       { opacity: 0.5; transform: scale(1.4);  }
}

/* Button loading spinner */
.csa-cfm-btn-spinner {
    display:       none;
    width:         14px;
    height:        14px;
    border:        2px solid rgba(255,255,255,0.35);
    border-top:    2px solid #fff;
    border-radius: 50%;
    animation:     cfm-spin 0.7s linear infinite;
    flex-shrink:   0;
}

.csa-cfm-btn.is-loading .csa-cfm-btn-spinner { display: inline-block; }
.csa-cfm-btn.is-loading                       { pointer-events: none; opacity: 0.8; }

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

/* ── Expiry badge (shown when ON) ── */

.csa-cfm-expiry-badge {
    display:       inline-block;
    font-size:     0.8125rem;
    color:         #15803d;        /* green-700 */
    background:    #dcfce7;        /* green-100 */
    border:        1px solid #bbf7d0;
    border-radius: 20px;
    padding:       3px 10px;
    line-height:   1.4;
    white-space:   nowrap;
}

/* ── Overlay / backdrop ── */

.csa-cfm-overlay {
    display:         none;
    position:        fixed;
    inset:           0;
    background:      rgba(0,0,0,0.45);
    z-index:         99998;
    align-items:     center;
    justify-content: center;
    padding:         16px;
    opacity:         0;
    transition:      opacity 0.18s ease;
}

.csa-cfm-overlay.is-open {
    display:  flex;
    opacity:  1;
}

body.csa-cfm-no-scroll { overflow: hidden; }

/* ── Popup card — matches screenshot exactly ── */

.csa-cfm-popup {
    background:    #ffffff;
    border-radius: var(--cfm-popup-radius, 12px);
    box-shadow:    0 8px 40px rgba(0,0,0,0.22);
    max-width:     440px;
    width:         100%;
    padding:       32px 28px 24px;
    position:      relative;
    transform:     translateY(12px);
    transition:    transform 0.2s ease;
}

.csa-cfm-overlay.is-open .csa-cfm-popup {
    transform: translateY(0);
}

/* Message text — large, dark blue, matches screenshot */
.csa-cfm-popup-body {
    margin-bottom: 24px;
}

.csa-cfm-popup-text {
    font-size:   16px;
    font-weight: 600;
    color:       #000000 !important;    /* dark navy — matches screenshot */
    line-height: 1.5;
    margin:      0;
    text-align:  left;
}

/* Expiry time line shown inside popup when status is ON */
.csa-cfm-expiry-line {
    display:     block;
    margin-top:  8px;
    font-size:   12px;
    font-weight: 400;
    color:       #374151;
}

.csa-cfm-expiry-line strong {
    color:       #15803d;   /* green — draws the eye to the time */
    font-weight: 600;
}

/* ── Footer buttons ── */

.csa-cfm-popup-footer {
    display:         flex;
    gap:             12px;
    justify-content: flex-start;   /* Confirm left, Cancel right — matches screenshot */
}

.csa-cfm-confirm,
.csa-cfm-cancel {
    display:       inline-flex;
    align-items:   center;
    justify-content: center;
    gap:           7px;
    padding:       10px 28px;
    border-radius: 7px;
    /* font-size:     1rem; */
    font-weight:   600;
    cursor:        pointer;
    border:        none !important;
    line-height:   1.4;
    min-width:     110px;
    transition:    filter 0.15s, transform 0.1s;
}

.csa-cfm-confirm:hover,
.csa-cfm-cancel:hover {
    filter: brightness(0.9);
    border:        none !important;
}

.csa-cfm-confirm:active,
.csa-cfm-cancel:active {
    transform: scale(0.97);
    border:        none !important;
}

/* Confirm — navy blue (left button in screenshot) */
.csa-cfm-confirm {
    background: var(--cfm-confirm-bg,  #1e3a8a);
    color:      var(--cfm-confirm-txt, #ffffff);
    position:   relative;
}

/* Cancel — red (right button in screenshot) */
.csa-cfm-cancel {
    /* background: var(--cfm-cancel-bg,  #dc2626); */
    color:      var(--cfm-cancel-txt, #ffffff);
}

/* Confirm loading state */
.csa-cfm-confirm.is-loading {
    pointer-events: none;
    opacity:        0.8;
}

.csa-cfm-confirm.is-loading .csa-cfm-confirm-label {
    opacity: 0;
}

.csa-cfm-confirm-spinner {
    display:       none;
    position:      absolute;
    left:          40%;
    top:           30%;
    /* transform:     translate(-50%, -50%); */
    width:         18px;
    height:        18px;
    border:        2px solid rgba(255,255,255,0.4);
    border-top:    2px solid #fff;
    border-radius: 50%;
    animation:     cfm-spin 0.7s linear infinite;
}

.csa-cfm-confirm.is-loading .csa-cfm-confirm-spinner {
    display: block;
}

/* ── Error message ── */

.csa-cfm-error {
    display:       none;
    margin-top:    14px;
    padding:       10px 14px;
    background:    #fef2f2;
    border:        1px solid #fca5a5;
    border-radius: 7px;
    color:         #991b1b;
    font-size:     0.875rem;
    line-height:   1.5;
}

.csa-cfm-error.is-visible { display: block; }


.csa-cfm-wrapper {
    position: relative;   /* anchor for the tooltip */
}

.csa-cfm-expiry-badge {
    position: absolute;
    top: 100%;               /* just below the button */
    left: 0;
    margin-top: 6px;
    white-space: nowrap;
    background: #222;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10;
    display: none;            /* jQuery .show()/.hide() toggles this */
}


/* ── Responsive ── */

@media (max-width: 480px) {
    .csa-cfm-popup { padding: 24px 16px 20px; }

    .csa-cfm-popup-footer {
        flex-direction: column;
    }

    .csa-cfm-confirm,
    .csa-cfm-cancel {
        width: 100%;
    }

    .csa-cfm-btn-wrap {
        flex-direction: column;
        align-items:    flex-start;
    }
}
