/* Modern D610 Form with Label-in-Border Design */

/* DEPRECATED - Old form-group styling (kept for reference) */
/*
.form-group {
    position: relative;
    padding: 8px;
    border: 2px solid #ced4da;
    margin: 8px 0;
    border-radius: 4px;
    background-color: white;
    min-width: 80px;
    width: 100%;
    box-sizing: border-box;
}

.form-group > label {
    position: absolute;
    top: -1px;
    left: 15px;
    background-color: white;
    padding: 0 4px;
    font-weight: 500;
    color: #495057;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 20px);
}

.form-group > input,
.form-group > select,
.form-group > textarea {
    border: none;
    outline: none;
    width: 100%;
    padding: 6px 4px;
    font-size: 0.95rem;
    background: transparent;
}

.form-group:focus-within {
    border-color: #007bff;
}

.form-group:focus-within > label {
    color: #007bff;
}

.form-group.error {
    border-color: #dc3545;
}

.form-group.error > label {
    color: #dc3545;
}
*/

/* Clean dropdown layout - balanced responsive columns */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

/* Simple dropdown styling */
.form-row select,
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row input[type="time"],
.form-row .gps-input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    width: 100%;
    min-width: 120px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* GPS button styling for grid */
.form-row .gps-button {
    padding: 8px 12px;
    border: 1px solid #007bff;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    min-width: 120px;
    box-sizing: border-box;
}

.form-row .gps-button:hover {
    background-color: #0056b3;
}

.form-row select:focus,
.form-row input:focus,
.form-row .gps-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Disabled state */
.form-row select:disabled,
.form-row input:disabled,
.form-row input[readonly],
.form-row .gps-input[readonly] {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Placeholder styling for better UX */
.form-row input::placeholder {
    color: #6c757d;
    font-style: italic;
}

/* Responsive breakpoints for balanced columns */
@media (min-width: 1600px) {
    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 12px;
    }
}

@media (min-width: 1200px) and (max-width: 1599px) {
    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
        gap: 11px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
}

/* Mobile responsiveness - stack elements vertically */
@media (max-width: 767px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .form-row select,
    .form-row input {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}
    


/* Base layout styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    min-height: 100vh;
}

.form-container {
    max-width: 100%;
    width: 100%;
    margin: 0;
    background: white;
    min-height: 100vh;
    position: relative;
}

/* Form header styling */
.form-header {
    background: #2c3e50;
    color: white;
    padding: 20px;
    text-align: center;
    border-bottom: 3px solid #34495e;
}

.form-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

/* Step title styling */
.step-title {
    color: #2c3e50;
    font-size: 1.4rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
    font-weight: 600;
}

/* Section styling */
.section {
    border-bottom: 2px solid #ccc;
    padding: 8px;
    margin-bottom: 20px;
}

.section-title {
    background: #34495e;
    color: white;
    padding: 8px 12px;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1rem;
    border-radius: 4px;
}

/* Header and progress bar */
.form-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 300;
}

/* Progress container styling */
/* OLD PROGRESS BAR STYLES REMOVED - See section below for new vertical layout */

/* Form content */
.form-content {
    padding: 30px 20px;
    min-height: 500px;
}

.form-step {
    display: none;
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 10px;
}

.form-step.active {
    display: block !important;
}

/* Error messages */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 5px;
    padding-left: 5px;
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-weight: 500;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Login styles */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    text-align: center;
}

.login-container h2 {
    margin-bottom: 20px;
    font-size: 2rem;
}

#loginMethods {
    margin-top: 20px;
}

/* Modal Styles */
.modal, .history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content, .history-modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
}

.close, .close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover, .close-modal:hover,
.close:focus, .close-modal:focus {
    color: #000;
    text-decoration: none;
}

.history-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.history-close:hover {
    color: #000;
}

