/* ============================================================
   BloodBridge — Shared Component Styles
   ============================================================ */

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--duration-slow) var(--ease-out);
}

.sidebar-logo {
    padding: var(--space-5) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .logo-icon { width: 36px; height: 36px; }
.sidebar-logo .logo-text {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--white);
}
.sidebar-logo .logo-text span { color: var(--red-primary); }

.sidebar-nav { flex: 1; padding: var(--space-4) 0; }

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: rgba(255,255,255,0.65);
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    cursor: pointer;
    position: relative;
    transition: all var(--duration-fast) var(--ease-out);
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar-nav-item:hover {
    color: var(--white);
    background: rgba(255,255,255,0.06);
}

.sidebar-nav-item.active {
    color: var(--white);
    background: var(--red-primary);
    border-radius: var(--radius-md);
    margin: 0 var(--space-3);
    padding-left: calc(var(--space-5) - var(--space-3));
    border-left: none;
}

.sidebar-nav-item.active.teal-active {
    background: var(--teal-primary);
}

.sidebar-nav-item .nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}
.sidebar-nav-item.active .nav-icon { opacity: 1; }

.sidebar-nav-item .nav-badge {
    margin-left: auto;
    background: var(--red-badge);
    color: var(--white);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-nav-item.logout-item:hover {
    color: var(--red-primary);
    background: rgba(192,57,43,0.1);
}

.sidebar-illustration {
    padding: var(--space-6) var(--space-5);
    text-align: center;
}

.sidebar-illustration .illus-image { width: 100px; margin: 0 auto var(--space-3); }

.sidebar-illustration .illus-text {
    font-size: var(--text-sm);
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: var(--font-semibold);
    font-size: var(--text-base);
    transition: all var(--duration-base) var(--ease-out);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn-primary {
    background: var(--red-primary);
    color: var(--white);
}
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: scale(0.97); }

.btn-teal {
    background: var(--teal-primary);
    color: var(--white);
}
.btn-teal:hover { background: var(--teal-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--grey-300);
    color: var(--grey-900);
}
.btn-outline:hover { border-color: var(--grey-600); background: var(--grey-50); }

.btn-outline-red {
    background: transparent;
    border: 1.5px solid var(--red-primary);
    color: var(--red-primary);
}
.btn-outline-red:hover { background: var(--red-primary); color: var(--white); }

.btn-outline-green {
    background: transparent;
    border: 1.5px solid var(--green);
    color: var(--green);
}
.btn-outline-green:hover { background: var(--green); color: var(--white); }

.btn-ghost {
    background: transparent;
    color: var(--teal-primary);
    padding: var(--space-2) var(--space-3);
}
.btn-ghost:hover { background: rgba(26,122,138,0.08); }

.btn-icon {
    width: 36px; height: 36px;
    padding: 0;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn .btn-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
    display: none;
}
.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-text { display: none; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    white-space: nowrap;
}

.badge-verified { background: rgba(39,174,96,0.12); color: var(--green); }
.badge-active { background: rgba(39,174,96,0.12); color: var(--green); }
.badge-pending { background: rgba(243,156,18,0.12); color: var(--amber); }
.badge-approved { background: rgba(39,174,96,0.12); color: var(--green); }
.badge-fulfilled { background: rgba(26,122,138,0.12); color: var(--teal-primary); }
.badge-cancelled { background: rgba(149,165,166,0.12); color: var(--grey-status); }
.badge-critical { background: rgba(231,76,60,0.12); color: var(--red-badge); }
.badge-urgent { background: var(--red-badge); color: var(--white); font-weight: var(--font-bold); }
.badge-specialty {
    background: var(--grey-100);
    color: var(--grey-600);
    border: 1px solid var(--grey-300);
}
.badge-blood-group {
    background: rgba(192,57,43,0.08);
    color: var(--red-primary);
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    padding: 4px 12px;
}
.badge-reg-id {
    background: rgba(26,122,138,0.1);
    color: var(--teal-dark);
    font-family: monospace;
    font-size: var(--text-xs);
}

.badge .badge-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.badge-verified .badge-dot { background: var(--green); }
.badge-active .badge-dot { background: var(--green); }
.badge-pending .badge-dot { background: var(--amber); }

/* ── Cards ── */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-base) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-profile {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-8);
}
.card-profile p { color: rgba(255,255,255,0.7); }

