:root {
    --primary-color: #244C49;
    --primary-dark: #263A38;
    --primary-light: #DCE7DF;
    --secondary-color: #94525F;
    --accent-color: #94525F;
    --success-color: #7fa87f;
    --warning-color: #e6b87e;
    --danger-color: #d46666;
    --text-primary: #4a4a4a;
    --text-secondary: #6b6b6b;
    --background: #F7F3ED;
    --surface: #ffffff;
    --border-color: #e8e8e8;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --brand-primary: #244C49;
    --brand-secondary: #94525F;
    
    /* Touch-friendly sizes */
    --touch-target-min: 44px;
    --touch-padding: 16px;
    --tablet-container-padding: 32px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Prevent text selection on touch devices */
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Manrope', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    /* Prevent zooming on input focus */
    touch-action: manipulation;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Tablet-specific container padding */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 0 var(--tablet-container-padding);
    }
}

/* Header Styles */
header {
    background-color: var(--surface);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-text {
    font-family: 'Georgia', serif;
    font-size: 2.5rem;
    color: var(--brand-primary);
    font-style: italic;
    font-weight: 400;
    line-height: 1;
}

.logo h1 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.3s;
    /* Increase touch target */
    padding: 12px;
    display: block;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
}

nav a:hover {
    color: var(--primary-color);
}

/* Touch feedback */
nav a:active {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

/* User navigation styles */
nav .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

nav .user-info span {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

nav .logout-btn {
    background-color: var(--brand-primary);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

nav .logout-btn:hover {
    background-color: var(--primary-dark);
    transform: none;
}

/* Hero Section */
.hero {
    padding: 4rem 0;
    background-color: var(--background);
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-content h2 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 400;
}

.hero-content p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* Enhanced Buttons for Touch */
.btn-primary, .btn-secondary {
    padding: var(--touch-padding) 32px;
    font-size: 1.1rem;
    font-weight: 500;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--touch-target-min);
    min-width: 120px;
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 76, 73, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(36, 76, 73, 0.3);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--primary-dark);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--brand-secondary);
    color: white;
    border-color: var(--brand-secondary);
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* Assessment Section */
.assessment-section {
    padding: 3rem 0;
    background-color: var(--surface);
    min-height: 600px;
}

.progress-bar {
    width: 100%;
    height: 12px; /* Larger for better visibility */
    background-color: var(--border-color);
    border-radius: 6px;
    margin-bottom: 3rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--brand-secondary);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Form Styles Enhanced for Touch */
.form-wizard {
    background-color: var(--surface);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    min-height: 400px;
}

/* Tablet-specific form padding */
@media (min-width: 768px) and (max-width: 1024px) {
    .form-wizard {
        padding: 3rem;
    }
}

.form-section {
    display: none;
}

.form-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-section h3 {
    color: var(--primary-dark);
    margin-bottom: 2rem;
    font-size: 1.75rem; /* Larger for tablets */
}

.form-group {
    margin-bottom: 2rem; /* More spacing between fields */
}

.form-group label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1.1rem; /* Larger labels */
}

/* Enhanced input fields for touch */
.form-group input,
.form-group select,
input[type="date"],
input[type="tel"],
input[type="email"] {
    width: 100%;
    padding: var(--touch-padding);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem; /* Larger text */
    transition: border-color 0.3s;
    min-height: var(--touch-target-min);
    background-color: var(--surface);
    /* Prevent zoom on iOS */
    -webkit-appearance: none;
}

/* Enhanced select dropdown for touch */
.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-group input:focus,
.form-group select:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(36, 76, 73, 0.1);
}

.form-group .help-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.form-group[style*="display: none"] {
    display: none !important;
}

/* Enhanced form navigation for tablets */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.form-navigation button {
    min-width: 140px;
}

#returnToSummaryBtn {
    margin-right: auto;
}