.history-item {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    margin-bottom: 10px;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item h4 {
    margin: 0 0 5px 0;
    color: #333;
}

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

.history-item .timestamp {
    font-size: 0.8em;
    color: #999;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #dc3545;
}

/* Additional mobile responsiveness for layout elements */
@media (max-width: 767px) {
    .form-header h1 {
        font-size: 1.4rem;
    }

    .progress-container {
        padding: 15px;
    }

    .form-content {
        padding: 20px 15px;
    }

    .step {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .step-label {
        font-size: 0.7rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn {
        width: 100%;
    }
}

/* ==============================================
   PROGRESS STEPS STYLING - Two Column Layout
   ============================================== */

/* Main form container - vertical stack */
.form-container {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    width: 100%;
    margin: 0;
    background: white;
    min-height: 100vh;
}

/* Page header (Title at top) */
.page-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px 30px;
    border-bottom: 3px solid #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.btn-history-header {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-history-header:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.btn-history-header:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}


/* Main content wrapper - two columns side by side */
.main-content-wrapper {
    display: flex;
    flex-direction: row;
    flex: 1;
    width: 100%;
    min-height: calc(100vh - 80px);
}

/* Vertical Progress Bar - left column */
.progress-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: auto;
    min-width: auto;
    padding: 20px 15px;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
    position: sticky;
    top: 60px; /* Account for header height (~55-60px) */
    align-self: flex-start;
    max-height: calc(100vh - 60px); /* Adjust for header */
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scrollbar */
}

/* Vertical connecting line between all steps */
.progress-bar::before {
    content: '';
    position: absolute;
    left: 37px;
    top: 60px;
    height: 320px; /* Fixed height to connect 5 steps (4 gaps × 80px per gap) */
    width: 2px;
    background: #dee2e6;
    z-index: 1;
}

.progress-step {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;
    z-index: 3;
    cursor: pointer;
    margin-bottom: 20px;
    width: auto;
    transition: transform 0.2s ease, background-color 0.2s ease;
    padding: 5px;
    border-radius: 6px;
    white-space: nowrap;
}

.progress-step:hover {
    background-color: rgba(0, 123, 255, 0.05);
    transform: translateX(5px);
}

.progress-step:last-child {
    margin-bottom: 0;
}

/* Progress indication through step connections */
.progress-step.completed:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 23px;
    top: 43px;
    width: 2px;
    height: 20px;
    background: #28a745;
    z-index: 2;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #dee2e6;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    margin-right: 12px;
    transition: all 0.3s ease;
    border: 2px solid #dee2e6;
    flex-shrink: 0;
}

.progress-step.active .step-circle {
    background: #007bff;
    color: white;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.progress-step.completed .step-circle {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.step-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-align: left;
    font-weight: 500;
    line-height: 1.2;
    transition: all 0.3s ease;
}

.step-label .highlight {
    font-weight: 700;
    color: #007bff;
    font-size: 0.95rem;
}

.progress-step.active .step-label {
    color: #007bff;
    font-weight: 600;
}

.progress-step.active .step-label .highlight {
    color: #0056b3;
}

.progress-step.completed .step-label {
    color: #28a745;
    font-weight: 600;
}

.progress-step.completed .step-label .highlight {
    color: #1e7e34;
}

/* Submit button in progress bar */
.btn-submit-progress {
    width: 100%;
    margin-top: 30px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(40, 167, 69, 0.3);
}

.btn-submit-progress:hover {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
}

.btn-submit-progress:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.btn-submit-progress:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form content wrapper - right column */
.form-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow-y: auto;
}

/* Form content - takes all space in right column */
.form-content {
    flex: 1;
    padding: 30px 40px;
    background: white;
}

/* Responsive: Keep vertical layout on mobile */
@media (max-width: 992px) {
    .page-header {
        padding: 15px 20px;
    }
    
    .page-header h1 {
        font-size: 1.2rem;
    }
    
    .btn-history-header {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
    
    .main-content-wrapper {
        flex-direction: row; /* Keep side-by-side layout */
    }
    
    .progress-bar {
        width: auto;
        min-width: 80px; /* Compact sidebar */
        max-width: 100px;
        padding: 15px 8px;
    }
    
    .progress-step {
        margin-bottom: 15px; /* Tighter spacing on mobile */
    }
    
    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .step-label {
        font-size: 0.7rem;
        max-width: 80px;
    }
    
    .progress-bar::before {
        left: 30px; /* Adjusted for smaller circles */
        width: 2px;
        top: 50px;
        height: 260px; /* Fixed height for mobile (5 steps with tighter spacing) */
    }
    
    .btn-submit-progress {
        margin-top: 20px;
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .form-content-wrapper {
        padding: 15px;
    }
    
    .step-title {
        font-size: 1.2rem;
    }
    
    .form-content {
        padding: 20px;
    }
}

/* ==============================================
   NAVIGATION BUTTONS STYLING
   ============================================== */

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-top: 30px;
    border-top: 1px solid #e9ecef;
}

.step-navigation {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 15px !important;
    padding: 20px 0 !important;
    margin: 20px 0 !important;
    flex-wrap: wrap !important;
    position: relative !important;
    z-index: 10 !important;
}

.step-navigation .nav-button {
    padding: 8px 24px !important;
    border: none !important;
    border-radius: 30px !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, box-shadow 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    position: relative !important;
    z-index: 11 !important;
    min-width: auto !important;
    width: auto !important;
    max-width: 180px !important;
    min-height: 36px !important;
    height: auto !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
    flex-shrink: 0 !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    transform: none !important;
}

.step-navigation .nav-button.btn-back {
    background: #6c757d !important;
    color: white !important;
}

.step-navigation .nav-button.btn-back:hover:not(:disabled) {
    background: #5a6268 !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}

.step-navigation .nav-button.btn-back:disabled {
    background: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.step-navigation .nav-button.btn-next {
    background: #007bff !important;
    color: white !important;
}

.step-navigation .nav-button.btn-next:hover {
    background: #0056b3 !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3) !important;
}

.step-navigation .nav-button.btn-submit {
    background: #28a745 !important;
    color: white !important;
}

.step-navigation .nav-button.btn-submit:hover {
    background: #1e7e34 !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(40,167,69,0.3) !important;
}

.step-navigation .nav-button.btn-submit {
    background: #28a745 !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 1.05rem !important;
    padding: 12px 30px !important;
}

.step-navigation .nav-button.btn-submit:hover {
    background: #218838 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(40,167,69,0.4) !important;
}

.step-navigation .nav-button.btn-submit:disabled {
    background: #6c757d !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Responsive navigation buttons */
@media (max-width: 768px) {
    .step-navigation {
        gap: 8px !important;
        padding: 15px 0 !important;
        flex-direction: row !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    
    .step-navigation .nav-button {
        padding: 6px 16px !important;
        font-size: 0.8rem !important;
        min-width: auto !important;
        max-width: 140px !important;
        flex: 0 1 auto !important;
        border-radius: 25px !important;
        min-height: 32px !important;
    }
}

@media (max-width: 480px) {
    .step-navigation {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: center !important;
    }
    
    .step-navigation .nav-button {
        width: auto !important;
        max-width: 200px !important;
        justify-content: center !important;
        padding: 8px 20px !important;
        font-size: 0.85rem !important;
        border-radius: 30px !important;
        min-height: 36px !important;
    }
}

/* ==============================================
   HISTORY MODAL STYLING
   ============================================== */

.history-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.history-modal-content {
    position: relative;
    background: white;
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 1000px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4rem;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.close-modal:hover {
    color: #dc3545;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.history-table th,
.history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.history-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.history-table tr:hover {
    background: #f8f9fa;
}

/* ==============================================
   GPS COORDINATES STYLING
   ============================================== */

.gps-container {
    display: flex;
    gap: 10px;
    align-items: stretch;
    width: 100%;
}

.gps-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95rem;
    background: #f8f9fa;
    min-width: 0; /* Allow inputs to shrink */
}

.gps-input:focus {
    outline: none;
    border-color: #007bff;
    background: white;
}

.gps-button {
    flex-shrink: 0;
    padding: 10px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.gps-button:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Ensure GPS form group can expand properly */
.form-group:has(.gps-container) {
    min-width: 300px;
}

/* Checksum field styling */
.checksum-valid {
    background-color: #d4edda !important;
    color: #155724 !important;
    border-color: #c3e6cb !important;
}

.checksum-invalid {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border-color: #f5c6cb !important;
}

/* D610 Scoring Container with Label-in-Border Design */
.scoring-container {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.scoring-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.scoring-input-group {
    position: relative;
    min-width: 70px;
    flex: 1;
    max-width: 90px;
}

.scoring-input-group label {
    position: absolute;
    top: -8px;
    left: 8px;
    background: white;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    border-radius: 3px;
    z-index: 1;
}

.scoring-input-group input {
    width: 100%;
    padding: 8px 6px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
    background: white;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.scoring-input-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Special styling for different input types */
.checksum-group {
    min-width: 90px;
    max-width: 110px;
}

.checksum-group label {
    background: #fff3cd;
    color: #856404;
    font-weight: bold;
    font-size: 0.7rem;
    padding: 1px 4px;
    white-space: nowrap;
    max-width: 85px;
}

.checksum-group input {
    border-color: #ffeaa7;
    background: #fff3cd;
    padding: 8px 4px;
}

.calculated-group {
    min-width: 90px;
    max-width: 110px;
}

.calculated-group label {
    background: #e2e3e5;
    color: #495057;
    font-weight: bold;
    font-size: 0.7rem;
    padding: 1px 4px;
    white-space: nowrap;
    max-width: 85px;
}

.calculated-group input {
    border-color: #ced4da;
    background: #e9ecef;
    font-weight: 600;
    padding: 8px 4px;
}

/* Responsive behavior - stack on very small screens */
@media (max-width: 768px) {
    .scoring-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .scoring-input-group {
        max-width: none;
        min-width: 120px;
    }
    
    .scoring-input-group input {
        padding: 12px 8px;
        font-size: 1rem;
    }
    
    .scoring-input-group label {
        font-size: 0.8rem;
        padding: 3px 8px;
    }
}

/* Medium screens - 2 columns */
@media (max-width: 1024px) and (min-width: 769px) {
    .scoring-row {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
    }
    
    .checksum-group,
    .calculated-group {
        grid-column: span 2;
    }
}

/* Large screens - single row */
@media (min-width: 1025px) {
    .scoring-row {
        display: flex;
        gap: 6px;
    }
    
    .scoring-input-group {
        flex: 1;
        min-width: 65px;
        max-width: 85px;
    }
}

/* Checksum validation styling - highest specificity */
.checksum-valid,
input.checksum-valid {
    background-color: #d4edda !important;
    color: #155724 !important;
    border-color: #c3e6cb !important;
}

.checksum-invalid,
input.checksum-invalid {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border-color: #f5c6cb !important;
}

/* D610 Grade Color Coding for Input Fields */
/* Excellent to Good (10, 9, 8, 7) - Light Orange */
#g10, #g9, #g8, #g7, #p10, #p9, #p8, #p7 {
    background-color: #FDE9D9 !important;
}

/* Fair (6, 5) - Medium Orange */
#g6, #g5, #p6, #p5 {
    background-color: #FCD5B4 !important;
}

/* Poor (4, 3) - Darker Orange */
#g4, #g3, #p4, #p3 {
    background-color: #FABF8F !important;
}

/* Very Poor to Failed (2, 1, 0) - Dark Orange with White Text */
#g2, #g1, #g0, #p2, #p1, #p0 {
    background-color: #E26B0A !important;
    color: white !important;
}

/* Color coding for ABCD totals */
#ga, #pa {
    background-color: #FDE9D9 !important;
    color: #495057 !important;
}

#gb, #pb {
    background-color: #FCD5B4 !important;
    color: #495057 !important;
}

#gc, #pc {
    background-color: #FABF8F !important;
    color: #495057 !important;
}

#gd, #pd {
    background-color: #E26B0A !important;
    color: white !important;
}

/* Calculation Section Styling */
.calculation-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.calculation-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.abcd-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.labeled-input {
    position: relative;
}

.labeled-input label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 4px;
}

.labeled-input input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

/* Responsive ABCD layout */
@media (max-width: 1200px) {
    .abcd-row {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .abcd-row {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .abcd-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* ==============================================
   PROBLEMS MODAL STYLING
   ============================================== */

/* Problems Modal Specific Styles */
#problemsModal .modal-content {
    background: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

#problemsModal .close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

#problemsModal .close:hover {
    color: black;
}

#problemsModal h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    font-size: 1.5rem;
    font-weight: 600;
}

#problemsModal h4 {
    margin: 20px 0 10px 0;
    color: #34495e;
    border-bottom: 1px solid #bdc3c7;
    padding-bottom: 5px;
    font-size: 1.1rem;
    font-weight: 500;
}

.checkbox-list {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.checkbox-list div {
    margin: 8px 0;
    display: flex;
    align-items: center;
}

.checkbox-list input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
    cursor: pointer;
}

.checkbox-list label {
    font-size: 14px;
    cursor: pointer;
    flex: 1;
    color: #495057;
    font-weight: 500;
}

.checkbox-list label:hover {
    color: #007bff;
}

/* Save Problems Button */
.save-problems-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    width: 100%;
}