/* ── Toast System ── */
#toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 10000;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 420px;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    position: relative;
    overflow: hidden;
}
.toast.toast-success { border-left: 4px solid var(--green); }
.toast.toast-error { border-left: 4px solid var(--red-badge); }
.toast.toast-info { border-left: 4px solid var(--teal-primary); }
.toast.toast-warning { border-left: 4px solid var(--amber); }

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.toast-message { flex: 1; font-size: var(--text-sm); color: var(--grey-900); font-weight: var(--font-medium); }
.toast-close {
    width: 18px; height: 18px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity var(--duration-fast);
    flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }

.toast-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    border-radius: 0 0 0 var(--radius-lg);
}
.toast-progress.success { background: var(--green); }
.toast-progress.error { background: var(--red-badge); }
.toast-progress.info { background: var(--teal-primary); }
.toast-progress.warning { background: var(--amber); }

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.visible { display: flex; }
.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}

/* ── Skeleton / Shimmer ── */
.skeleton {
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--grey-100) 25%, var(--grey-50) 50%, var(--grey-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-text { height: 14px; margin-bottom: var(--space-2); }
.skeleton-text.w-60 { width: 60%; }
.skeleton-text.w-80 { width: 80%; }
.skeleton-text.w-40 { width: 40%; }
.skeleton-heading { height: 24px; width: 50%; margin-bottom: var(--space-4); }
.skeleton-card { height: 120px; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }

/* ── Realtime Banner ── */
.realtime-banner {
    position: sticky;
    top: 0;
    z-index: 500;
    background: linear-gradient(90deg, rgba(26,122,138,0.06) 0%, rgba(192,57,43,0.06) 100%);
    border-bottom: 1px solid rgba(26,122,138,0.15);
    padding: var(--space-2) var(--space-6);
    display: none;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--grey-900);
    transition: all var(--duration-base) var(--ease-out);
}
.realtime-banner.visible { display: flex; animation: slideUp var(--duration-base) var(--ease-out); }
.realtime-banner:hover { background: rgba(26,122,138,0.12); }
.rt-banner-icon { font-size: var(--text-lg); }
.rt-banner-text { font-weight: var(--font-medium); }
.rt-banner-text strong { color: var(--teal-dark); }
.rt-banner-time { font-size: var(--text-xs); color: var(--grey-600); margin-left: auto; }

/* ── Confetti ── */
.confetti-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 20000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 8px; height: 16px;
    border-radius: 2px;
    animation: confettiBurst 1.5s var(--ease-out) both;
}

/* ── Form Styles ── */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--grey-900);
    margin-bottom: var(--space-2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--red-badge);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 200ms var(--ease-out);
}
.form-error.visible { max-height: 24px; }

.form-input.error { border-color: var(--red-badge); }
.form-input.valid { border-color: var(--green); }

/* ── Toggle Switch ── */
.toggle {
    width: 44px; height: 24px;
    background: var(--grey-300);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
}
.toggle.active { background: var(--teal-primary); }
.toggle-thumb {
    width: 20px; height: 20px;
    background: var(--white);
    border-radius: 50%;
    position: absolute;
    top: 2px; left: 2px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--duration-fast) var(--ease-out);
}
.toggle.active .toggle-thumb { transform: translateX(20px); }

/* ── Page Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-8);
    border-bottom: 1px solid var(--grey-100);
    background: var(--white);
}

.page-header-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--grey-900);
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* ── Bell Icon ── */
.bell-wrapper {
    position: relative;
    cursor: pointer;
}
.bell-icon { width: 22px; height: 22px; color: var(--grey-600); }
.bell-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--red-badge);
    color: var(--white);
    font-size: 10px;
    font-weight: var(--font-bold);
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

/* ── Status dot ── */
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.green { background: var(--green); }
.status-dot.amber { background: var(--amber); }
.status-dot.red { background: var(--red-badge); }
.status-dot.grey { background: var(--grey-status); }
.status-dot.teal { background: var(--teal-primary); }

/* ── Slide-over Panel ── */
.slide-over {
    position: fixed;
    top: 0; right: 0;
    width: 420px;
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-xl);
    z-index: 8000;
    transform: translateX(100%);
    transition: transform 350ms var(--ease-out);
    overflow-y: auto;
    padding: var(--space-8);
}
.slide-over.open { transform: translateX(0); }

.slide-over-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 7999;
    display: none;
}
.slide-over-backdrop.visible { display: block; }
