/* Test Instructions - Always visible in active step */
.test-instructions {
    display: block;
    margin: 1em 0;
    padding: 1em;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
}

/* Tab content styling */
.tab-content {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0 0 4px 4px;
    margin-top: -1px;
    padding: 20px;
    opacity: 1;
    position: relative;
    transition: opacity 0.2s ease-in-out;
    min-height: 200px;
    width: 100%;
    box-sizing: border-box;
}

/* Hide test sections by default */
.test-results-section,
.incubation-section {
    display: none;
    margin: 1em 0;
    padding: 1em;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Smooth tab content transitions */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Show sections when active */
.ilabwater-step.active .test-results-section,
.ilabwater-step.active .incubation-section {
    display: block;
}

/* Ready button styling */
.ready-for-results {
    display: inline-block;
    margin-top: 1em;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.tab-button {
    padding: 10px 15px;
    margin-right: 5px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-bottom: none;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: all 0.2s ease-in-out;
    color: #495057;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-button:hover {
    background: #e9ecef;
    color: #0056b3;
}

.tab-button.active {
    background: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
    color: #0056b3;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

/* Mobile styles */
@media (max-width: 767px) {
    .tab-navigation {
        flex-wrap: wrap;
        padding: 0.25rem 0.25rem 0 0.25rem;
    }
    
    .tab-button {
        padding: 8px 12px;
        font-size: 0.9em;
        margin-right: 2px;
        margin-bottom: 2px;
        flex: 1 0 auto;
        text-align: center;
    }
    
    .tab-content {
        padding: 15px;
    }
}

.ready-for-results:hover {
    background-color: #45a049;
}

/* Form elements */
.ilabwater-form-row {
    margin: 1em 0;
}

.ilabwater-form-row label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: bold;
}

/* Date picker */
.hasDatepicker {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 200px;
}

.instruction-header {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    align-items: flex-start;
}

.instruction-intro {
    flex: 1;
    font-size: 1.1em;
    line-height: 1.6;
    color: #333;
}

.instruction-image img {
    max-width: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.instruction-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.instruction-step {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #4a90e2;
}

.instruction-step:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #4a90e2;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 10px;
}

.step-content h4 {
    margin: 10px 0 5px;
    color: #2c3e50;
}

/* Results Section - Only show when on the petrifilm step */
#step-petrifilm .results-guide,
#step-aquascreen .results-guide {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
    display: none; /* Hide by default */
}

/* Show results section when on the correct step and status is 'completed' */
#step-petrifilm.active #petrifilm-results-section,
/* Ensure AquaScreen matches other tabs */
#step-aquascreen {
    display: none; /* Will be shown via JS */
    /* Other styles are inherited from .tab-content */
}

#step-aquascreen.active #aquascreen-results-section {
    display: block;
}

.section-title {
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    font-size: 1.5em;
}

.result-visual-guide {
    display: grid;
    gap: 30px;
}

