/* ==========================================================================
   EMS CEU Manager - Frontend, Admin & Portal Styles
   File: assets/ems-style.css
   ========================================================================== */

.ems-dashboard-wrapper,
.ems-public-schedule-wrapper,
.ems-auth-container,
.ems-staff-app-container {
    max-width: 1000px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
    line-height: 1.5;
}

/* Full-Screen Visual Scan Flash Overlay */
.ems-scan-flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999999;
    display: none;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
}

.ems-scan-flash-overlay.active { display: flex !important; opacity: 1; }
.ems-scan-flash-overlay.success { background-color: rgba(16, 185, 129, 0.96); }
.ems-scan-flash-overlay.warning { background-color: rgba(245, 158, 11, 0.96); }
.ems-scan-flash-overlay.error   { background-color: rgba(239, 68, 68, 0.96); }

.ems-flash-box { padding: 30px; }
.flash-icon { font-size: 80px; font-weight: bold; margin-bottom: 8px; line-height: 1; }
.flash-name { font-size: 32px; font-weight: 800; }
.flash-detail { font-size: 18px; margin-top: 6px; opacity: 0.9; }
.flash-time { font-size: 14px; margin-top: 4px; opacity: 0.75; }

/* Staff Portal UI */
.ems-staff-app-header {
    background: #1e293b;
    color: #ffffff;
    padding: 16px 20px;
    border-radius: 8px 8px 0 0;
    text-align: center;
}
.ems-staff-app-header h2 { margin: 0; font-size: 20px; color: #ffffff; }
.ems-staff-app-header p { margin: 2px 0 0; font-size: 12px; color: #94a3b8; }

.staff-scan-indicator {
    padding: 18px;
    border-radius: 6px;
    font-size: 17px;
    font-weight: bold;
    background: #e2e8f0;
    text-align: center;
    margin-bottom: 15px;
}

.staff-checkin-log {
    list-style: none;
    padding: 10px;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
}

.staff-checkin-log li { padding: 5px 0; border-bottom: 1px solid #e2e8f0; }

.staff-session-list { display: flex; flex-direction: column; gap: 10px; }
.staff-session-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.staff-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.65);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.staff-modal-content {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 480px;
    text-align: center;
    box-sizing: border-box;
}

.signature-wrapper {
    border: 2px dashed #94a3b8;
    margin: 12px 0;
    background: #ffffff;
    position: relative;
}

.signature-wrapper canvas {
    width: 100%;
    height: 100%;
    touch-action: none;
    display: block;
    cursor: crosshair;
}

/* Tabs */
.ems-tab-header {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    background: #ffffff;
}

.ems-tab-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
}

.ems-tab-btn.active {
    background: #1e3a8a !important;
    color: #ffffff !important;
    border-color: #1e3a8a !important;
}

.ems-tab-btn.logout { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

.ems-tab-content,
.ems-staff-tab-content { display: none !important; }

.ems-tab-content.active,
.ems-staff-tab-content.active { display: block !important; }

/* Profile Grid */
.profile-display-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    background: #f8fafc;
    padding: 18px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.profile-display-grid div label {
    display: block;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 2px;
}

.profile-display-grid div span {
    font-size: 15px;
    color: #0f172a;
}

@media (max-width: 600px) {
    .profile-display-grid { grid-template-columns: 1fr; }
}

/* Cards & Forms */
.ems-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ems-card h3 { margin-top: 0; margin-bottom: 16px; font-size: 18px; font-weight: 700; color: #0f172a; }

.ems-card form label,
.auth-form-block label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: #334155; }

.ems-card form input,
.ems-card form select,
.ems-card form textarea,
.auth-form-block form input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 14px;
    box-sizing: border-box;
    background: #fff;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 550px) { .form-row { grid-template-columns: 1fr; gap: 0; } }

/* Buttons */
.ems-btn-primary {
    display: inline-block;
    width: 100%;
    background-color: #1e3a8a;
    color: #ffffff !important;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    padding: 11px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
}

.ems-btn-primary:hover { background-color: #172554; }

.ems-btn-secondary {
    display: inline-block;
    background-color: #f1f5f9;
    color: #334155;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    padding: 9px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
}

.ems-btn-small {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
}

.ems-btn-disabled {
    display: inline-block;
    background-color: #e2e8f0;
    color: #94a3b8;
    padding: 12px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: not-allowed;
}

.ems-alert-success {
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.ems-alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.ems-grid-center { display: flex; justify-content: center; }
.badge-box {
    width: 100%;
    max-width: 290px;
    margin: 0 auto 15px auto;
    border: 2px solid #0f172a;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.badge-header { font-size: 11px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; color: #64748b; margin-bottom: 6px; }
.badge-box h2 { font-size: 19px; font-weight: 800; color: #0f172a; margin: 4px 0; }
.badge-level { font-size: 13px; font-weight: 700; color: #b91c1c; }
.badge-lic { font-size: 12px; color: #475569; margin-bottom: 8px; }
.badge-qr-code img { width: 160px; height: 160px; margin: 6px auto; display: block; }
.badge-id { font-family: monospace; font-size: 13px; font-weight: 700; color: #1e293b; margin-top: 4px; }

.ems-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.ems-table th { background-color: #f8fafc; color: #475569; text-align: left; padding: 10px; border-bottom: 2px solid #e2e8f0; font-weight: 600; }
.ems-table td { padding: 10px; border-bottom: 1px solid #e2e8f0; vertical-align: middle; }

@media print {
    body * { visibility: hidden !important; }
    #printable-badge, #printable-badge * { visibility: visible !important; }
    #printable-badge {
        position: absolute;
        left: 50%;
        top: 20px;
        transform: translateX(-50%);
        width: 3in;
        height: 4in;
        border: 2px solid #000000;
        box-shadow: none;
        padding: 20px;
    }
}