/* Home Health EHR - Professional Healthcare Theme */
:root {
    --primary-color: #0d6efd;
    --primary-dark: #0b5ed7;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --teal-color: #20c997;
    --purple-color: #6f42c1;
    --orange-color: #fd7e14;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --healthcare-blue: #1976d2;
    --healthcare-teal: #00796b;
    --healthcare-light: #e3f2fd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    overflow-x: hidden;
}

/* Login Page Styles */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23ffffff" fill-opacity="0.1" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
    background-repeat: no-repeat;
    background-position: bottom;
    background-size: cover;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--healthcare-blue), var(--healthcare-teal));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: white;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.login-header p {
    font-size: 14px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.login-footer a {
    color: var(--healthcare-blue);
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #1a237e 0%, #283593 100%);
    color: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-icon-sm {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, #4fc3f7, #00bcd4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.sidebar-brand {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-brand {
    display: none;
}

.sidebar-nav {
    list-style: none;
    padding: 15px 10px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav .nav-item {
    margin-bottom: 5px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, #4fc3f7, #00bcd4);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 195, 247, 0.4);
}

.sidebar-nav .nav-link i {
    font-size: 20px;
    min-width: 24px;
    text-align: center;
}

.sidebar.collapsed .sidebar-nav .nav-link span {
    display: none;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    font-size: 32px;
    opacity: 0.9;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 12px;
    opacity: 0.7;
}

.sidebar.collapsed .user-details {
    display: none;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: white;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    font-size: 24px;
    color: var(--secondary-color);
    padding: 5px;
}

.header-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
}

.header-search input {
    padding-left: 40px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    background: #f5f7fa;
}

.header-search input:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-actions .btn-link {
    color: var(--secondary-color);
    font-size: 20px;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.header-actions .btn-link:hover {
    background: #f5f7fa;
    color: var(--primary-color);
}

.header-actions .badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 10px;
    padding: 2px 5px;
}

/* Page Content */
.page-content {
    padding: 20px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
}

.page-header h2 i {
    color: var(--healthcare-blue);
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-content p {
    font-size: 14px;
    color: var(--secondary-color);
    margin: 0;
}

.stat-primary .stat-icon { background: rgba(13, 110, 253, 0.1); color: var(--primary-color); }
.stat-success .stat-icon { background: rgba(25, 135, 84, 0.1); color: var(--success-color); }
.stat-warning .stat-icon { background: rgba(255, 193, 7, 0.1); color: #b38600; }
.stat-danger .stat-icon { background: rgba(220, 53, 69, 0.1); color: var(--danger-color); }
.stat-info .stat-icon { background: rgba(13, 202, 240, 0.1); color: #0aa2c0; }
.stat-purple .stat-icon { background: rgba(111, 66, 193, 0.1); color: var(--purple-color); }
.stat-teal .stat-icon { background: rgba(32, 201, 151, 0.1); color: var(--teal-color); }
.stat-orange .stat-icon { background: rgba(253, 126, 20, 0.1); color: var(--orange-color); }

/* Small Stat Cards */
.stat-card-sm {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-card-sm i {
    font-size: 24px;
}

.stat-card-sm h4 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.stat-card-sm small {
    font-size: 12px;
    color: var(--secondary-color);
}

.stat-card-sm.stat-primary { border-left: 4px solid var(--primary-color); }
.stat-card-sm.stat-primary i { color: var(--primary-color); }
.stat-card-sm.stat-success { border-left: 4px solid var(--success-color); }
.stat-card-sm.stat-success i { color: var(--success-color); }
.stat-card-sm.stat-warning { border-left: 4px solid var(--warning-color); }
.stat-card-sm.stat-warning i { color: #b38600; }
.stat-card-sm.stat-danger { border-left: 4px solid var(--danger-color); }
.stat-card-sm.stat-danger i { color: var(--danger-color); }
.stat-card-sm.stat-info { border-left: 4px solid var(--info-color); }
.stat-card-sm.stat-info i { color: #0aa2c0; }

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
    font-weight: 600;
}

.card-header h5 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.card-header h5 i {
    color: var(--healthcare-blue);
}

.card-body {
    padding: 20px;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--secondary-color);
    padding: 12px 15px;
}

.table tbody td {
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
}

.table-hover tbody tr:hover {
    background: #f8f9fa;
}

/* Status Badges */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
}

.badge-status-active { background: #d4edda; color: #155724; }
.badge-status-inactive { background: #f8d7da; color: #721c24; }
.badge-status-pending { background: #fff3cd; color: #856404; }
.badge-status-overdue { background: #f8d7da; color: #721c24; }
.badge-status-completed { background: #d1ecf1; color: #0c5460; }

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: var(--healthcare-light);
    border-color: var(--healthcare-blue);
    border-style: solid;
}

.quick-action-btn i {
    font-size: 28px;
    color: var(--healthcare-blue);
    margin-bottom: 8px;
}

.quick-action-btn span {
    font-size: 13px;
    font-weight: 500;
    color: var(--dark-color);
}

/* Alerts List */
.alerts-list {
    max-height: 300px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
    transition: background 0.2s;
}

.alert-item:hover {
    background: #e9ecef;
}

.alert-item.priority-high {
    border-left: 3px solid var(--danger-color);
}

.alert-item.priority-medium {
    border-left: 3px solid var(--warning-color);
}

.alert-item.priority-low {
    border-left: 3px solid var(--info-color);
}

.alert-icon {
    font-size: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.alert-message {
    font-size: 13px;
    color: var(--secondary-color);
}

.alert-time {
    font-size: 11px;
    color: var(--secondary-color);
}

/* Visits List */
.visits-list {
    max-height: 250px;
    overflow-y: auto;
}

.visit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s;
}

.visit-item:hover {
    background: #e9ecef;
}

.visit-time {
    font-weight: 600;
    font-size: 13px;
    color: var(--healthcare-blue);
    min-width: 60px;
}

.visit-info {
    flex: 1;
}

.visit-patient {
    font-weight: 500;
    font-size: 14px;
}

.visit-type {
    font-size: 12px;
    color: var(--secondary-color);
}

.visit-status {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Calendar Customization */
#visitCalendar {
    min-height: 500px;
}

.fc {
    font-family: inherit;
}

.fc-toolbar-title {
    font-size: 1.2rem !important;
}

.fc-event {
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 12px;
}

.fc-daygrid-day-number {
    color: var(--dark-color);
}

/* Form Styles */
.form-label {
    font-weight: 500;
    font-size: 14px;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 10px 12px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.input-group-text {
    background: #f8f9fa;
    border-color: #dee2e6;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--healthcare-blue);
    border-color: var(--healthcare-blue);
}

.btn-primary:hover {
    background: #1565c0;
    border-color: #1565c0;
}

.btn-outline-primary {
    color: var(--healthcare-blue);
    border-color: var(--healthcare-blue);
}

.btn-outline-primary:hover {
    background: var(--healthcare-blue);
    border-color: var(--healthcare-blue);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Action Buttons */
.action-btn {
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 6px;
}

/* Pagination */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    color: var(--dark-color);
    border: none;
    background: #f8f9fa;
}

.pagination .page-link:hover {
    background: #e9ecef;
}

.pagination .page-item.active .page-link {
    background: var(--healthcare-blue);
    color: white;
}

/* Modal Customization */
.modal-content {
    border: none;
    border-radius: 16px;
}

.modal-header {
    border-bottom: 1px solid #eee;
    padding: 20px;
}

.modal-title {
    font-weight: 600;
    display: flex;
    align-items: center;
}

.modal-title i {
    color: var(--healthcare-blue);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid #eee;
    padding: 15px 20px;
}

/* Nav Tabs */
.nav-tabs {
    border-bottom: 2px solid #eee;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--secondary-color);
    font-weight: 500;
    padding: 10px 20px;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--healthcare-blue);
}

.nav-tabs .nav-link.active {
    color: var(--healthcare-blue);
    border-bottom-color: var(--healthcare-blue);
    background: none;
}

/* Toast */
.toast {
    border: none;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-search {
        display: none;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .stat-content h3 {
        font-size: 24px;
    }
}

/* Utility Classes */
.text-healthcare {
    color: var(--healthcare-blue) !important;
}

.bg-healthcare {
    background-color: var(--healthcare-blue) !important;
}

.border-healthcare {
    border-color: var(--healthcare-blue) !important;
}

/* Animation for loading states */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Print Styles */
@media print {
    .sidebar, .top-header, .quick-actions {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
