/**
 * Ocean Blue Design System for CARE Notes
 * Complete replacement CSS - hardcoded Ocean Blue theme
 * Optimized for offline medical documentation
 */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #1e293b;
    background-color: #f8fafc;
}

/* Typography */
h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: #0369a1;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: #0284c7;
    margin-bottom: 0.875rem;
}

h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0ea5e9;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    color: #334155;
}

/* Layout */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* Navigation and Links */
.back-link {
    display: inline-block;
    color: #0284c7;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: #0369a1;
    border-bottom-color: #0369a1;
}

.skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
}

/* Buttons */
button, .btn {
    background-color: #0ea5e9;
    color: white;
    border: 2px solid #0ea5e9;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

button:hover, .btn:hover {
    background-color: #0284c7;
    border-color: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

button:disabled, .btn:disabled {
    background-color: #94a3b8;
    border-color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form Elements */
input, textarea, select {
    width: 100%;
    padding: 1rem;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1.125rem;
    line-height: 1.5;
    background-color: white;
    color: #1e293b;
    transition: border-color 0.2s ease;
    min-height: 48px; /* Minimum touch target size */
    -webkit-appearance: none; /* Remove iOS styling */
    appearance: none;
}

/* Specific textarea sizing */
textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

/* Better mobile input sizing */
input[type="text"], 
input[type="email"], 
input[type="tel"], 
input[type="url"],
input[type="datetime-local"],
input[type="date"],
input[type="time"] {
    min-height: 56px; /* Larger for mobile touch */
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.help-text, .field-description {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Sections */
.info-section, .care-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.critical-warning {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.critical-warning h2 {
    color: #dc2626;
}

/* Menu Specific Styles */
.header-section {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    margin: -1rem -2rem 2rem -2rem;
    padding: 3rem 2rem 2rem 2rem;
}

.subtitle {
    font-size: 1.125rem;
    color: #475569;
    font-weight: 500;
}

.divider {
    height: 3px;
    background: linear-gradient(to right, #0ea5e9, #0284c7, #0369a1);
    border: none;
    border-radius: 2px;
    margin: 2rem 0;
}

.description {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #0ea5e9;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    color: #334155;
    font-weight: 500;
}

.workflow-section {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left: 4px solid #10b981;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.workflow-section h3 {
    color: #047857;
}

/* Workflow Buttons */
.workflow-btn {
    background: white;
    border: 2px solid #e2e8f0;
    color: #374151;
    padding: 1rem;
    margin: 0.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 140px;
}

.workflow-btn:hover {
    border-color: #0ea5e9;
    background-color: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.workflow-btn.active {
    border-color: #0ea5e9;
    background-color: #e0f2fe;
    color: #0369a1;
}

/* Care Forms Grid */
.care-forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.care-form-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.care-form-card:hover {
    border-color: #0ea5e9;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.15);
}

.care-form-card h3 {
    color: #0284c7;
    margin-bottom: 0.75rem;
}

.care-form-card p {
    color: #64748b;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Progress Indicator */
.progress-steps-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.progress-step {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #64748b;
    border: 2px solid #e2e8f0;
}

.progress-step.active {
    background: #0ea5e9;
    border-color: #0284c7;
    color: white;
}

/* Forms */
.episode-field, .question {
    margin-bottom: 2rem;
}

.question-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    display: block;
    font-size: 1.1rem;
}

.question-input {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    padding: 1rem;
    font-size: 1.125rem;
    line-height: 1.6;
}

.required-indicator {
    color: #dc2626;
    font-weight: bold;
}

/* Footer */
footer {
    background: #f1f5f9;
    padding: 2rem;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.875rem;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 0.5rem;
        padding: 1rem;
        border-radius: 8px;
    }
    
    .header-section {
        margin: -1rem -1rem 1.5rem -1rem;
        padding: 2rem 1rem 1rem 1rem;
    }
    
    h1 {
        font-size: 1.875rem;
    }
    
    .care-forms-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .workflow-btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
    }
    
    /* Enhanced mobile form fields */
    input, textarea, select {
        font-size: 1.25rem; /* Prevent zoom on iOS */
        padding: 1.25rem;
        min-height: 60px;
    }
    
    textarea, .question-input {
        min-height: 140px;
        padding: 1.25rem;
        font-size: 1.25rem;
        line-height: 1.6;
    }
    
    .question-label {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .episode-field, .question {
        margin-bottom: 2.5rem;
    }
    
    .help-text, .field-description {
        font-size: 1rem;
        margin-top: 0.75rem;
    }
    
    /* Better button sizing on mobile */
    button, .btn {
        padding: 1rem 1.5rem;
        font-size: 1.125rem;
        min-height: 56px;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .container {
        margin: 0;
        padding: 0.75rem;
        border-radius: 0;
        min-height: 100vh;
    }
    
    input, textarea, select {
        font-size: 1.3rem;
        padding: 1.5rem 1rem;
        min-height: 64px;
    }
    
    textarea, .question-input {
        min-height: 160px;
        padding: 1.5rem 1rem;
        font-size: 1.3rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard users */
*:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Assessment Form Styles for Belief Effects */
.question {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.question-number {
    display: inline-block;
    width: 2.5rem;
    height: 2.5rem;
    background: #0ea5e9;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 2.5rem;
    font-weight: 600;
    font-size: 1rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.question-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: #1e293b;
    margin: 1rem 0;
    line-height: 1.6;
}

.assessment-scale {
    margin-top: 1.5rem;
}

.assessment-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin: 1rem 0;
}

.assessment-option {
    flex: 1;
    min-width: 120px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
}

.assessment-option:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
    transform: translateY(-1px);
}

.assessment-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.assessment-option label {
    display: block;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    width: 100%;
    margin: 0;
    transition: all 0.2s ease;
}

.assessment-option input[type="radio"]:checked {
    border-color: #0284c7;
}

.assessment-option input[type="radio"]:checked + label {
    background: #0ea5e9;
    color: white;
    font-weight: 600;
    border-radius: 6px;
}

/* Ensure the entire assessment-option container gets selected styling */
.assessment-option:has(input[type="radio"]:checked) {
    background: #0ea5e9;
    border-color: #0284c7;
    color: white;
}

.assessment-option:has(input[type="radio"]:checked) label {
    background: transparent;
    color: white;
    font-weight: 600;
}

.level-number {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.level-text {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
}

.current-selection {
    text-align: center;
    padding: 0.75rem;
    margin-top: 1rem;
    font-weight: 500;
    color: #0284c7;
    background: #f0f9ff;
    border-radius: 6px;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Neutral styling for all assessment levels - no bias colors */
.assessment-option:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
}

.assessment-option input[type="radio"]:checked + label {
    background: #0ea5e9;
    color: white;
}

/* Scale Description */
.scale-description {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
    color: #334155;
    font-weight: 500;
}

/* Score Section */
.score-section {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    margin: 2rem 0;
}

.score-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: #047857;
    margin-bottom: 1rem;
}

.score-category {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.save-button {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 1rem 0;
}

.save-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.exercise-link {
    margin: 1rem 0;
}

.exercise-link a {
    background: #10b981;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    transition: all 0.2s ease;
}

.exercise-link a:hover {
    background: #047857;
    transform: translateY(-1px);
}

/* Footer Styles */
.footer {
    background: #f8fafc;
    padding: 2rem;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.875rem;
    margin-top: 2rem;
}

.footer .brand {
    font-weight: 600;
    color: #0369a1;
    margin-bottom: 0.5rem;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Documentation Note */
.documentation-note {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Mobile Responsive Adjustments for Assessment Forms */
@media (max-width: 768px) {
    .assessment-options {
        flex-direction: column;
        gap: 0.625rem; /* Increased from 0.5rem for better touch spacing */
    }

    .assessment-option {
        min-width: auto;
        min-height: 52px; /* Ensure comfortable touch target */
    }

    .assessment-option label {
        padding: 0.875rem 1rem; /* Increased padding for better touch area */
    }

    .question {
        padding: 1rem;
    }

    .question-text {
        font-size: 1rem;
        margin: 0.75rem 0;
        line-height: 1.5;
    }

    .level-number {
        font-size: 1.25rem; /* Increased from 1.125rem for better visibility */
        font-weight: 700;
    }

    .level-text {
        font-size: 0.9375rem; /* 15px - increased from 0.8rem (12.8px) for readability */
        font-weight: 500;
    }

    .score-display {
        font-size: 1.25rem;
    }

    .save-button {
        width: 100%;
        padding: 1.25rem;
        font-size: 1.125rem;
    }

    /* Improve current selection visibility */
    .current-selection {
        font-size: 0.9375rem;
        padding: 1rem;
    }
}

/* Extra small screens (iPhone SE and smaller) */
@media (max-width: 400px) {
    .assessment-option label {
        padding: 1rem; /* More padding on tiny screens */
    }

    .level-number {
        font-size: 1.375rem; /* Slightly larger numbers */
    }

    .level-text {
        font-size: 1rem; /* Full 16px for very small screens */
    }

    .question-text {
        font-size: 1.0625rem; /* 17px for better readability */
        line-height: 1.6;
    }

    /* Stack form actions on tiny screens */
    .form-actions {
        flex-direction: column;
        padding: 1.5rem;
    }

    .form-actions button,
    .form-actions .action-button {
        width: 100%;
    }
}

/* Links */
a {
    color: #0284c7;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0369a1;
    text-decoration: underline;
}