/* ========================================
   DASHBOARD CSS - ALL PAGES
   ======================================== */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background-color: #fafafa;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
    margin-bottom: 1.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    text-decoration: none;
    letter-spacing: -0.025em;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.25;
}

.btn-primary {
    background-color: #f59e0b;
    color: white;
    border: 1px solid #f59e0b;
}

.btn-primary:hover {
    background-color: #d97706;
    border-color: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.25);
}

.btn-secondary {
    background-color: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background-color: #edf2f7;
    border-color: #cbd5e0;
    color: #2d3748;
}

.btn-outline {
    background-color: transparent;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-outline:hover {
    background-color: #f7fafc;
    border-color: #cbd5e0;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* ========================================
   BREADCRUMBS
   ======================================== */
.breadcrumbs {
    padding: 0.5rem 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-current {
    color: #718096;
    font-size: 0.875rem;
}

.breadcrumb-link {
    color: #4a5568;
    text-decoration: none;
    font-size: 0.875rem;
}

.breadcrumb-link:hover {
    color: #2d3748;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: #cbd5e0;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    padding-bottom: 3rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.025em;
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2d3748;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #718096;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* ========================================
   MODALS
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 0;
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a202c;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: #2d3748;
}

.modal-content {
    padding: 0 1.5rem 1.5rem;
}

/* ========================================
   PATIENT LIST PAGE
   ======================================== */

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.15s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    font-size: 0.875rem;
}

/* Patients Grid */
.patients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.patient-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
}

.patient-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.patient-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.patient-id {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a202c;
}

.patient-meta {
    text-align: right;
}

.id-code {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #fef3c7;
    color: #92400e;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.patient-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f7fafc;
    border-radius: 8px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: #2d3748;
}

.patient-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Loading and Empty States */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #718096;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #f59e0b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #718096;
    margin-bottom: 1.5rem;
}

/* ========================================
   AUTH PAGES (LOGIN/SIGNUP)
   ======================================== */
.auth-page {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #f59e0b;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.auth-brand p {
    color: #718096;
    font-size: 1rem;
    margin: 0;
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-bottom: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.checkbox-text {
    color: #4a5568;
    font-size: 0.875rem;
    line-height: 1.5;
}

.auth-links {
    text-align: center;
    margin: 1.5rem 0;
}

.auth-link {
    color: #f59e0b;
    text-decoration: none;
    font-size: 0.875rem;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
    color: #718096;
    font-size: 0.875rem;
}

.auth-divider:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.auth-divider span {
    background: white;
    padding: 0 1rem;
}

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

.auth-signup p {
    color: #718096;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.auth-loading {
    text-align: center;
    padding: 2rem 0;
    color: #718096;
}

.auth-loading .loading-spinner {
    margin: 0 auto 1rem;
}

.auth-error {
    text-align: center;
    padding: 1rem;
    background: #fed7d7;
    border: 1px solid #feb2b2;
    border-radius: 8px;
    color: #c53030;
    margin-bottom: 1rem;
}

.auth-error p {
    margin-bottom: 1rem;
}

.auth-success {
    text-align: center;
    padding: 2rem 0;
}

.success-icon {
    width: 48px;
    height: 48px;
    background: #68d391;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

.auth-success h3 {
    color: #1a202c;
    margin-bottom: 0.5rem;
}

.auth-success p {
    color: #718096;
    margin-bottom: 1.5rem;
}

/* ========================================
   INDIVIDUAL PATIENT VIEW PAGE
   ======================================== */

/* Patient Header Section */
.patient-header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 3rem;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    gap: 2rem;
}

.patient-info h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}

.patient-details {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.patient-detail {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.detail-value {
    font-size: 1rem;
    color: #2d3748;
    font-weight: 500;
}

.detail-link {
    color: #f59e0b;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
}

.detail-link:hover {
    text-decoration: underline;
}

/* Assessments Section */
.assessments-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.assessments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.assessments-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
}

.assessments-filter {
    min-width: 200px;
}

.filter-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

/* Assessment Timeline */
.assessments-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assessment-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.15s ease;
    gap: 1rem;
}

.assessment-card:hover {
    background: #f1f3f4;
    border-color: #dee2e6;
}

.assessment-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 120px;
}

.assessment-date {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.assessment-measure {
    font-size: 1rem;
    color: #1a202c;
    font-weight: 600;
}

.assessment-score {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: center;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    min-width: 40px;
    text-align: center;
}

.severity-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.severity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.severity-text {
    font-size: 0.875rem;
    color: #4a5568;
    font-weight: 500;
    min-width: 80px;
}

.assessment-actions {
    display: flex;
    gap: 0.5rem;
}

/* Empty Assessments State */
.empty-assessments {
    text-align: center;
    padding: 3rem 2rem;
    color: #718096;
}

.empty-assessments .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-assessments h3 {
    font-size: 1.25rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.empty-assessments p {
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Assessment Assignment Modal */
.measure-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 1.5rem;
}

.measure-option {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.measure-option:last-child {
    border-bottom: none;
}

.measure-option:hover {
    background-color: #f7fafc;
}

.measure-option.selected {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

.measure-option strong {
    display: block;
    color: #1a202c;
    margin-bottom: 0.25rem;
}

.measure-option p {
    margin: 0;
    color: #718096;
    font-size: 0.875rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .header-content {
        padding: 0 0.75rem;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .header-actions .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .patients-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .patient-card {
        padding: 1rem;
    }
    
    .patient-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .patient-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Patient View Mobile */
    .patient-header-section {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .patient-details {
        gap: 1rem;
    }
    
    .patient-actions {
        align-self: stretch;
    }
    
    .assessments-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .assessment-card {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 1rem;
    }
    
    .assessment-score {
        justify-content: flex-start;
        gap: 1rem;
    }
    
    .assessment-actions {
        align-self: stretch;
    }
    
    .assessment-actions .btn {
        flex: 1;
        justify-content: center;
    }
}