/* Step indicator for tablets */
.step-indicator {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Results Section */
.results-section {
    padding: 3rem 0;
    background-color: var(--surface);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.result-card {
    background-color: var(--surface);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
}

.result-card:hover {
    transform: translateY(-5px);
}

.result-card i {
    font-size: 3.5rem;
    color: var(--brand-secondary);
    margin-bottom: 1rem;
}

.risk-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 1rem 0;
}

.risk-category {
    font-size: 1.75rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    display: inline-block;
    margin: 1rem 0;
}

.risk-category.low { 
    background-color: #e8f5e9; 
    color: #2e7d32; 
}

.risk-category.average { 
    background-color: #e3f2fd; 
    color: #1565c0; 
}

.risk-category.moderate { 
    background-color: #fff3e0; 
    color: #ef6c00; 
}

.risk-category.high { 
    background-color: #fce4ec; 
    color: #c2185b; 
}

.risk-category.very_high { 
    background-color: #ffebee; 
    color: #b71c1c; 
}

/* Recommendations */
.recommendations {
    background-color: var(--background);
    padding: 2.5rem;
    border-radius: 10px;
    margin: 2rem 0;
}

.recommendations h3 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.75rem;
}

.recommendation-item {
    background-color: var(--surface);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--brand-secondary);
}

.recommendation-item h4 {
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

/* Questionnaire Summary Section */
.questionnaire-summary {
    background-color: var(--background);
    padding: 2.5rem;
    border-radius: 10px;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

.questionnaire-summary h3 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.75rem;
}

.summary-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.summary-section {
    background-color: var(--surface);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.summary-section h4 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h4 {
    margin: 0;
}

.btn-edit-section {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    background-color: var(--primary-light);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-edit-section:hover {
    background-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-edit-section i {
    font-size: 0.875rem;
}

.summary-items {
    display: grid;
    gap: 0.75rem;
}

.summary-item {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-weight: 600;
    color: var(--text-primary);
    flex: 0 0 40%;
    padding-right: 1rem;
}

.summary-value {
    color: var(--text-secondary);
    flex: 1;
}

.family-member-details {
    margin-left: 2rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #f9f9f9;
    border-left: 3px solid var(--primary-light);
    border-radius: 4px;
}

.family-member-details .summary-item {
    font-size: 0.95rem;
}

.no-data-message {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 1.1rem;
}

.no-data-message i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

/* Enhanced Mammographer Questions */
.mammographer-questions {
    background-color: var(--background);
    padding: 2.5rem;
    border-radius: 10px;
    margin: 2rem 0;
}

.mammographer-questions h3 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.75rem;
}

.mammographer-questions .form-group {
    margin-bottom: 1.5rem;
}

.mammographer-questions label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mammographer-questions select {
    width: 100%;
    padding: var(--touch-padding);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: inherit;
    background-color: white;
    transition: border-color 0.3s;
}

.mammographer-questions select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(36, 76, 73, 0.1);
}

/* Enhanced Mammographer Notes for touch */
.mammographer-notes {
    background-color: var(--background);
    padding: 2.5rem;
    border-radius: 10px;
    margin: 2rem 0;
}

.mammographer-notes h3 {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.75rem;
}

.notes-textarea {
    width: 100%;
    padding: var(--touch-padding);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 150px;
    transition: border-color 0.3s;
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(36, 76, 73, 0.1);
}

.notes-textarea::placeholder {
    color: var(--text-secondary);
}

/* Resources Section */
.resources-section {
    padding: 4rem 0;
    background-color: var(--background);
}

.resources-section h2 {
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 3rem;
    font-size: 2.25rem;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.resource-card {
    background-color: var(--surface);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
}

.resource-card:hover {
    transform: translateY(-5px);
}

.resource-card i {
    font-size: 3.5rem;
    color: var(--brand-primary);
    margin-bottom: 1rem;
}

.resource-card h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.resource-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    margin-top: 1rem;
    display: inline-block;
    padding: 8px 16px;
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
}

/* Footer */
footer {
    background-color: #4a4a4a;
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.disclaimer {
    font-size: 1rem;
    margin-top: 1rem;
    opacity: 0.8;
}

/* Tablet Responsive Design */
@media (min-width: 768px) and (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-content h2 {
        font-size: 2.25rem;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .resource-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Touch-friendly date picker */
.touch-date-picker {
    position: relative;
    width: 100%;
}

.touch-date-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
    top: 0;
    left: 0;
}

.date-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    min-height: var(--touch-target-min);
    transition: all 0.3s ease;
}

.date-display:hover {
    border-color: var(--brand-primary);
    background: #E8EFE9;
}

.date-display i {
    color: var(--brand-primary);
    font-size: 20px;
}

.touch-date-input:focus + .date-display {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(36, 76, 73, 0.1);
}

/* Mobile/Small Tablet Responsive Design */
@media (max-width: 768px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .form-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-navigation button {
        width: 100%;
    }
}

/* Enhanced Modal for Tablets */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--surface);
    margin: 2% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 800px; /* Larger for tablets */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s;
}

/* Tablet-specific modal width */
@media (min-width: 768px) and (max-width: 1024px) {
    .modal-content {
        width: 80%;
        margin: 5% auto;
    }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background-color: var(--brand-secondary);
    color: white;
    padding: 2.5rem;
    border-radius: 10px 10px 0 0;
}

.modal-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 400;
    font-size: 1.75rem;
}

