/* ======================================================================
   Patient Track - Custom Styles
   Enhanced for visibility, contrast, and premium aesthetics
   ====================================================================== */

/* ── Body Background ─────────────────────────────────────────────────── */
.page-body {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 40%, #eff6ff 70%, #f0f9ff 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.dark .page-body,
html.dark .page-body {
    background: linear-gradient(135deg, #020617 0%, #0f172a 40%, #0c1222 70%, #020617 100%);
}

/* ── Sidebar Container ───────────────────────────────────────────────── */
.sidebar-container {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    border-right: 1px solid #e2e8f0;
    position: relative;
}

.sidebar-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, #3b82f6 0%, #6366f1 50%, #8b5cf6 100%);
    opacity: 0.15;
}

.dark .sidebar-container,
html.dark .sidebar-container {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    border-right-color: rgba(51, 65, 85, 0.5);
}

.dark .sidebar-container::after,
html.dark .sidebar-container::after {
    opacity: 0.25;
}

/* ── Top Header Bar ──────────────────────────────────────────────────── */
.top-header {
    background: linear-gradient(90deg, rgba(255,255,255,0.92) 0%, rgba(248,250,252,0.95) 50%, rgba(239,246,255,0.92) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.top-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #6366f1, #8b5cf6);
    opacity: 0.12;
}

.dark .top-header,
html.dark .top-header {
    background: linear-gradient(90deg, rgba(15,23,42,0.88) 0%, rgba(30,41,59,0.92) 50%, rgba(15,23,42,0.88) 100%);
    border-bottom-color: rgba(51, 65, 85, 0.5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.dark .top-header::after,
html.dark .top-header::after {
    opacity: 0.2;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.875rem;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.sidebar-link svg {
    color: #6b7280;
    transition: color 0.2s ease;
}

.sidebar-link:hover {
    background-color: #eef2ff;
    color: #1e40af;
}

.sidebar-link:hover svg {
    color: #3b82f6;
}

.dark .sidebar-link {
    color: #d1d5db;
}

.dark .sidebar-link svg {
    color: #9ca3af;
}

.dark .sidebar-link:hover {
    background-color: #1e293b;
    color: #93c5fd;
}

.dark .sidebar-link:hover svg {
    color: #60a5fa;
}

.sidebar-link.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
    font-weight: 700;
}

.sidebar-link.active svg {
    color: #ffffff;
}

/* ── Page Transitions ────────────────────────────────────────────────── */
main {
    animation: fadeInUp 0.35s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Stat / Dashboard Cards ──────────────────────────────────────────── */
.stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 2px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.stat-blue::before   { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-card.stat-amber::before  { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.stat-indigo::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.stat-card.stat-green::before  { background: linear-gradient(90deg, #22c55e, #4ade80); }

.dark .stat-card {
    background: #1e293b;
    border-color: rgba(100, 116, 139, 0.3);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.dark .stat-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    border-color: rgba(100, 116, 139, 0.5);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
    color: #111827;
    letter-spacing: -0.02em;
}

.dark .stat-card .stat-number {
    color: #f9fafb;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    margin-top: 0.375rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.dark .stat-card .stat-label {
    color: #9ca3af;
}

.stat-card .stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card .stat-icon svg {
    width: 1.375rem;
    height: 1.375rem;
}

.stat-icon.icon-blue   { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #2563eb; }
.stat-icon.icon-amber  { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; }
.stat-icon.icon-indigo { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #4f46e5; }
.stat-icon.icon-green  { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #16a34a; }

.dark .stat-icon.icon-blue   { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.dark .stat-icon.icon-amber  { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.dark .stat-icon.icon-indigo { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.dark .stat-icon.icon-green  { background: rgba(34, 197, 94, 0.15);  color: #4ade80; }

/* ── Content Cards ───────────────────────────────────────────────────── */
.content-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

.dark .content-card {
    background: #1e293b;
    border-color: rgba(100, 116, 139, 0.3);
}

.content-card .card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dark .content-card .card-header {
    border-bottom-color: rgba(100, 116, 139, 0.3);
}

.content-card .card-header h2,
.content-card .card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.dark .content-card .card-header h2,
.dark .content-card .card-header h3 {
    color: #f3f4f6;
}

/* ── CTA Banner ──────────────────────────────────────────────────────── */
.cta-banner {
    background: linear-gradient(135deg, #ef4444 0%, #e11d48 50%, #be123c 100%);
    border-radius: 2px;
    padding: 1.75rem;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.25);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cta-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    bottom: -50%;
    left: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.cta-banner:hover {
    box-shadow: 0 12px 32px rgba(239, 68, 68, 0.35);
    transform: translateY(-2px);
}

.cta-banner h3 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.cta-banner p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
    line-height: 1.5;
}

.cta-banner .cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 2px;
    background: #ffffff;
    color: #dc2626;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    margin-top: 1.25rem;
}

.cta-banner .cta-btn:hover {
    background: #fff1f2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ── Status badges ───────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.625rem;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.dark .badge-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

.badge-in-progress {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
.dark .badge-in-progress {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.25);
}

.badge-completed {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.dark .badge-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.25);
}

.badge-low {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.dark .badge-low {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.25);
}

.badge-medium {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.dark .badge-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

.badge-high {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}
.dark .badge-high {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border-color: rgba(249, 115, 22, 0.25);
}

.badge-critical {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.dark .badge-critical {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

/* ── Table ────────────────────────────────────────────────────────────── */
thead tr {
    background: #f9fafb;
}

.dark thead tr {
    background: rgba(30, 41, 59, 0.5);
}

thead th {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.5rem;
}

.dark thead th {
    color: #9ca3af;
}

tbody td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.dark tbody td {
    color: #e5e7eb;
}

tbody tr {
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}

.dark tbody tr {
    border-bottom-color: rgba(100, 116, 139, 0.15);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background-color: #f9fafb;
}

.dark tbody tr:hover {
    background-color: rgba(30, 41, 59, 0.5);
}

/* ── Form Elements ───────────────────────────────────────────────────── */
.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 2px;
    border: 1.5px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #9ca3af;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.dark .form-input,
.dark .form-textarea {
    background: #0f172a;
    border-color: rgba(100, 116, 139, 0.4);
    color: #f3f4f6;
}

.dark .form-input::placeholder,
.dark .form-textarea::placeholder {
    color: #64748b;
}

.dark .form-input:focus,
.dark .form-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ── Priority Radio ──────────────────────────────────────────────────── */
.priority-option div {
    border-width: 2px;
    transition: all 0.2s ease;
}

.priority-option input:checked + div {
    box-shadow: 0 0 0 2px currentColor;
    transform: scale(1.02);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 2px;
    background: linear-gradient(135deg, #dc2626, #e11d48);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #374151;
}

/* ── Leaflet Overrides ───────────────────────────────────────────────── */
.dark .leaflet-control-zoom a {
    background-color: #1e293b;
    color: #e5e7eb;
    border-color: #374151;
}

.dark .leaflet-control-attribution {
    background-color: #1e293b !important;
    color: #9ca3af;
}

/* ── Notification Badge ──────────────────────────────────────────────── */
@keyframes notificationPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

#notificationBadge:not(.hidden) {
    display: flex;
    animation: notificationPulse 1.5s ease-in-out infinite;
}

/* ── Custom Marker ───────────────────────────────────────────────────── */
.custom-marker {
    background: transparent !important;
    border: none !important;
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Empty State ─────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state .empty-icon {
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1rem;
    border-radius: 2px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .empty-state .empty-icon {
    background: #1e293b;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.25rem;
}

.dark .empty-state h3 {
    color: #e5e7eb;
}

.empty-state p {
    font-size: 0.875rem;
    color: #6b7280;
}

.dark .empty-state p {
    color: #9ca3af;
}

/* ── Request Row ─────────────────────────────────────────────────────── */
.request-row {
    padding: 1rem 1.5rem;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}

.dark .request-row {
    border-bottom-color: rgba(100, 116, 139, 0.15);
}

.request-row:last-child {
    border-bottom: none;
}

.request-row:hover {
    background-color: #f9fafb;
}

.dark .request-row:hover {
    background-color: rgba(30, 41, 59, 0.5);
}

.request-row .request-desc {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
}

.dark .request-row .request-desc {
    color: #f3f4f6;
}

.request-row .request-date {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.dark .request-row .request-date {
    color: #9ca3af;
}

/* ── Alert Banner ────────────────────────────────────────────────────── */
.alert-banner {
    padding: 1rem 1.25rem;
    border-radius: 2px;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.alert-banner.alert-danger {
    background: linear-gradient(135deg, rgba(239,68,68,0.08), rgba(225,29,72,0.08));
    border-color: rgba(239, 68, 68, 0.2);
}

.dark .alert-banner.alert-danger {
    background: linear-gradient(135deg, rgba(239,68,68,0.1), rgba(225,29,72,0.1));
    border-color: rgba(239,68,68,0.25);
}

.alert-banner .alert-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-banner.alert-danger .alert-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.dark .alert-banner.alert-danger .alert-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.alert-banner h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: #991b1b;
}

.dark .alert-banner h3 {
    color: #fca5a5;
}

.alert-banner p {
    font-size: 0.8125rem;
    color: #b91c1c;
    margin-top: 0.125rem;
    line-height: 1.5;
}

.dark .alert-banner p {
    color: rgba(252, 165, 165, 0.7);
}

/* ── Location Status ─────────────────────────────────────────────────── */
.location-box {
    padding: 1rem 1.25rem;
    border-radius: 2px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
}

.dark .location-box {
    background: #0f172a;
    border-color: rgba(100, 116, 139, 0.3);
}

/* ── Dark Mode Toggle ────────────────────────────────────────────────── */
#darkModeBtn {
    font-weight: 600;
}

/* ── Form Message ────────────────────────────────────────────────────── */
.form-message {
    padding: 0.75rem 1rem;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 500;
}

.form-message.msg-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.dark .form-message.msg-error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.form-message.msg-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.dark .form-message.msg-success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

/* ── Mobile Card for History ─────────────────────────────────────────── */
.mobile-request-card {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

.dark .mobile-request-card {
    border-bottom-color: rgba(100, 116, 139, 0.15);
}

.mobile-request-card:last-child {
    border-bottom: none;
}

.mobile-request-card:hover {
    background-color: #f9fafb;
}

.dark .mobile-request-card:hover {
    background-color: rgba(30, 41, 59, 0.5);
}
