/* Lusaka Eye Hospital Portal - Website Management Module CSS
   Design Language: Patient Logbook Standard (Slate 800 Sidebar, Sky 500 Accents, Inter, Tailwind Utilities)
*/

:root {
    --primary-color: #0ea5e9;    /* Sky 500 */
    --primary-dark: #0284c7;     /* Sky 600 */
    --primary-light: #f0f9ff;    /* Sky 50 */
    --secondary-color: #22c55e;  /* Green 500 */
    --bg-color: #f8fafc;         /* Slate 50 */
    --sidebar-bg: #1e293b;       /* Slate 800 */
    --sidebar-width: 280px;
    --header-height: 70px;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: #1f2937;
    -webkit-tap-highlight-color: transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Industry Standard Sidebar (Desktop) --- */
#main-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid #334155;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-menu {
    padding: 24px 16px;
    flex-grow: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.92rem;
    color: #94a3b8;
    text-decoration: none;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}

.nav-item.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.25);
}

.nav-item i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
}

/* --- Main Content Area --- */
.content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s, width 0.3s;
    min-height: 100vh;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
}

.main-content {
    padding: 32px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* View Sections */
.view-panel {
    display: none;
}
.view-panel.active {
    display: block;
    animation: slideFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Animations */
@keyframes slideFadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Form inputs */
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.4rem;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: #0f172a;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
    transform: scale(1.005);
}

/* Springy button clicks from logbook */
button {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
button:active {
    transform: scale(0.97) !important;
}

/* Cards & Metric Cards */
.metric-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.08);
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.metric-label {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 4px;
    font-weight: 600;
}

/* Tables matching Logbook */
.table-container {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.table-header-cell {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

/* Modals */
.modal-backdrop, .modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop.active, .modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease forwards;
}

.modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: capitalize;
}
.badge-status-new {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.badge-status-confirmed {
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.badge-status-rescheduled {
    background-color: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}
.badge-status-completed {
    background-color: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.badge-status-cancelled {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    background-color: #ffffff;
    color: #0f172a;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15);
    border: 1px solid #e2e8f0;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideFadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    max-width: 400px;
}
.toast-success {
    border-left: 4px solid var(--primary-color);
}
.toast-success i {
    color: var(--primary-color);
}
.toast-error {
    border-left: 4px solid var(--danger);
}
.toast-error i {
    color: var(--danger);
}

/* Mobile Overlay */
#nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 45;
    display: none;
}
#nav-overlay.active {
    display: block;
}

/* Mobile Responsive Adjustments */
@media (max-width: 1024px) {
    #main-sidebar {
        transform: translateX(-100%);
    }
    #main-sidebar.open {
        transform: translateX(0);
    }
    .content-wrapper {
        margin-left: 0;
        width: 100%;
    }
    .top-header {
        padding: 0 16px;
    }
    .main-content {
        padding: 16px;
    }
}
