/* ============================================
   AFRI LAND HOSPITAL - Complete Style System
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    /* Primary Colors */
    --afri-primary: #0a2e4a;
    --afri-primary-light: #1b4a6b;
    --afri-primary-dark: #061e30;
    --afri-gold: #f5c542;
    --afri-gold-dark: #d4a830;
    --afri-gold-light: #fdebb3;
    
    /* Secondary Colors */
    --afri-success: #22c55e;
    --afri-danger: #ef4444;
    --afri-warning: #f59e0b;
    --afri-info: #3b82f6;
    --afri-purple: #8b5cf6;
    --afri-pink: #ec4899;
    
    /* Grays */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Spacing */
    --sidebar-width: 260px;
    --topbar-height: 70px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ---------- Reset & Base ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--afri-primary) 0%, var(--afri-primary-dark) 100%);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 4px;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    box-shadow: inset 3px 0 0 var(--afri-gold);
}

.nav-item i {
    width: 20px;
    font-size: 1.1rem;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--afri-danger);
    color: white;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.nav-item .badge-warning {
    background: var(--afri-warning);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--afri-gold);
    color: var(--afri-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* ---------- Main Content ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------- Top Bar ---------- */
.top-bar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 8px;
}

.search-input {
    padding: 8px 16px 8px 40px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    width: 300px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--afri-primary-light);
    box-shadow: 0 0 0 3px rgba(27, 74, 107, 0.1);
    background: white;
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.notifications {
    position: relative;
    cursor: pointer;
    padding: 8px;
    font-size: 1.2rem;
    color: var(--gray-600);
}

.notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--afri-danger);
    border-radius: 50%;
    border: 2px solid white;
}

/* ---------- Dashboard Content ---------- */
.dashboard-content {
    padding: 32px;
    flex: 1;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
    border: 1px solid var(--gray-200);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-top: 2px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.chart-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
}

/* Recent Activity */
.recent-activity {
    background: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.activity-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}

.view-all {
    color: var(--afri-primary-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.view-all:hover {
    text-decoration: underline;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--afri-primary-light);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .search-input {
        width: 200px;
    }
}

@media (max-width: 640px) {
    .top-bar {
        padding: 0 16px;
    }
    
    .dashboard-content {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .search-input {
        width: 140px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
}

/* ---------- Utility Classes ---------- */
.bg-afri-primary {
    background: var(--afri-primary);
}

.text-afri-gold {
    color: var(--afri-gold);
}

.border-afri {
    border-color: var(--afri-primary-light);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--afri-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--afri-info);
    animation: slideIn 0.3s ease-out;
    min-width: 280px;
}

.toast-success {
    border-left-color: var(--afri-success);
}

.toast-error {
    border-left-color: var(--afri-danger);
}

.toast-warning {
    border-left-color: var(--afri-warning);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   APPOINTMENT COMPONENTS
   ============================================ */

/* Status Badges */
.status-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge.scheduled {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.cancelled {
    background: #fce4e4;
    color: #991b1b;
}

.status-badge.no-show {
    background: #fef3c7;
    color: #92400e;
}

/* View Buttons */
.view-btn {
    padding: 6px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #64748b;
    font-size: 0.875rem;
    transition: all 0.2s;
    cursor: pointer;
}

.view-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.view-btn.active {
    background: #0a2e4a;
    color: white;
    border-color: #0a2e4a;
}

/* Appointment Card */
.appointment-card {
    transition: all 0.2s ease;
}

.appointment-card:hover {
    transform: translateX(4px);
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-cell {
    min-height: 100px;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
}

.calendar-cell.today {
    background: #eff6ff;
    border-color: #0a2e4a;
}

.calendar-cell.other-month {
    background: #f8fafc;
    color: #94a3b8;
}

/* Time Slot Selector */
.time-slot-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.time-slot {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.time-slot:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.time-slot.selected {
    background: #0a2e4a;
    color: white;
    border-color: #0a2e4a;
}

.time-slot.booked {
    background: #fce4e4;
    border-color: #fca5a5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Modal Enhancements */
.modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive Calendar */
@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 1px;
    }
    
    .calendar-cell {
        min-height: 60px;
        font-size: 0.75rem;
        padding: 2px;
    }
    
    .view-btn {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
}

/* Scrollable Appointment List */
.appointment-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.appointment-list::-webkit-scrollbar {
    width: 4px;
}

.appointment-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.appointment-list::-webkit-scrollbar-track {
    background: #f1f5f9;
}