/* ===== WARD CONSOLE STYLES ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --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;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

/* Animations */
@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-slide {
    animation: slideIn 0.3s ease;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0 0 5px 0;
    letter-spacing: -0.5px;
}

.page-subtitle {
    color: var(--gray-500);
    margin: 0;
    font-size: 15px;
}

/* Buttons */
.btn-primary, .btn-outline, .btn-secondary, .btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border: 1px solid var(--gray-100);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.hope { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.stat-icon.beds { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-icon.sessions { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-icon.discharged { background: linear-gradient(135deg, #ef4444, #f87171); }

.stat-content {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-footer {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* Patients Header */
.patients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-700);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--gray-200), transparent);
}

.search-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 14px;
    pointer-events: none;
}

.search-input {
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--gray-200);
    border-radius: 40px;
    font-size: 14px;
    width: 240px;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.filter-select {
    padding: 12px 20px;
    border: 1px solid var(--gray-200);
    border-radius: 40px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 140px;
}

/* Patients Grid */
.patients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.patient-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border: 1px solid var(--gray-100);
}

.patient-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--gray-200);
}

.patient-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.patient-avatar {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--gray-800), var(--gray-900));
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: var(--shadow);
}

.patient-status {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-badge {
    background: var(--gray-100);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 8px;
    color: var(--gray-500);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.patient-info {
    background: var(--gray-50);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    width: 80px;
    color: var(--gray-500);
}

.info-value {
    flex: 1;
    color: var(--gray-800);
    font-weight: 500;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success, .badge.success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning, .badge.warning {
    background: #fed7aa;
    color: #92400e;
}

/* Patient Actions */
.patient-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    position: relative;
}

.btn-icon {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: white;
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-icon.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-icon:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

/* Dropdown Container */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu-custom {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    min-width: 160px;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.dropdown-menu-custom.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--gray-700);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid var(--gray-100);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--gray-50);
}

.dropdown-item.text-danger {
    color: var(--danger);
}

.dropdown-item.text-danger:hover {
    background: #fee2e2;
}

.dropdown-form {
    margin: 0;
}

/* Session Preview */
.session-preview {
    background: var(--gray-50);
    border-radius: 16px;
    padding: 16px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.view-all-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 12px;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
}

.preview-item:last-child {
    border-bottom: none;
}

/* Quick Links */
.quick-links-section {
    margin: 40px 0;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.quick-link-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    text-decoration: none;
    transition: all 0.3s;
}

.quick-link-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--gray-200);
}

.quick-link-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-link-icon.archived-patients { background: linear-gradient(135deg, #f97316, #fb923c); }
.quick-link-icon.archived-sessions { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.quick-link-icon.discharged { background: linear-gradient(135deg, #64748b, #94a3b8); }

.quick-link-content {
    flex: 1;
}

.quick-link-content h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.quick-link-content p {
    margin: 0 0 4px 0;
    font-size: 12px;
    color: var(--gray-500);
}

.quick-link-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
}

.quick-link-arrow {
    font-size: 20px;
    color: var(--gray-400);
    transition: all 0.3s;
}

.quick-link-card:hover .quick-link-arrow {
    transform: translateX(5px);
    color: var(--primary);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 24px;
    padding: 28px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--gray-800);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-500);
    padding: 5px;
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    padding-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--gray-700);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.checkbox-row {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    flex-wrap: wrap;
}

/* Session Panel */
.session-panel {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 380px;
    z-index: 900;
    animation: slideIn 0.3s ease;
}

.session-panel-content {
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.session-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.session-panel-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--gray-800);
}

/* Patient Summary */
.patient-summary {
    background: var(--gray-50);
    border-radius: 16px;
    padding: 16px;
    margin: 16px 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.summary-item {
    text-align: left;
}

.summary-label {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 16px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-pane {
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.tab-pane.active {
    display: block;
}

/* Stats Mini */
.stats-mini {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 16px;
}

.stat-mini {
    text-align: center;
}

.stat-mini-label {
    display: block;
    font-size: 10px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.stat-mini-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-800);
}

/* Warning Message */
.warning-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 12px;
    color: #856404;
    font-size: 13px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.empty-icon {
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* Sessions Table */
.sessions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sessions-table th {
    background: var(--gray-100);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
}

.sessions-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.sessions-table tr:hover {
    background: var(--gray-50);
}

.status-icon {
    text-align: center;
    font-size: 16px;
}

.notes-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Session Actions */
.session-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

.session-actions button,
.session-actions form {
    display: inline-flex;
    align-items: center;
}

.session-actions .action-link {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    text-decoration: none;
}

.session-actions .action-link:hover {
    background: var(--gray-100);
    transform: scale(1.1);
}

.edit-link {
    color: #3b82f6 !important;
}

.edit-link:hover {
    color: #2563eb !important;
}

.archive-link {
    color: #f59e0b !important;
}

.archive-link:hover {
    color: #d97706 !important;
}

.delete-link {
    color: #ef4444 !important;
}

.delete-link:hover {
    color: #dc2626 !important;
}

/* Notes Card */
.notes-card {
    background: var(--gray-50);
    border-radius: 16px;
    padding: 20px;
    min-height: 150px;
    border: 1px solid var(--gray-200);
}

.notes-content {
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
}

.no-notes {
    color: var(--gray-400);
    font-style: italic;
    text-align: center;
    padding: 40px;
}

.loading {
    text-align: center;
    color: var(--gray-400);
    padding: 40px;
    font-style: italic;
}

.error {
    text-align: center;
    color: var(--danger);
    padding: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        display: flex;
        gap: 12px;
    }
    
    .header-actions .btn-primary,
    .header-actions .btn-outline {
        flex: 1;
        justify-content: center;
    }
    
    .search-filters {
        width: 100%;
        flex-direction: column;
    }
    
    .search-box,
    .search-input,
    .filter-select {
        width: 100%;
    }
    
    .patients-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-mini {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .session-panel {
        width: 100%;
        right: 0;
        bottom: 0;
    }
    
    .patient-actions {
        flex-wrap: wrap;
    }
    
    .btn-icon {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    .dropdown-container {
        flex: 1 1 100%;
        margin-top: 5px;
    }
    
    .dropdown-toggle {
        width: 100%;
    }
    
    .dropdown-menu-custom {
        width: 100%;
        position: relative;
        margin-top: 5px;
        box-shadow: var(--shadow);
    }
    
    .sessions-table {
        font-size: 12px;
    }
    
    .sessions-table th,
    .sessions-table td {
        padding: 8px;
    }
}