/* Root variables for consistent color scheme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #30b08f; /* Medical green base */
    --primary-dark: #289b7a;
    --primary-gradient: linear-gradient(135deg, #30b08f 0%, #26a584 100%);
    --light-gray: #f8f9fa;
    --medium-gray: #e1e4e8;
    --dark-gray: #495057;
    --text-color: #24292e;
    --text-secondary: #586069;
    --white: #ffffff;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --success: #28a745;
    --border-radius: 8px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.6;
}

.container {
    display: flex;
    width: 100%;
}

.sidebar {
    width: 250px;
    background-color: var(--white);
    padding: 25px 20px;
    border-right: 1px solid var(--medium-gray);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--medium-gray);
    padding-bottom: 15px;
}

.sidebar-logo {
    width: 80px;
    height: auto;
    margin: 0 auto 15px;
    display: block;
}

.sidebar h2 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
}

.step-indicator {
    margin-bottom: 25px;
}

.step {
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    color: var(--dark-gray);
    background-color: #e9ecef;
    border-left: 5px solid var(--medium-gray);
    transition: all 0.3s ease;
    display: block;
    text-decoration: none;
}

.step:hover:not(.disabled) {
    background-color: #dee2e6;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.step.active {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: bold;
    border-left-color: var(--primary-dark);
}

.step.active:hover {
    background-color: var(--primary-dark);
}

.step.completed {
    background-color: #d4edda; /* Light green for completed */
    color: #155724;
    border-left-color: var(--success);
}

.step.completed:hover {
    background-color: #c3e6cb; /* Darker green for hover */
}

.step.completed::before {
    content: '✔ '; /* Checkmark for completed */
}

.step.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sidebar-actions {
    margin-top: 20px;
    padding: 10px 0;
    text-align: center;
}

.sidebar-actions .button {
    margin-top: 0;
    width: 90%;
    padding: 10px 15px;
    font-size: 0.95em;
}

/* New Report button in sidebar - same style as welcome page */
.new-report-sidebar-button {
    background: var(--primary-gradient) !important;
    color: white !important;
    font-weight: 600 !important;
    border-radius: 25px !important;
    box-shadow: 0 6px 20px rgba(48, 176, 143, 0.3) !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
    margin-bottom: 15px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.new-report-sidebar-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(48, 176, 143, 0.4) !important;
    color: white !important;
}

.new-report-sidebar-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.new-report-sidebar-button:hover::before {
    left: 100%;
}

.new-report-sidebar-button::after {
    content: '✚';
    position: absolute;
    top: 50%;
    left: -30px;
    transform: translateY(-50%);
    font-size: 1em;
    color: rgba(255, 255, 255, 0.8);
    transition: left 0.3s ease;
}

.new-report-sidebar-button:hover::after {
    left: calc(100% + 10px);
}

.main-content {
    flex-grow: 1;
    padding: 30px 40px;
    background-color: var(--white); /* White background for content */
    margin: 20px; /* Add some margin around the main content */
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow-y: auto; /* Allow scrolling if content is too long */
}

/* Welcome page specific styling */
.main-content.welcome-page {
    padding: 0;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
    overflow-y: auto;
}

h1 {
    color: var(--primary-dark);
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.8em;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}
h2 {
     color: var(--primary-dark);
     margin-top: 30px;
     margin-bottom: 15px;
}
h3 {
    color: var(--dark-gray);
    margin-top: 20px;
    margin-bottom: 10px;
}

label {
    font-weight: 600; /* Slightly bolder labels */
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    color: #495057;
}

input[type=text],
input[type=date],
input[type=email],
input[type=tel],
input[type=number],
select,
textarea {
    width: 100%; /* Full width within its container */
    max-width: 500px; /* Limit max width */
    padding: 10px 12px;
    margin-top: 5px;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    font-size: 1em;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

input[type=text]:focus,
input[type=date]:focus,
input[type=email]:focus,
input[type=tel]:focus,
input[type=number]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 188, 156, 0.25);
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

button, .button {
    background: var(--primary-gradient);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    text-decoration: none;
    display: inline-block;
    margin-top: 25px;
    transition: var(--transition);
    font-weight: 500;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

button::before, .button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.2);
    transition: left 0.5s ease;
}

button:hover::before, .button:hover::before {
    left: 100%;
}

button:hover, .button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.button-secondary {
    background: linear-gradient(135deg, #f5f6fa 0%, #e1e4e8 100%);
    color: var(--text-color);
    margin-right: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.button-secondary:hover {
    background: linear-gradient(135deg, #e1e4e8 0%, #ced3d8 100%);
    transform: translateY(-1px);
}

/* Organ Selection Styling */
.organ-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
     max-width: 500px;
}
.organ-list li {
    margin-bottom: 10px;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
}
.organ-list label {
    display: inline-block; /* Keep label next to checkbox */
    margin: 0 0 0 10px; /* Reset margins and add left space */
    font-weight: normal; /* Normal weight for checkbox labels */
    cursor: pointer;
}
.organ-list input[type="checkbox"] {
    transform: scale(1.2);
    margin-right: 10px;
    cursor: pointer;
}

/* Organ Details Section */
.organ-details-section {
    border: 1px solid var(--medium-gray);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    background-color: #fdfdff; /* Slightly off-white */
}
.organ-details-section h3 {
    margin-top: 0;
    color: var(--primary-dark);
    border-bottom: 1px solid var(--medium-gray);
    padding-bottom: 8px;
}

/* Flash Messages */
.flash-messages {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}
.flash-messages li {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
}
.flash-messages .error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.flash-messages .warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}
.flash-messages .success {
     color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.flash-messages .info {
     color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Form Row Styling */
.form-row {
    margin-bottom: 15px;
}

/* Report View Styling */
.report-preview {
    margin-top: 30px;
    border: 1px solid var(--medium-gray);
    padding: 20px;
    background-color: #fdfdff;
    border-radius: var(--border-radius);
}
.report-preview h3 {
     color: var(--primary-dark);
     margin-top: 25px;
     border-bottom: 1px solid var(--medium-gray);
     padding-bottom: 5px;
}
.report-preview h4 {
    color: var(--dark-gray);
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 600;
}
.report-preview ul {
    list-style: disc;
    margin-left: 20px;
    padding-left: 0;
    margin-bottom: 15px;
}
.report-preview li {
    margin-bottom: 5px;
}
.report-preview pre {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.95em;
    border-radius: var(--border-radius);
    max-height: 400px; /* Limit height and make scrollable */
    overflow-y: auto;
}

/* Button Alignment */
.form-actions {
    margin-top: 30px;
    border-top: 1px solid var(--medium-gray);
    padding-top: 20px;
}

/* Reset button */
.reset-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: var(--danger);
    color: white;
    padding: 8px 15px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-size: 0.9em;
}
.reset-button:hover {
    background-color: #c82333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--medium-gray);
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    .main-content {
        margin: 10px; /* Reduce margin on smaller screens */
        padding: 20px;
    }
}

/* Info Icons for Template Variables */
.info-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background-color: var(--info);
    color: white;
    font-size: 11px;
    font-weight: bold;
    margin-left: 5px;
    cursor: help;
    transition: var(--transition);
    vertical-align: middle;
}

.info-icon:hover {
    background-color: #138496;
    transform: scale(1.1);
}