.result-type h4 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.result-examples {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.result-example {
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.result-example img {
    width: 100%;
    max-width: 300px;
    border-radius: 6px;
    border: 2px solid #e9ecef;
    transition: transform 0.2s;
}

.result-example img:hover {
    transform: scale(1.05);
}

.result-label {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    margin: 10px 0 5px;
    font-size: 0.9em;
}

.result-label.safe {
    background: #e8f5e9;
    color: #2e7d32;
}

.result-label.not-safe {
    background: #ffebee;
    color: #c62828;
}

/* Interactive Results */
.interactive-results {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.result-question {
    font-size: 1.2em;
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #e0e0e0;
    color: #666;
    border-radius: 50%;
    font-size: 0.8em;
    cursor: help;
    position: relative;
}

.tooltip:hover::after {
    content: attr(title);
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

.result-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.result-option {
    flex: 1;
    min-width: 200px;
}

.result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 180px;
    height: 180px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    position: relative;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
}

.result-card:hover {
    border-color: #4a90e2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
}

.result-card.safe:hover {
    border-color: #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
}

.result-card.not-safe:hover {
border-color: #f44336;
box-shadow: 0 4px 12px rgba(244, 67, 54, 0.15);
}

.result-visual {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-navigation {
display: flex;
margin-bottom: -1px;
position: relative;
z-index: 2;
background: #f8f9fa;
padding: 0.5rem 0.5rem 0 0.5rem;
border-radius: 4px 4px 0 0;
margin-top: 20px;
}

.tab-content {
position: relative;
z-index: 1;
min-height: 200px;
background: #fff;
border: 1px solid #ddd;
border-top: none;
border-radius: 0 0 4px 4px;
padding: 20px;
margin-bottom: 20px;
}

.result-visual::before, .result-visual::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.result-card.not-safe.ecoli .result-visual::before {
    width: 15px;
    height: 15px;
    background-color: #0000ff; /* Blue for E. coli */
    top: 20%;
    left: 15%;
    box-shadow: 50px 10px 0 #0000ff, 20px 60px 0 #0000ff;
}

.result-card.not-safe.coliform .result-visual::before {
    width: 12px;
    height: 12px;
    background-color: #ff0000; /* Red for Coliform */
    top: 15%;
    left: 20%;
    box-shadow: 40px 15px 0 #ff0000, 5px 55px 0 #ff0000, 60px 65px 0 #ff0000;
}

.result-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 18px;
    z-index: 2;
}

.result-card.safe .result-icon {
    background: #4caf50;
}

.result-card.not-safe .result-icon {
    background: #f44336;
}

.result-details {
    z-index: 1;
    position: relative;
}

.result-details h5 {
    margin: 0 0 5px;
    font-size: 1.1em;
    color: #2c3e50;
}

.result-details p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

/* Spot Counter */
.spot-counter {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.spot-input {
    width: 70px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 1em;
}

.spot-buttons {
    display: flex;
    gap: 5px;
}

.spot-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #007bff;
    background: #007bff;
    color: white;
    border-radius: 50%;
    font-size: 1.8em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.spot-btn:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.spot-btn:active {
    background: #e0e0e0;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .instruction-header {
        flex-direction: column;
    }
    
    .instruction-image {
        margin-top: 20px;
    }
    
    .result-examples {
        flex-direction: column;
    }
    
    .result-options {
        justify-content: center;
    }
    .result-card {
        width: 150px;
        height: 150px;
    }
}

/* Visually Hidden */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Active State for Radio Buttons */
input[type="radio"]:checked + .result-card {
    border-color: #4a90e2;
    background-color: #f0f7ff;
}

input[type="radio"]:checked + .result-card.safe {
    border-color: #4caf50;
    background-color: #f0f9f0;
}

input[type="radio"]:checked + .result-card.not-safe {
    border-color: #f44336;
    background-color: #fff0f0;
}

/* Notification Message Styles */
.ilabwater-message-container {
    position: relative;
    z-index: 10;
}

.ilabwater-message {
    padding: 10px 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 0.9em;
    border: none;
    box-shadow: none;
}

.ilabwater-message .icon {
    font-size: 1.1em;
    margin-right: 8px;
    font-weight: bold;
}

.ilabwater-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.ilabwater-message.error {
    background-color: #ffebee;
    color: #c62828;
}

/* Test Kit Info Layout */
.test-kit-details-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.detail-item {
    flex: 1 1 150px;
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.detail-item.detail-item-serial {
    flex-grow: 2;
}

.detail-label {
    display: block;
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 1.1em;
    font-weight: 600;
    color: #343a40;
}

.detail-item-highlight .detail-value {
    color: #007bff;
    font-size: 1.3em;
}

/* Support Info Layout */
.support-info-container {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

#client-support-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.client-logo {
    max-width: 100px;
    max-height: 50px;
    object-fit: contain;
}

.support-details p {
    margin: 0 0 5px;
}

/* Safety Alert Banner Colors */
.safety-alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    transition: all 0.3s ease-in-out;
}

.safety-alert .safety-alert-icon {
    font-size: 1.2em;
    margin-right: 10px;
    font-weight: bold;
}

.safety-alert.safe {
    background-color: #e8f5e9; /* Light Green */
    border-color: #c8e6c9;
    color: #2e7d32; /* Dark Green */
}

.safety-alert.warning {
    background-color: #fff3e0; /* Light Yellow/Orange */
    border-color: #ffe0b2;
    color: #e65100; /* Dark Orange */
}

.safety-alert.unsafe {
    background-color: #ffebee; /* Light Red */
    border-color: #ffcdd2;
    color: #c62828; /* Dark Red */
}

/* Summary Alert Specificity Fix */
#summary-alert.safe {
    background-color: #e8f5e9 !important;
    border-color: #c8e6c9 !important;
    color: #2e7d32 !important;
}

#summary-alert.warning {
    background-color: #fff3e0 !important;
    border-color: #ffe0b2 !important;
    color: #e65100 !important;
}

#summary-alert.unsafe {
    background-color: #ffebee !important;
    border-color: #ffcdd2 !important;
    color: #c62828 !important;
}

/* Photo Preview Styles */
.photo-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    min-height: 140px;
}

.photo-preview {
    position: relative;
    width: 120px;
    height: 120px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fff;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview .remove-preview,
.photo-upload .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    z-index: 1;
}

.photo-preview .photo-label {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 2px 0;
}

.photo-upload .preview-container {
    margin-top: 10px;
    width: 150px;
    height: 150px;
    position: relative;
}

.photo-upload .preview-container.hidden {
    display: none;
}

.photo-upload .preview-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.upload-btn.hidden {
    display: none;
}

.ilabwater-button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Modern Instruction Timeline */
.test-instructions-container {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.instruction-intro {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 25px auto;
    font-size: 1em;
    color: #6c757d;
}

.timeline-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}

.timeline-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 5%;
    right: 5%;
    height: 2px;
    background-color: #dee2e6;
    z-index: 1;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 23%;
    position: relative;
    z-index: 2;
}