.save-problems-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* Responsive Problems Modal */
@media (max-width: 768px) {
    #problemsModal .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }
    
    #problemsModal h3 {
        font-size: 1.3rem;
    }
    
    #problemsModal h4 {
        font-size: 1rem;
    }
    
    .checkbox-list {
        padding: 8px;
    }
    
    .checkbox-list label {
        font-size: 13px;
    }
    
    .save-problems-btn {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

/* ==============================================
   SELECT PROBLEMS BUTTON STYLING - MOVED TO STEP 4 SECTION
   ============================================== */

/* Button styling now defined in Step 4 Problem Assessment Layout section above */

/* ==============================================
   STEP 4 PROBLEM ASSESSMENT LAYOUT
   ============================================== */

/* Centered 2-column grid for all 6 objects */
.problem-assessment-centered {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px 30px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    align-items: start;
}

/* Ensure all inputs and textareas in same column have same width */
.problem-assessment-centered .labeled-input {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.problem-assessment-centered .labeled-input input,
.problem-assessment-centered .labeled-input textarea,
.problem-assessment-centered .labeled-input button {
    width: 100%;
    box-sizing: border-box;
}

/* Make the Colour Delta E input field taller to better align with textareas */
.problem-assessment-centered .labeled-input input[type="text"] {
    padding: 12px;
    min-height: 48px;
    font-size: 0.9rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

/* Standardize textarea heights for better column alignment */
.problem-assessment-centered .labeled-input textarea {
    min-height: 80px;
    resize: vertical;
    padding: 10px;
    font-size: 0.9rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: inherit;
}

/* Style the button container to match other inputs */
.problem-assessment-centered .labeled-input:last-child {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.problem-assessment-centered .labeled-input:last-child label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 4px;
}

/* Clickable readonly fields styling */
.problem-assessment-centered textarea[readonly] {
    cursor: pointer !important;
    background-color: #f8f9fa !important;
    border: 1px solid #ced4da;
    transition: all 0.2s ease;
    position: relative;
}

.problem-assessment-centered textarea[readonly]:hover {
    background-color: #e9ecef !important;
    border-color: #6f42c1;
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.1);
    transform: translateY(-1px);
}

.problem-assessment-centered textarea[readonly]:focus {
    outline: none;
    border-color: #6f42c1;
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.2);
}

.problem-assessment-centered textarea[readonly]:active {
    transform: translateY(0);
    background-color: #dee2e6 !important;
}

/* Special styling for clickable field labels */
.problem-assessment-centered .labeled-input:has(textarea[readonly]) label {
    color: #6f42c1;
    font-weight: 600;
}

.problem-assessment-centered .labeled-input:has(textarea[readonly]) label::after {
    content: " 🖱️";
    font-size: 0.8em;
    opacity: 0.7;
}

.btn-select-problems {
    background: #6f42c1;
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(111, 66, 193, 0.2);
    width: 100%;
    box-sizing: border-box;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-select-problems:hover {
    background: #5a32a3;
    transform: none;
    box-shadow: 0 4px 8px rgba(111, 66, 193, 0.3);
}

/* Responsive behavior for problem assessment */
@media (max-width: 768px) {
    .problem-assessment-centered {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
        max-width: 100%;
    }
    
    .problem-assessment-centered .labeled-input input[type="text"] {
        min-height: 44px;
        padding: 10px;
    }
    
    .problem-assessment-centered .labeled-input textarea {
        min-height: 70px;
    }
    
    .btn-select-problems {
        min-height: 70px;
        padding: 12px 16px;
    }
}

@media (min-width: 1200px) {
    .problem-assessment-centered {
        max-width: 1200px;
        gap: 30px 40px;
    }
    
    .problem-assessment-centered .labeled-input textarea {
        min-height: 90px;
    }
    
    .btn-select-problems {
        min-height: 90px;
    }
}

/* ==============================================
   IMAGE UPLOAD STYLES - STEP 5
   ============================================== */

/* Method Tabs for Image Upload */
.method-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.method-tab {
    flex: 1;
    padding: 12px 16px;
    background: #f8f9fa;
    border: none;
    border-right: 1px solid #dee2e6;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    position: relative;
}

.method-tab:last-child {
    border-right: none;
}

.method-tab:hover {
    background: #e9ecef;
    color: #495057;
}

.method-tab.active {
    background: #007bff;
    color: white;
    font-weight: 600;
}

.method-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #0056b3;
}

/* Upload Panel Styles */
.upload-panel {
    display: none;
    padding: 20px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
    margin-bottom: 20px;
}

.upload-panel.active {
    display: block;
}

.upload-instructions {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.upload-instructions h4 {
    color: #007bff;
    margin-bottom: 8px;
    font-size: 16px;
}

.upload-instructions p {
    margin: 4px 0;
    color: #6c757d;
    font-size: 14px;
}

/* Drag and Drop Zone */
.drag-drop-zone {
    border: 2px dashed #007bff;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.drag-drop-zone:hover {
    border-color: #0056b3;
    background: #e7f3ff;
}

.drag-drop-zone.dragover {
    border-color: #28a745;
    background: #d4edda;
    transform: scale(1.02);
}

.drag-drop-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.7;
}

.drag-drop-text {
    font-size: 16px;
    color: #495057;
    margin-bottom: 15px;
}

.drag-drop-text strong {
    color: #007bff;
}

.drag-drop-content {
    text-align: center;
}

/* Camera Controls */
.camera-container {
    text-align: center;
}

.camera-controls {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

#cameraPreview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

/* QR Code Styles */
.qr-container {
    text-align: center;
    padding: 20px;
}

.qr-code {
    display: inline-block;
    padding: 15px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.qr-code-container {
    display: inline-block;
    padding: 15px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

/* QR Upload Compact Layout */
.qr-compact-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: start;
    padding: 15px;
}

.qr-session-info {
    font-size: 1em;
    padding: 8px 0;
}

.qr-session-info strong {
    display: inline-block;
    margin-right: 8px;
}

.qr-session-info span {
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    font-weight: bold;
    color: #007bff;
}

.qr-info {
    margin-top: 15px;
}

.qr-info p {
    margin: 8px 0;
    color: #6c757d;
}

/* WebRTC Styles */
.webrtc-container {
    padding: 20px;
}

.webrtc-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Direct Transfer Compact Layout */
.direct-transfer-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: start;
    margin-top: 15px;
}

.qr-column {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.qr-code-container {
    display: inline-block;
}

.info-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-info {
    font-size: 1.1em;
    padding: 8px 0;
}

.room-info strong {
    display: inline-block;
    margin-right: 8px;
}

.room-info span {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    font-weight: bold;
    color: #007bff;
}

.btn-compact {
    width: fit-content;
    padding: 6px 16px;
    font-size: 0.95em;
}

.manual-link-section {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.manual-link-section strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.link-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.link-row a {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    word-break: break-all;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .direct-transfer-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .qr-compact-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .qr-column {
        justify-content: center;
    }
    
    .info-column {
        align-items: stretch;
    }
    
    .btn-compact {
        width: 100%;
    }
    
    .link-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .link-row button {
        width: 100%;
    }
}

.connection-status {
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    margin-top: 15px;
    font-weight: 500;
}

.connection-status.waiting {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.connection-status.connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.connection-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Image Counter */
.image-counter {
    text-align: center;
    margin: 15px 0;
    font-weight: 500;
    color: #495057;
}

/* Image Preview Container */
.image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 6px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.image-preview-item img {
    max-width: 100%;
    max-height: 70px;
    border-radius: 4px;
    object-fit: cover;
    margin-bottom: 4px;
}

.image-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    padding: 0;
    font-weight: bold;
}

.image-remove-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.image-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.image-info .filename {
    font-size: 0.75em;
    color: #6c757d;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.image-preview-item .remove-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.image-preview-item .remove-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Responsive Design for Image Upload */
@media (max-width: 768px) {
    .method-tabs {
        flex-direction: column;
    }
    
    .method-tab {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .method-tab:last-child {
        border-bottom: none;
    }
    
    .webrtc-options {
        flex-direction: column;
        align-items: center;
    }
    
    .camera-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .drag-drop-zone {
        padding: 30px 15px;
    }
    
    .drag-drop-icon {
        font-size: 36px;
    }
    
    .drag-drop-text {
        font-size: 14px;
    }
    
    .image-preview-container {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
}

/* ===== INSPECTION DETAILS MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.inspection-details-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    margin: 20px;
}

.inspection-details-modal .modal-content {
    padding: 20px;
}

.inspection-details-modal h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.details-grid div {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.details-grid strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.modal-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.modal-actions .btn-secondary {
    background: #6c757d;
    color: white;
}

.modal-actions .btn-secondary:hover {
    background: #5a6268;
}

.modal-actions .btn-primary {
    background: #007bff;
    color: white;
}

.modal-actions .btn-primary:hover {
    background: #0056b3;
}

@media (max-width: 768px) {
    .inspection-details-modal {
        max-width: 95%;
        max-height: 90%;
        margin: 10px;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* ================== Image Viewer Styles ================== */
.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-viewer-container {
    width: 95%;
    height: 95%;
    max-width: 1200px;
    max-height: 800px;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.image-viewer-title {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.image-viewer-title span:first-child {
    font-weight: bold;
    color: #007bff;
}

.image-viewer-title span:last-child {
    font-size: 0.9rem;
    color: #666;
}

.close-viewer {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.close-viewer:hover {
    background-color: #e9ecef;
}

.image-viewer-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 80px;
    font-size: 24px;
    cursor: pointer;
    z-index: 10001;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button:hover {
    background: rgba(0, 0, 0, 0.9);
}

.prev-button {
    left: 10px;
    border-radius: 0 8px 8px 0;
}

.next-button {
    right: 10px;
    border-radius: 8px 0 0 8px;
}

.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    cursor: grab;
}

.viewer-image:active {
    cursor: grabbing;
}

.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

.image-viewer-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
}

.control-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.control-btn:hover {
    background: #0056b3;
}

.control-btn:active {
    transform: translateY(1px);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .image-viewer-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .nav-button {
        width: 40px;
        height: 60px;
        font-size: 20px;
    }
    
    .image-viewer-controls {
        padding: 10px;
        gap: 8px;
    }
    
    .control-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* ===== VIEW INSPECTION CONTAINER STYLES ===== */
.view-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.view-container .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #007bff;
}

.view-container .page-header h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 2rem;
}

.btn-back {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-back:hover {
    background: #5a6268;
}

.view-inspection-details {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.inspection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px 8px 0 0;
}

.inspection-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.header-actions .btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.header-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.info-section {
    padding: 25px;
    border-bottom: 1px solid #e9ecef;
}

.info-section:last-child {
    border-bottom: none;
}

.info-section h3 {
    margin: 0 0 20px 0;
    color: #495057;
    font-size: 1.3rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item.highlight {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.info-item label {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item span {
    color: #212529;
    font-size: 1rem;
}

.info-item .score-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #007bff;
}

.info-item .grade-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #28a745;
}

.description-text {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #17a2b8;
    color: #212529;
    line-height: 1.6;
    white-space: pre-wrap;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.gallery-item {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: white;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.gallery-label {
    padding: 10px;
    text-align: center;
    background: #f8f9fa;
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

/* Action buttons in history table */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-edit {
    background: #ffc107;
    color: #212529;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-edit:hover {
    background: #ffb300;
}

.btn-view {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-view:hover {
    background: #138496;
}

/* Mobile responsive for view container */
@media (max-width: 768px) {
    .view-container {
        padding: 0 10px;
    }
    
    .view-container .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .inspection-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .gallery-item img {
        height: 150px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-edit, .btn-view {
        width: 100%;
    }
}

/* ===== UPLOAD INFO MODAL ===== */
/* Upload Info Popover */
.upload-info-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    width: 320px;
    max-width: 90vw;
    animation: popoverFadeIn 0.2s ease-out;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.upload-info-popover::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.05));
}

@keyframes popoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popover-content {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.popover-tip {
    margin-top: 12px;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

.upload-method-info {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.upload-method-info:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.upload-method-info h4 {
    color: #333;
    font-size: 0.95rem;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.upload-method-info ul {
    margin: 0;
    padding-left: 18px;
    color: #555;
}

.upload-method-info li {
    margin-bottom: 4px;
    line-height: 1.4;
    font-size: 0.85rem;
}

.btn-info {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.btn-info.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Mobile responsive for popover */
@media (max-width: 768px) {
    .upload-info-popover {
        width: 280px;
        right: -10px;
    }
    
    .upload-info-popover::before {
        right: 15px;
    }
    
    .popover-content {
        max-height: 350px;
    }
    
    .upload-method-info h4 {
        font-size: 0.9rem;
    }
    
    .upload-method-info li {
        font-size: 0.8rem;
    }
}

