/* Bundle — shared body defaults */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    min-height: 100vh;
}

/* Bundle Login — bundle-login.php */

.login-wrap {
    width: 100%;
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.25);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #2c3e50, #1D857D);
    color: white;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
}

.login-header .icon {
    font-size: 2.8rem;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.login-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.6rem;
    font-weight: 700;
}

.login-header p {
    margin: 0;
    opacity: 0.8;
    font-size: 0.95rem;
}

.login-body {
    padding: 2rem;
}

.login-body .form-group {
    margin-bottom: 1.25rem;
}

.login-body .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.login-body .form-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.login-body .form-group input:focus {
    outline: none;
    border-color: #1D857D;
}

.btn-login {
    width: 100%;
    padding: 0.9rem;
    background: #1D857D;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: #166159;
}

.btn-login-secondary {
    background: #6c757d;
    margin-top: 0.35rem;
}

.btn-login-secondary:hover {
    background: #5a6268;
}

.guest-divider {
    margin: 1rem 0 0.75rem;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

.guest-divider span {
    display: inline-block;
    margin-top: -0.6rem;
    padding: 0 0.6rem;
    background: #fff;
    color: #95a5a6;
    font-size: 0.82rem;
}

.client-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.15);
    border-radius: 50px;
    padding: 0.3rem 0.9rem;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

