/* ─── Safe Area (notch devices) ─── */
.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* ─── Tab Bar ─── */
.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 12px;
    color: #64748B;
    transition: color 0.2s, background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-width: 56px;
}
.tab-item:hover { color: #94A3B8; }
.tab-active { color: #22D3EE !important; background-color: rgba(34,211,238,0.1); }

/* ─── Cards ─── */
.card {
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 16px;
    transition: background-color 0.2s;
}
.card:active { background-color: #273548; }

/* ─── Status Badges ─── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-green { background: rgba(34,197,94,0.15); color: #22C55E; }
.badge-red { background: rgba(239,68,68,0.15); color: #EF4444; }
.badge-amber { background: rgba(245,158,11,0.15); color: #F59E0B; }
.badge-blue { background: rgba(59,130,246,0.15); color: #3B82F6; }
.badge-gray { background: rgba(107,114,128,0.15); color: #6B7280; }

/* ─── Progress Bars ─── */
.progress-bar {
    height: 8px;
    border-radius: 4px;
    background: #334155;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease-out;
}

/* ─── Action Buttons ─── */
.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.btn-action:active { transform: scale(0.96); }
.btn-primary { background: #3B82F6; color: white; }
.btn-primary:hover { background: #2563EB; }
.btn-danger { background: #EF4444; color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-warning { background: #F59E0B; color: white; }
.btn-warning:hover { background: #D97706; }
.btn-success { background: #22C55E; color: white; }
.btn-success:hover { background: #16A34A; }
.btn-ghost { background: transparent; border: 1px solid #334155; color: #94A3B8; }
.btn-ghost:hover { background: #1E293B; }

/* ─── Toast Notifications ─── */
.toast {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    max-width: 340px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: toastIn 0.3s ease-out;
}
.toast-success { background: #166534; color: #DCFCE7; border: 1px solid #22C55E; }
.toast-error { background: #7F1D1D; color: #FEE2E2; border: 1px solid #EF4444; }
.toast-warning { background: #78350F; color: #FEF3C7; border: 1px solid #F59E0B; }
.toast-info { background: #1E3A5F; color: #DBEAFE; border: 1px solid #3B82F6; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ─── Shake Animation (login error) ─── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}
.shake { animation: shake 0.5s ease-in-out; }

/* ─── Pulse dot ─── */
@keyframes pulseDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.pulse-dot { animation: pulseDot 2s ease-in-out infinite; }

/* ─── Spin (refresh button) ─── */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Scrollbar (slim dark) ─── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ─── Tab Switcher ─── */
.tab-switch {
    display: flex;
    background: #0F172A;
    border-radius: 12px;
    padding: 3px;
    gap: 2px;
}
.tab-switch-item {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.tab-switch-item.active {
    background: #1E293B;
    color: #F1F5F9;
}

/* ─── Monospace (SQL display) ─── */
.mono { font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace; }

/* ─── Pull to Refresh indicator ─── */
.pull-indicator {
    text-align: center;
    padding: 12px;
    color: #64748B;
    font-size: 12px;
    transition: opacity 0.2s;
}