.modal-body {
    padding: 2.5rem;
    max-height: 70vh; /* More height for tablets */
    overflow-y: auto;
    font-size: 1.05rem;
}

.modal-body h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.modal-body h4 {
    color: var(--primary-dark);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.modal-body ul {
    margin-left: 2rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.consent-checkbox {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: var(--background);
    border-radius: 8px;
}

.consent-checkbox input[type="checkbox"] {
    margin-right: 12px;
    transform: scale(1.5); /* Larger checkbox */
    cursor: pointer;
}

.consent-checkbox label {
    display: inline-block;
    cursor: pointer;
    line-height: 1.6;
    font-size: 1.1rem;
}

.modal-footer {
    background-color: var(--border-color);
    padding: 2rem 2.5rem;
    border-radius: 0 0 10px 10px;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Assessment Info */
.assessment-info {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--border-color);
    border-radius: 8px;
    text-align: center;
}

.assessment-info p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* No Risk Message */
.no-risk-message {
    margin: 2rem 0;
}

.alert-box {
    background-color: var(--background);
    border: 2px solid var(--brand-primary);
    border-radius: 10px;
    padding: 2.5rem;
    text-align: center;
}

.alert-box i {
    font-size: 3.5rem;
    color: var(--brand-primary);
    margin-bottom: 1rem;
}

.alert-box h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.alert-box p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Action buttons group */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.action-buttons button {
    flex: 1;
    min-width: 180px;
}

/* Radio and Checkbox styling for tablets */
input[type="radio"],
input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    margin-right: 12px;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-group label,
.checkbox-group label {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.radio-group label:hover,
.checkbox-group label:hover {
    background-color: var(--background);
}

/* Select dropdown enhancement for tablets */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Number input spinner buttons larger for touch */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    height: 40px;
    width: 40px;
}

/* Toast notifications enhanced for tablets */
.toast {
    font-size: 1.1rem;
    padding: var(--touch-padding) 24px;
}

/* Checkbox group styling for family history */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background: #e9ecef;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.checkbox-label span {
    cursor: pointer;
    user-select: none;
}

/* Family member selection with red cross indicator */
.family-member-label {
    position: relative;
}

.family-selected-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #d32f2f;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.family-member-label input[type="checkbox"]:checked ~ .family-selected-icon {
    opacity: 1;
}

.family-member-label input[type="checkbox"]:checked {
    accent-color: #d32f2f;
}