.timeline-step .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fff;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.timeline-step.active .step-number {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

.timeline-step h4 {
    font-size: 1.1em;
    font-weight: 600;
    color: #343a40;
    margin: 0 0 5px 0;
}

.timeline-step p {
    font-size: 0.9em;
    color: #6c757d;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .timeline-steps {
        flex-direction: column;
        align-items: flex-start;
    }
    .timeline-steps::before {
        left: 20px;
        top: 5%;
        bottom: 5%;
        width: 2px;
        height: auto;
    }
    .timeline-step {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        width: 100%;
        margin-bottom: 20px;
    }
    .timeline-step .step-number {
        margin-right: 15px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
}

/* Test Summary Styles */
#test-summary-list {
    list-style-type: none;
    padding: 0;
    margin-top: 20px;
}

#test-summary-list li {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    transition: background-color 0.3s;
}

#test-summary-list .status-icon {
    margin-right: 15px;
    font-size: 24px;
    width: 30px;
    text-align: center;
}

#test-summary-list .section-name {
    font-weight: bold;
    flex-grow: 1;
}

#test-summary-list .status-text {
    font-style: italic;
    color: #555;
}

/* Status-specific styles */
#test-summary-list li.status-complete {
    background-color: #d4edda; /* Light green */
    border-color: #c3e6cb;
}
#test-summary-list li.status-complete .status-icon {
    color: #155724; /* Dark green */
}
#test-summary-list li.status-complete .status-icon::before {
    content: '✓';
}

#test-summary-list li.status-incomplete {
    background-color: #f8d7da; /* Light red */
    border-color: #f5c6cb;
}
#test-summary-list li.status-incomplete .status-icon {
    color: #721c24; /* Dark red */
}
#test-summary-list li.status-incomplete .status-icon::before {
    content: '✗';
}

#test-summary-list li.status-pending {
    background-color: #fff3cd; /* Light yellow */
    border-color: #ffeeba;
}
#test-summary-list li.status-pending .status-icon {
    color: #856404; /* Dark yellow */
}
#test-summary-list li.status-pending .status-icon::before {
    content: '…';
}

/* Read-only state for completed tests */
.form-is-readonly input:not([type="button"]):not([type="submit"]),
.form-is-readonly select,
.form-is-readonly textarea {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    border-color: #dee2e6 !important;
}

.form-is-readonly .ilabwater-radio-group label,
.form-is-readonly .result-card,
.form-is-readonly .color-option,
.form-is-readonly .spot-btn,
.form-is-readonly .upload-btn,
.form-is-readonly .remove-btn,
.form-is-readonly .remove-preview {
    cursor: not-allowed !important;
    pointer-events: none;
    opacity: 0.7;
}

.form-is-readonly .result-card:hover,
.form-is-readonly .color-option:hover {
    border-color: #e0e0e0 !important; /* Prevent hover effects */
    box-shadow: none !important;
}

.form-is-readonly .photo-upload .upload-btn {
    background-color: #6c757d;
}

/* Test History & Incomplete Test Sections */
.test-history-section {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.test-history-title {
    font-size: 1.3em;
    color: #343a40;
    margin-top: 0;
    margin-bottom: 5px;
}

.test-history-section > p {
    font-size: 0.95em;
    color: #6c757d;
    margin-top: 0;
    margin-bottom: 20px;
}

.test-history-list {
    display: grid;
    gap: 15px;
}

.test-history-card {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: box-shadow 0.2s ease-in-out;
}

.test-history-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.test-history-card input[type="radio"] {
    display: none;
}

.test-history-card label {
    display: flex;
    flex-direction: column;
    padding: 15px;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.test-history-card input[type="radio"]:checked + label {
    background-color: #e7f1ff;
    border-color: #007bff;
}

.test-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.test-history-header strong {
    font-size: 1.1em;
    color: #0056b3;
}

.test-history-header span {
    font-size: 0.85em;
    color: #6c757d;
}

.test-history-body {
    margin-top: 8px;
    font-size: 0.9em;
    color: #495057;
}

.test-history-card.completed .test-history-header strong {
    color: #155724; /* Dark Green */
}

.test-history-card.completed input[type="radio"]:checked + label {
    background-color: #e8f5e9;
    border-color: #4caf50;
}

.incubation-section .timer-display p {
    margin: 5px 0;
}

#petrifilm-countdown-container,
#aquascreen-countdown-container {
    font-weight: bold;
    color: #1B81B8;
}

#test-summary-list .countdown-text {
    font-size: 0.9em;
    color: #555;
    margin-left: 10px;
}

/* Test Status Badge in History List */
.test-status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
    margin-left: auto;
    align-self: center;
}

.test-status-badge.status-safe {
    background-color: #2e7d32; /* Dark Green */
}

.test-status-badge.status-warning {
    background-color: #e65100; /* Dark Orange */
}

.test-status-badge.status-unsafe {
    background-color: #c62828; /* Dark Red */
}

.test-status-badge.status-unknown {
    background-color: #6c757d; /* Grey */
}

.test-history-header label {
    flex-grow: 1;
}