.error-msg {
    padding: 0.85rem 1rem;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.step-indicator .step {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.step-indicator .step.active {
    color: #1D857D;
    font-weight: 600;
}

.step-indicator .divider {
    flex: 1;
    height: 1px;
    background: #dee2e6;
}

.info-note {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.75rem;
    text-align: center;
}

/* Login mode switcher (Email / Guest / Phone) — bundle-login.php */
.login-mode-bar {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    background: #f1f3f5;
    border-radius: 8px;
    padding: 0.3rem;
}

.login-mode-btn {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 0.5rem;
    background: transparent;
    color: #6c757d;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.login-mode-btn:hover {
    color: #2c3e50;
}

.login-mode-btn.active {
    background: #fff;
    color: #1D857D;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.login-mode-panel {
    /* panels are shown/hidden via inline style toggled by JS; no base rules needed */
}

@media (max-width: 480px) {
    /* With all three login modes (Email/Guest/Phone) enabled, the tab bar was overflowing
       its container on narrow phones — flex items with white-space:nowrap don't shrink below
       their text's natural width by default (min-width:0 above fixes the overflow itself),
       but they still get uncomfortably cramped, so also shrink padding/gaps and let the label
       wrap onto two lines rather than staying on one squeezed line. */
    .login-header { padding: 1.75rem 1.25rem 1.5rem; }
    .login-body { padding: 1.25rem; }
    .login-mode-bar { gap: 0.25rem; padding: 0.25rem; }
    .login-mode-btn {
        padding: 0.5rem 0.3rem;
        gap: 0.25rem;
        font-size: 0.72rem;
        white-space: normal;
        line-height: 1.2;
        text-align: center;
    }
}

/* Bundle Dashboard — bundle-dashboard.php */

.bundle-header {
    background: linear-gradient(135deg, #2c3e50, #1D857D);
    color: white;
    padding: 0.85rem 2rem;
}

.bundle-header-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bundle-header h1 {
    margin: 0;
    font-size: 1.2rem;
}

.bundle-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    flex-shrink: 0;
}

.bundle-header-sub {
    margin: 0;
    opacity: 0.7;
    font-size: 0.82rem;
}

.bundle-header-signout {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.bundle-header-signout:hover {
    color: #fff;
}

.bundle-header p {
    margin: 0;
    opacity: 0.75;
    font-size: 0.88rem;
}

.bundle-lang-row {
    justify-content: flex-end;
}

@media (max-width: 480px) {
    /* Title (logo + name) and the right-hand block (identity/language/sign-out) were fighting
       for space in one row and overflowing. Stack title on its own row, everything else below. */
    .bundle-header {
        padding: 0.85rem 1.25rem;
    }
    .bundle-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
    }
    .bundle-header-right {
        align-items: flex-start;
        width: 100%;
    }
    .bundle-lang-row {
        justify-content: flex-start;
    }
}

.bundle-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.progress-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin-bottom: 1.75rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

/* Description at top of progress-card should span full width */
.progress-card .bundle-description {
    grid-column: 1 / -1;
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 0.6rem;
}

/* Stat row: make pills distribute evenly across available width */
.progress-card .stat-row {
    grid-column: 1 / -1;
    display: flex;
    gap: 1rem;
    align-items: stretch;
    flex-wrap: wrap;
}

.progress-card .stat-row .stat-pill {
    flex: 1 1 140px;
}

.stat-pill {
    text-align: center;
    padding: 0.6rem 0.5rem;
    border-radius: 10px;
}

.stat-pill .num {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}

.stat-pill .lbl {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 0.3rem;
}

.required-bar {
    background: white;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.required-bar .bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
}

.progress-track {
    background: #e9ecef;
    border-radius: 50px;
    height: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 50px;
    transition: width 0.6s ease;
}

.course-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.course-status-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.course-info {
    flex: 1;
    min-width: 0;
}

.course-info h3 {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    color: #2c3e50;
}

.course-info .meta {
    font-size: 0.82rem;
    color: #95a5a6;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-required  { background: #fff3cd; color: #856404; }
.badge-optional  { background: #e2e3e5; color: #495057; }
.badge-passed    { background: #d4edda; color: #155724; }
.badge-failed    { background: #f8d7da; color: #721c24; }
.badge-expired   { background: #fff3cd; color: #856404; }
.badge-pending   { background: #e2e3e5; color: #495057; }

.btn-start {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.course-card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: stretch;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    /* Icon + title/badges + action button (Retake/Start/Give Signature) all fought for space
       in one row, squeezing the button down. Wrap the card and drop the action button(s) onto
       their own full-width row below the info instead. */
    .course-card {
        flex-wrap: wrap;
    }
    .course-card-actions {
        flex-direction: row;
        flex-basis: 100%;
        width: 100%;
        margin-top: 0.6rem;
    }
    .course-card-actions .btn-start {
        flex: 1;
        justify-content: center;
        text-align: center;
    }
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #95a5a6;
    margin: 0 0 0.75rem;
}

/* ── Progress inner bar (inside progress-card) ─────────────────────── */
.bundle-progress-inner {
    grid-column: 1 / -1;
    margin-top: 0.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f2f5;
}

/* Certificate download row (inside progress-card) */
.bundle-cert-row {
    grid-column: 1 / -1;
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

/* ── Attendance compact bar ─────────────────────────────────────────── */
.attendance-bar {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.attendance-bar-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #95a5a6;
    margin-bottom: 0.65rem;
}

.attendance-bar-title i {
    color: #1D857D;
    margin-right: 0.3rem;
}

.attendance-bar-body {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.attendance-status-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: #27ae60;
    min-width: 0;
}

.att-location-select {
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    font-size: 0.9rem;
    color: #2c3e50;
    background: #f8f9fa;
    box-sizing: border-box;
}

.att-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    transition: background 0.15s;
}

.att-btn-in        { background: #27ae60; color: #fff; }
.att-btn-in:hover  { background: #229954; color: #fff; }
.att-btn-out       { background: #e67e22; color: #fff; }
.att-btn-out:hover { background: #d35400; color: #fff; }
.att-btn-disabled  { background: #bdc3c7 !important; cursor: not-allowed !important; opacity: 0.75; }

/* Prominent check-in button variant */
.att-btn-in-prominent {
    min-width: 260px;
    padding: 0.85rem 1.4rem;
    font-size: 1.05rem;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(39,174,96,0.18);
}
.att-btn-in-prominent i { font-size: 1rem; }

.att-locked-text {
    flex: 1;
    font-size: 0.88rem;
    color: #95a5a6;
}

.att-last-checkin {
    margin: 0.5rem 0 0;
    color: #b2bec3;
    font-size: 0.8rem;
}

.att-location-desc {
    margin-top: 0.75rem;
    padding: 0.6rem 1rem;
    background: #f4f8fb;
    border-left: 3px solid #1D857D;
    border-radius: 0 6px 6px 0;
    font-size: 0.9rem;
    color: #2c3e50;
}

.attendance-flash {
    display: inline-block;
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    color: #1e8449;
    border-radius: 8px;
    padding: 0.35rem 0.9rem;
    margin-bottom: 0.6rem;
    font-size: 0.88rem;
}

@media (max-width: 480px) {
    .att-location-select { max-width: 100%; }
    .attendance-bar-body { gap: 0.6rem; }
    .att-btn-in-prominent { min-width: 100%; width: 100%; flex-basis: 100%; margin-top: 0.4rem; box-shadow: none; }
    .att-btn-in-prominent[disabled] { opacity: 0.9; }
}

/* Prominent checkout variant */
.att-btn-out-prominent {
    min-width: 260px;
    padding: 0.85rem 1.4rem;
    font-size: 1.05rem;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(230,126,34,0.12);
}
.att-btn-out-prominent i { font-size: 1rem; }

@media (max-width: 480px) {
    .att-btn-out-prominent { min-width: 100%; width: 100%; flex-basis: 100%; margin-top: 0.4rem; box-shadow: none; }
    /* Checkout button is nested in a <form> sibling of the status text inside
       .attendance-bar-body — width:100% on the button alone doesn't force the
       form itself to wrap onto its own row, so the form needs it too. */
    .att-checkout-form { flex-basis: 100%; width: 100%; }
}

/* ── Check-in form (expanded with fields) ────────────────────────────────── */
.att-checkin-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding-top: 0.25rem;
}

/* 2-column field row: label | input */
.att-field-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 2fr;
    align-items: center;
    gap: 0.75rem;
}

/* Location row: select on first sub-row, description spans full width on second */
.att-location-row {
    align-items: start;
    grid-template-rows: auto auto;
}

.att-location-desc-full {
    grid-column: 1 / -1;
    margin-top: 0.1rem;
}

.att-field-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.att-field-input {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
}

.att-text-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.92rem;
    color: #2c3e50;
    background: #f8f9fa;
    box-sizing: border-box;
}
.att-text-input:focus {
    outline: none;
    border-color: #1D857D;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.12);
}

.att-required-star {
    color: #A8351B;
    margin-left: 0.2rem;
}

.att-checkin-submit-row {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.25rem;
}

@media (max-width: 540px) {
    .att-field-row {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
    .att-checkin-submit-row .att-btn-in-prominent {
        width: 100%;
        min-width: 0;
    }
}

/* Pill-toggle (for public checkin checkboxes) ── mirrors editor.css */
.att-pill-toggle {
    display: inline-flex;
    background: #e0e0e0;
    border-radius: 20px;
    padding: 2px;
    cursor: pointer;
    user-select: none;
}
.att-pill-toggle input[type="checkbox"] {
    display: none;
}
.att-pill-toggle .att-pill-opt {
    padding: 0.35rem 0.9rem;
    border-radius: 18px;
    transition: all 0.2s;
    font-size: 0.88rem;
    font-weight: 500;
    color: #666;
    text-align: center;
}
.att-pill-toggle input:not(:checked) ~ .att-pill-no,
.att-pill-toggle input:checked ~ .att-pill-yes {
    background: white;
    color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.att-pill-toggle input:checked ~ .att-pill-yes {
    background: #1D857D;
    color: white;
}