/* Family details container */
.family-details-container {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.family-details-container h4 {
    color: var(--brand-secondary);
    margin-bottom: 20px;
    font-size: 18px;
}

.family-member-details {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.family-member-details h5 {
    color: #333;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.family-member-details .form-group {
    margin-bottom: 10px;
}

.family-member-details label {
    font-size: 14px;
    margin-bottom: 5px;
}

.family-member-details select,
.family-member-details input[type="number"] {
    width: 100%;
    padding: 8px;
    font-size: 14px;
}

/* Print Styles */
@media print {
    header, footer, .form-navigation, .action-buttons, .modal {
        display: none;
    }
    
    .results-section {
        page-break-inside: avoid;
    }
    
    body {
        background: white;
    }
    
    .assessment-info {
        margin-top: 1rem;
        border: 1px solid #ddd;
    }
}

/* Bootstrap Datepicker Customization */
.date-picker-wrapper {
    position: relative;
    max-width: 100%;
}

.date-picker-wrapper .input-group-text {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    color: white;
    cursor: pointer;
}

.date-picker-wrapper .form-control {
    border-color: var(--border-color);
    padding: 0.75rem;
    font-size: 1rem;
    cursor: pointer;
}

.date-picker-wrapper .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 0.2rem rgba(36, 76, 73, 0.25);
}

/* Datepicker dropdown styling */
.datepicker {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    border-radius: 8px;
    font-family: 'Manrope', Arial, sans-serif;
}

.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td.active.disabled,
.datepicker table tr td.active.disabled:hover {
    background-color: var(--brand-primary);
    background-image: none;
    border-color: var(--brand-primary);
}

.datepicker table tr td.today {
    background-color: var(--brand-secondary);
    color: white;
}

.datepicker table tr td.day:hover,
.datepicker table tr td.focused {
    background-color: var(--brand-secondary);
    color: white;
    cursor: pointer;
}

.datepicker .datepicker-switch {
    background-color: var(--brand-primary);
    color: white;
    font-weight: 500;
}

.datepicker .prev,
.datepicker .next {
    color: var(--brand-primary);
}

.datepicker .prev:hover,
.datepicker .next:hover {
    background-color: rgba(36, 76, 73, 0.1);
}

/* Year and decade view styling */
.datepicker table tr td span.active,
.datepicker table tr td span.active:hover,
.datepicker table tr td span.active.disabled,
.datepicker table tr td span.active.disabled:hover {
    background-color: var(--brand-primary);
    background-image: none;
    border-color: var(--brand-primary);
}

.datepicker table tr td span:hover {
    background-color: var(--brand-secondary);
    color: white;
}

/* Mobile responsiveness for datepicker */
@media (max-width: 768px) {
    .datepicker {
        width: 280px !important;
        font-size: 16px;
    }
    
    .datepicker table tr td,
    .datepicker table tr th {
        width: 40px;
        height: 40px;
        line-height: 40px;
    }
}

/* Patient Selection Modal Styles */
.patient-selection-modal {
    max-width: 900px;
    width: 90%;
}

.patient-search-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.search-container {
    position: relative;
    flex: 1;
}

.search-container input {
    padding-left: 3rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-secondary);
    pointer-events: none;
}

.patient-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.patient-table thead {
    background-color: var(--brand-secondary);
    color: white;
}

