/* assets/css/app.css */
:root {
    --primary-color: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #ccfbf1;
    --in-color: #10b981;
    --in-bg: #ecfdf5;
    --in-border: #a7f3d0;
    --out-color: #ef4444;
    --out-bg: #fef2f2;
    --out-border: #fecaca;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
}

/* Navbar */
.navbar-custom {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin-right: 10px;
}

/* Scanner Bar */
.scanner-container {
    background: #ffffff;
    border: 2px solid #0d9488;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(13, 148, 136, 0.1);
    transition: all 0.2s ease;
}

.scanner-container:focus-within {
    border-color: #0f766e;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.2);
}

.scanner-input {
    border: none;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.scanner-input:focus {
    outline: none;
    box-shadow: none;
}

.scanner-badge {
    animation: scannerPulse 2s infinite;
}

@keyframes scannerPulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

/* Stat Cards */
.stat-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 1.25rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-card.active-filter {
    border-color: #0d9488;
    background-color: #f0fdfa;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.in {
    background-color: var(--in-bg);
    color: #065f46;
    border: 1.5px solid var(--in-border);
}

.status-badge.out {
    background-color: var(--out-bg);
    color: #991b1b;
    border: 1.5px solid var(--out-border);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge.in .status-dot {
    background-color: var(--in-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
    animation: dotPulse 1.5s infinite;
}

.status-badge.out .status-dot {
    background-color: var(--out-color);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

@keyframes dotPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Category Badge */
.category-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
}

/* BIG 2.5-SECOND AUTO-CLOSING POPUP */
.big-scan-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.big-scan-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.big-scan-box {
    width: 90%;
    max-width: 600px;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    position: relative;
}

.big-scan-modal-overlay.show .big-scan-box {
    transform: scale(1) translateY(0);
}

.big-scan-header {
    padding: 2.25rem 1.5rem 1.5rem 1.5rem;
    color: #ffffff;
    position: relative;
}

.big-scan-header.theme-in {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.big-scan-header.theme-out {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.big-scan-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.big-scan-status-text {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.big-scan-transition {
    font-size: 1rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.25);
    display: inline-block;
    padding: 3px 14px;
    border-radius: 9999px;
}

.big-scan-body {
    padding: 1.75rem;
    background: #ffffff;
}

.big-scan-patient-name {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.big-scan-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 1.25rem;
    text-align: center;
}

.meta-item {
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.meta-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 2px;
}

.meta-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

/* 2.5s Progress Bar Countdown */
.big-scan-progress-bar {
    height: 6px;
    background: rgba(0,0,0,0.06);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.big-scan-progress-inner {
    height: 100%;
    width: 100%;
    background: #0d9488;
    transform-origin: left;
    transition: width 2.5s linear;
}

.theme-in .big-scan-progress-inner {
    background: #10b981;
}

.theme-out .big-scan-progress-inner {
    background: #ef4444;
}

/* PIN Screen Styling */
.pin-screen-container {
    max-width: 420px;
    margin: 4rem auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.pin-screen-header {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
    color: #ffffff;
    padding: 2.25rem 1.5rem 1.75rem 1.5rem;
    text-align: center;
}

.pin-dots-container {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 1.5rem 0;
}

.pin-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
    background: #0d9488;
    border-color: #0d9488;
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(13, 148, 136, 0.5);
}

.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 1.5rem 2rem 2rem 2rem;
}

.keypad-btn {
    aspect-ratio: 1;
    font-size: 1.5rem;
    font-weight: 600;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.keypad-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.keypad-btn:active {
    transform: scale(0.94);
    background: #e2e8f0;
}

.keypad-btn.action-btn {
    font-size: 0.95rem;
    font-weight: 700;
    background: #f8fafc;
    color: #475569;
}

/* Ambiguity Selector Cards */
.ambiguity-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ambiguity-card:hover {
    border-color: #0d9488;
    background-color: #f0fdfa;
    transform: translateY(-2px);
}

/* Table Enhancements */
.table-cards th {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.table-cards td {
    vertical-align: middle;
    padding: 0.9rem 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* History Timeline */
.history-timeline {
    position: relative;
    padding-left: 28px;
}

.history-timeline::before {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 8px;
    width: 2px;
    background: #e2e8f0;
}

.history-item {
    position: relative;
    margin-bottom: 1.25rem;
}

.history-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #cbd5e1;
}

.history-item.is-in::before {
    background: #10b981;
    box-shadow: 0 0 0 2px #10b981;
}

.history-item.is-out::before {
    background: #ef4444;
    box-shadow: 0 0 0 2px #ef4444;
}

/* Quick Cooldown Toast */
.cooldown-alert {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    min-width: 320px;
    background: #fffbeb;
    border-left: 5px solid #f59e0b;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 1rem;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Extra Small Button Utility */
.btn-xs {
    padding: 0.15rem 0.35rem;
    font-size: 0.72rem;
    border-radius: 4px;
}

/* Deletion Confirmation Modal Accents */
#deleteWarningModalStep2 .modal-content {
    border: 2px solid #ef4444;
}

#delStep2InputConfirm:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 0.25rem rgba(239, 68, 68, 0.25);
}

/* EMR Callout Styling */
#historyTopEmrBanner {
    border-left: 4px solid #0d6efd !important;
}

/* Pagination Styling */
.pagination .page-link {
    color: #475569;
    border-color: #e2e8f0;
    font-size: 0.85rem;
    transition: all 0.15s ease-in-out;
}

.pagination .page-link:hover {
    color: var(--primary-color);
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(13, 148, 136, 0.3);
}

.pagination .page-item.disabled .page-link {
    color: #94a3b8;
    background-color: #f8fafc;
    border-color: #e2e8f0;
}
