/* ===================================
   Health Record Portal - Main Styles
   =================================== */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --light-bg: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===================================
   Login Page
   =================================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

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

.login-header i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.login-form label i {
    margin-right: 5px;
    color: var(--primary-color);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.login-footer i {
    margin-right: 5px;
    color: var(--success-color);
}

/* ===================================
   Header
   =================================== */

.main-header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    margin-right: 10px;
    font-size: 28px;
}

.main-nav {
    display: flex;
    gap: 5px;
}

.nav-link {
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--light-bg);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.3s;
}

.user-btn:hover {
    background: var(--border-color);
}

.user-btn i:first-child {
    font-size: 24px;
    color: var(--primary-color);
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 8px;
    display: none;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
}

.dropdown-menu a:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

/* ===================================
   Container & Layout
   =================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    flex: 1;
}

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

.page-header h1 {
    font-size: 32px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header p {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ===================================
   Cards
   =================================== */

.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2,
.card-header h3 {
    font-size: 18px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}

.card-full {
    grid-column: 1 / -1;
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* ===================================
   Dashboard Grid
   =================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.profile-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--light-bg);
    border-radius: 8px;
}

.profile-item i {
    font-size: 24px;
    color: var(--primary-color);
}

.profile-item .label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.profile-item .value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--light-bg);
    border-radius: 8px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.bg-primary {
    background: var(--primary-color);
}

.stat-icon.bg-success {
    background: var(--success-color);
}

.stat-icon.bg-warning {
    background: var(--warning-color);
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===================================
   Forms
   =================================== */

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    color: var(--primary-color);
}

.form-control {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

/* ===================================
   Buttons
   =================================== */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

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

.btn-block {
    width: 100%;
    justify-content: center;
}

/* ===================================
   Tables
   =================================== */

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--light-bg);
}

.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: var(--light-bg);
}

/* ===================================
   Badges
   =================================== */

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-primary {
    background: #dbeafe;
    color: var(--primary-color);
}

.badge-secondary {
    background: #f3f4f6;
    color: var(--secondary-color);
}

.badge-success {
    background: #d1fae5;
    color: var(--success-color);
}

.badge-danger {
    background: #fee2e2;
    color: var(--danger-color);
}

/* ===================================
   Alerts
   =================================== */

.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--info-color);
}

/* ===================================
   Visits Grid
   =================================== */

.visits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.visit-card .card-header {
    background: var(--light-bg);
}

.visit-info p {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
}

.visit-info i {
    color: var(--primary-color);
    margin-right: 5px;
}

/* ===================================
   Visit Detail
   =================================== */

.visit-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-item strong {
    color: var(--text-secondary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-item span {
    color: var(--text-primary);
    font-size: 16px;
}

/* ===================================
   Attachments
   =================================== */

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light-bg);
    border-radius: 8px;
}

.attachment-item i {
    font-size: 20px;
    color: var(--primary-color);
}

.attachment-item span {
    flex: 1;
}

.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.attachment-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.attachment-icon {
    margin-bottom: 12px;
}

.attachment-icon img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
}

.attachment-icon i {
    font-size: 48px;
    color: var(--primary-color);
}

.attachment-info h4 {
    font-size: 14px;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.attachment-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ===================================
   Empty State
   =================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ===================================
   Footer
   =================================== */

.main-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-content p {
    margin: 5px 0;
}

/* ===================================
   Utility Classes
   =================================== */

.text-center {
    text-align: center;
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-info {
    color: var(--info-color);
}

.text-muted {
    color: var(--text-secondary);
}

.mt-3 {
    margin-top: 15px;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        height: auto;
        padding: 15px 20px;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        flex-direction: column;
        margin-top: 15px;
        gap: 5px;
    }
    
    .nav-link {
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .dashboard-grid,
    .visits-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table-responsive {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 20px;
    }
}