.patient-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.patient-table td {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.patient-table tbody tr:hover {
    background-color: #f5f5f5;
}

.patient-table tbody tr:last-child td {
    border-bottom: none;
}

.loading-message {
    text-align: center;
    color: var(--brand-secondary);
    font-size: 1.1rem;
    padding: 2rem;
}

.loading-message i {
    margin-right: 0.5rem;
}

.error-message {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.error-message i {
    margin-right: 0.5rem;
}

.no-patients-message {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

.no-patients-message i {
    margin-right: 0.5rem;
    color: var(--brand-secondary);
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

/* Responsive design for patient selection */
@media (max-width: 768px) {
    .patient-selection-modal {
        width: 95%;
        max-width: none;
    }
    
    /* Questionnaire Summary Mobile Styles */
    .questionnaire-summary {
        padding: 1.5rem;
        margin: 1rem 0;
    }
    
    .summary-section {
        padding: 1rem;
    }
    
    .summary-item {
        flex-direction: column;
        padding: 0.75rem 0;
    }
    
    .summary-label {
        flex: none;
        padding-right: 0;
        margin-bottom: 0.25rem;
    }
    
    .summary-value {
        font-size: 0.95rem;
    }
    
    .family-member-details {
        margin-left: 1rem;
        padding: 0.5rem;
    }
    
    .patient-search-section {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-container {
        width: 100%;
    }
    
    .patient-table {
        font-size: 0.85rem;
    }
    
    .patient-table th,
    .patient-table td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Hide some columns on mobile */
    .patient-table th:nth-child(4),
    .patient-table td:nth-child(4),
    .patient-table th:nth-child(5),
    .patient-table td:nth-child(5) {
        display: none;
    }
}

/* Launch resources and support: native disclosures keep the assessment in place. */
body {
    touch-action: auto;
}

header .container {
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.logo, header nav, header nav li, .hero-content {
    min-width: 0;
}

header nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0;
    margin: 0;
}

header .user-info {
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

.resource-grid, .results-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.resource-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.resource-card .resource-link {
    margin-top: auto;
}

.resource-card h3, .resources-section h2, .resource-link,
.resource-detail h3, .contact-section h2, .contact-section h3 {
    color: #9f4048;
}

.resource-link:hover, .resource-detail a:hover, .contact-section a:hover {
    color: #263A38;
    text-decoration-thickness: 2px;
}

.resource-details-section {
    padding: 0 0 4rem;
}

.resource-details-section h2, .contact-section h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1rem;
}

.resource-intro, .contact-intro {
    max-width: 78ch;
}

.resource-reviewed {
    color: #595959;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.resource-detail {
    background: var(--surface);
    border: 1px solid #D9DDD6;
    border-radius: 10px;
    margin-top: 1rem;
    scroll-margin-top: 10rem;
}

.resource-detail summary {
    padding: 1.25rem;
    font-weight: 600;
    color: #244C49;
    cursor: pointer;
    min-height: 48px;
    border-radius: 10px;
}

.resource-detail[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.resource-detail-body {
    padding: 1.5rem;
    max-width: 90ch;
    overflow-wrap: anywhere;
}

.resource-detail h3, .contact-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.resource-detail ul {
    padding-left: 1.5rem;
}

.resource-detail li {
    margin-bottom: 0.75rem;
}

.resource-callout {
    border-left: 4px solid #b85b63;
    background: #F2F5F0;
    padding: 1rem;
    margin: 1.5rem 0;
}

.resource-callout p, .resource-source {
    margin-bottom: 0;
}

.resource-detail a, .contact-section a {
    color: #244C49;
    text-decoration: underline;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid #365d62;
    outline-offset: 3px;
}

#resources, #contact {
    scroll-margin-top: 10rem;
}

.contact-section {
    background: #E8EFE9;
    padding: 4rem 0;
}

.contact-eyebrow {
    color: #94525F;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.contact-card {
    background: var(--surface);
    border-radius: 10px;
    padding: 2rem;
    min-width: 0;
}

.contact-details dt {
    margin-top: 1rem;
}

.contact-details dd {
    margin: 0;
}

.contact-details a, .contact-website {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    max-width: 100%;
}

.contact-details address {
    margin: 0.5rem 0 0;
    font-style: normal;
}

.office-hours > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
}

.office-hours dt {
    font-weight: 500;
}

.office-hours dd {
    margin: 0;
}

#patientTableContainer {
    overflow-x: auto;
    max-width: 100%;
}

.patient-selection-modal .patient-table {
    min-width: 580px;
}

.form-group, .question-container, .family-member-details {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 767px) {
    header {
        position: relative;
    }

    header .container {
        padding: 0.75rem 20px;
    }

    .logo {
        gap: 0.75rem;
        width: 100%;
    }

    .logo h1 {
        margin: 0;
        font-size: 0.75rem;
    }

    header nav {
        width: 100%;
    }

    header nav ul {
        justify-content: flex-start;
        gap: 0.25rem;
    }

    header nav a {
        padding: 10px;
        font-size: 0.875rem;
    }

    .hero .container, .contact-grid, .resource-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .resource-card, .contact-card {
        padding: 1.5rem;
    }

    .resource-detail-body {
        padding: 1.25rem;
    }

    #resources, #contact, .resource-detail {
        scroll-margin-top: 1rem;
    }

    .form-navigation {
        flex-wrap: wrap;
    }

    .form-navigation button {
        max-width: 100%;
        white-space: normal;
    }

    .patient-selection-modal .modal-header,
    .patient-selection-modal .modal-body,
    .patient-selection-modal .modal-footer {
        padding: 1rem;
    }

    .patient-selection-modal .modal-header h2 {
        font-size: 1.25rem;
    }

    .patient-search-section .btn-secondary {
        width: 100%;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .resource-card {
        transition: none;
    }

    .resource-card:hover {
        transform: none;
    }
}
