/* Custom styling for teal theme matching the form design */

:root {
    --teal-primary: #347B8C;
    --teal-light: #5A9FB0;
    --bg-light-blue: #F8FCFF;
    --bg-teal-dark: #2A6B7A;
    --text-dark: #333333;
    --text-light: #666666;
    --border-light: #E0E8EB;

    /* Override Bootstrap success color to match stepper green */
    --bs-success: #28a745;
    --bs-success-rgb: 40, 167, 69;
}

body {
    background: linear-gradient(135deg, var(--bg-light-blue) 0%, #E8F4F8 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    padding-top: 2rem;
}

/* Form Stepper/Progress Indicator */
.form-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0.5rem 0 1rem 0;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}

.stepper-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: white;
    border: 2px solid var(--border-light);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stepper-icon {
    font-size: 12px;
    line-height: 1;
    display: inline-block;
}

/* Completed state - green with checkmark */
.stepper-step.completed .stepper-circle {
    background-color: #28a745;
    border-color: #28a745;
}

.stepper-step.completed .stepper-icon::before {
    content: '✓';
    color: white;
    font-weight: bold;
}

/* Active state - warning color with pencil */
.stepper-step.active .stepper-circle {
    background-color: #ffc107;
    border-color: #ffc107;
}

.stepper-step.active .stepper-icon::before {
    content: '✎';
    color: white;
    font-weight: bold;
}

/* Incomplete state - light border with dash */
.stepper-step:not(.active):not(.completed) .stepper-circle {
    background-color: white;
    border-color: var(--border-light);
}

.stepper-step:not(.active):not(.completed) .stepper-icon::before {
    content: '−';
    color: var(--border-light);
    font-weight: normal;
}

.stepper-line {
    flex: 1;
    height: 2px;
    background-color: var(--border-light);
    margin: 0;
    position: relative;
    z-index: 0;
}

.stepper-step.conditional-step {
    display: none;
}

.stepper-step.conditional-step.visible {
    display: flex;
}

.stepper-line.conditional-step {
    display: none;
}

.stepper-line.conditional-step.visible {
    display: block;
}

.form-container {
    background-color: var(--bg-light-blue);
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 800px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-light);
}

.form-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-title {
    color: var(--teal-primary);
    font-weight: 600;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.form-description {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}


.form-group {
    margin-bottom: 1.5rem;
    position: relative; /* Needed for tooltip positioning */
}

/* Input wrapper for tooltip positioning */
.input-wrapper {
    position: relative;
    display: block;
}

.form-label {
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-label .required {
    color: #dc3545;
    margin-left: 2px;
}

.form-control, .form-select {
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 0.75rem;
    font-size: 0.95rem;
    position: relative; /* Needed for tooltip positioning */
}

.form-control:focus, .form-select:focus {
    border-color: var(--teal-primary);
    box-shadow: 0 0 0 0.2rem rgba(52, 123, 140, 0.25);
}

.form-text {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Make unselected radio buttons more visible */
.form-check-input {
    border-color: var(--text-light);
    border-width: 2px;
}

.form-check-input:not(:checked) {
    background-color: #ffffff;
    border-color: #999999;
}

.form-check-input:checked {
    background-color: var(--teal-primary);
    border-color: var(--teal-primary);
    border-width: 2px;
}

.form-check-label {
    color: var(--text-dark);
    margin-left: 0.5rem;
}

.form-check-input:checked + .form-check-label {
    font-weight: bold;
}

.btn-primary {
    background-color: var(--teal-primary);
    border-color: var(--teal-primary);
    color: white;
    padding: 0.75rem 2rem;
    font-weight: 500;
    border-radius: 4px;
}

.btn-primary:hover {
    background-color: var(--bg-teal-dark);
    border-color: var(--bg-teal-dark);
}

.btn-secondary {
    background-color: var(--teal-light);
    border-color: var(--teal-light);
    color: white;
    padding: 0.75rem 2rem;
    font-weight: 500;
    border-radius: 4px;
}

.btn-secondary:hover {
    background-color: var(--teal-primary);
    border-color: var(--teal-primary);
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    padding: 0.75rem 2rem;
    font-weight: 500;
    border-radius: 4px;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
    padding: 0.75rem 2rem;
    font-weight: 500;
    border-radius: 4px;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-success:disabled,
.btn-success.disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Extra small button size - label-like with tight padding */
.btn-xsm {
    padding: 0.125rem 0.375rem;
    font-size: 0.7rem;
    line-height: 1.2;
    border-radius: 3px;
    font-weight: 500;
}

.btn-xsm.btn-primary,
.btn-xsm.btn-secondary,
.btn-xsm.btn-danger,
.btn-xsm.btn-success,
.btn-xsm.btn-warning,
.btn-xsm.btn-info,
.btn-xsm.btn-light,
.btn-xsm.btn-dark,
.btn-xsm.btn-outline-primary,
.btn-xsm.btn-outline-secondary,
.btn-xsm.btn-outline-danger,
.btn-xsm.btn-outline-success,
.btn-xsm.btn-outline-warning,
.btn-xsm.btn-outline-info,
.btn-xsm.btn-outline-light,
.btn-xsm.btn-outline-dark {
    padding: 0.125rem 0.375rem;
    font-size: 0.7rem;
    line-height: 1.2;
    border-radius: 3px;
}

#submit-button {
    width: 200px;
}

/* Placeholder text styling */
input::placeholder,
textarea::placeholder {
    color: #B0B0B0;
    opacity: 1;
}

/* Ensure placeholder text disappears on focus */
input:focus::placeholder,
textarea:focus::placeholder {
    opacity: 0;
    transition: opacity 0.2s;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-light);
}

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

.bin-item {
    text-align: center;
}

.bin-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.bin-size {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--teal-primary);
    margin-bottom: 0.25rem;
}

.bin-dimensions {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Bins group wrapper for validation */
.bins-group-wrapper {
    position: relative;
    padding: 1rem;
    border: 2px solid transparent;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s ease;
}

.bins-group-wrapper.is-invalid-group {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.03);
}

.form-group.is-invalid-group {
    border: 1px solid #dc3545;
    border-radius: 0.25rem;
    padding: 0.75rem;
    background-color: rgba(220, 53, 69, 0.03);
}

.bins-group-wrapper .form-group:last-child {
    margin-bottom: 0;
}

/* Bin form group with image and input side by side */
.bin-form-group {
    margin-bottom: 2rem;
}

.bin-input-layout {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.bin-image-container {
    flex-shrink: 0;
    width: 140px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.bin-image-container .bin-image {
    width: auto;
    max-width: 100%;
    height: 110px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 0;
}

.bin-input-container {
    flex: 1;
}

.bin-dimensions-text {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Responsive: stack on smaller screens */
@media (max-width: 768px) {
    .bin-input-layout {
        flex-direction: column;
    }

    .bin-image-container {
        width: 140px;
        margin: 0;
    }
}

.file-upload-area {
    border: 2px dashed var(--border-light);
    border-radius: 4px;
    padding: 1.5rem;
    text-align: center;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.file-upload-area:hover {
    border-color: var(--teal-primary);
}

.file-upload-area.drag-over {
    border-color: var(--teal-primary);
    background-color: #F0F8FA;
    border-style: solid;
}

.file-upload-icon {
    font-size: 2rem;
    color: var(--teal-primary);
    margin-bottom: 0.5rem;
}

.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    background-color: #f8f9fa;
}

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

.image-preview-item .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.image-preview-item .remove-image:hover {
    background-color: rgba(220, 53, 69, 1);
}

.review-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.review-images-container .image-preview-item {
    width: 100px;
    height: 100px;
}

/* Existing images display on page 4 */
.existing-images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.existing-image-item {
    position: relative;
    width: 150px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    transition: opacity 0.3s;
}

.existing-image-item.removed {
    opacity: 0.5;
    filter: grayscale(100%);
}

.existing-image-item.removed .existing-image-preview {
    cursor: not-allowed;
    pointer-events: none;
}

.existing-image-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s;
}

.existing-image-preview:hover {
    opacity: 0.8;
}

.existing-image-info {
    padding: 0.5rem;
    background-color: white;
    border-top: 1px solid var(--border-light);
}

.existing-image-filename {
    font-size: 0.75rem;
    color: var(--text-light);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-existing-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    transition: background-color 0.2s;
    padding: 0;
}

.remove-existing-image:hover {
    background-color: rgba(220, 53, 69, 0.9);
}

.remove-existing-image:active {
    background-color: rgba(220, 53, 69, 1);
}

.remove-icon {
    display: block;
    font-weight: bold;
    line-height: 1;
}

.undo-existing-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: rgba(40, 167, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    transition: background-color 0.2s;
    padding: 0;
}

.undo-existing-image:hover {
    background-color: rgba(40, 167, 69, 1);
}

.undo-existing-image:active {
    background-color: rgba(33, 136, 56, 1);
}

.undo-icon {
    display: block;
    font-weight: bold;
    line-height: 1;
    transform: rotate(-90deg);
}

.important-note {
    background-color: #FFF3CD;
    border-left: 4px solid #FFC107;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.important-note p {
    margin: 0;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.warning-note {
    background-color: #F8D7DA;
    border-left: 4px solid #DC3545;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.warning-note p {
    margin: 0;
    color: #721C24;
    font-size: 0.9rem;
}

.warning-note a {
    color: #DC3545;
    font-weight: 600;
    text-decoration: underline;
}

.warning-note a:hover {
    color: #C82333;
}

.already-responded-notice {
    background-color: #D1ECF1;
    border-left: 4px solid #0C5460;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.already-responded-notice p {
    margin: 0;
    color: #0C5460;
    font-size: 0.9rem;
}

/* JustValidate tooltip styling - positioned relative to input-wrapper or form-group */
.input-wrapper .just-validate-error-label,
.input-wrapper .just-validate-error-label-tooltip,
.input-wrapper [data-just-validate-tooltip],
.input-wrapper .just-validate-tooltip,
.form-group .just-validate-error-label,
.form-group .just-validate-error-label-tooltip,
.form-group [data-just-validate-tooltip],
.form-group .just-validate-tooltip,
.just-validate-error-label,
.just-validate-error-label-tooltip,
[data-just-validate-tooltip],
.just-validate-tooltip {
    background-color: #dc3545 !important;
    color: white !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 4px !important;
    font-size: 0.875rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    z-index: 10000 !important;
    position: absolute !important;
    white-space: nowrap !important;
    max-width: 300px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none !important;
    top: calc(100% + 8px) !important;
    transform: none !important;
    bottom: auto !important;
}

/* Bottom-right positioning for regular inputs (default) */
.tooltip-bottom-right,
.input-wrapper .just-validate-error-label:not(.tooltip-bottom-left),
.form-group .just-validate-error-label:not(.tooltip-bottom-left) {
    right: 0 !important;
    left: auto !important;
}

/* Bottom-left positioning for radio buttons and checkboxes */
.tooltip-bottom-left,
.form-group .just-validate-error-label.tooltip-bottom-left {
    left: 0 !important;
    right: auto !important;
}

.input-wrapper .just-validate-error-label::before,
.input-wrapper .just-validate-error-label-tooltip::before,
.input-wrapper [data-just-validate-tooltip]::before,
.input-wrapper .just-validate-tooltip::before,
.form-group .just-validate-error-label::before,
.form-group .just-validate-error-label-tooltip::before,
.form-group [data-just-validate-tooltip]::before,
.form-group .just-validate-tooltip::before,
.just-validate-error-label::before,
.just-validate-error-label-tooltip::before,
[data-just-validate-tooltip]::before,
.just-validate-tooltip::before {
    content: '' !important;
    position: absolute !important;
    bottom: 100% !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 6px solid transparent !important;
    border-right: 6px solid transparent !important;
    border-bottom: 6px solid #dc3545 !important;
}

/* Arrow position for bottom-right tooltips */
.tooltip-bottom-right::before {
    right: 20px !important;
    left: auto !important;
}

/* Arrow position for bottom-left tooltips */
.tooltip-bottom-left::before {
    left: 20px !important;
    right: auto !important;
}

/* Group error tooltip - positioned at bottom of group wrapper */
.bins-group-wrapper .just-validate-error-label.group-error-tooltip {
    position: absolute !important;
    bottom: -40px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: auto !important;
    right: auto !important;
    white-space: normal !important;
    max-width: 400px !important;
    text-align: center !important;
}

.bins-group-wrapper .just-validate-error-label.group-error-tooltip::before {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
}

/* Success state styling */
.is-valid {
    border-color: #28a745 !important;
}

.is-invalid {
    border-color: #dc3545 !important;
}

/* Review page styling */
.review-section {
    background-color: white;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
}

.review-section-title {
    color: var(--teal-primary);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--teal-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.review-edit-link {
    color: var(--teal-primary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.review-edit-link:hover {
    background-color: rgba(52, 123, 140, 0.1);
    text-decoration: underline;
}

.review-edit-link:active {
    background-color: rgba(52, 123, 140, 0.2);
}

.review-item {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

.review-label {
    font-weight: 500;
    color: var(--text-dark);
    min-width: 200px;
    flex-shrink: 0;
}

.review-value {
    color: var(--text-light);
    flex: 1;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.review-value:empty::before {
    content: '-';
    color: var(--text-light);
}

@media (max-width: 768px) {
    .bin-grid {
        grid-template-columns: 1fr;
    }

    .form-container {
        margin: 1rem;
        padding: 1.5rem;
    }

    .just-validate-error-label {
        max-width: 250px !important;
        font-size: 0.8rem !important;
    }

    .review-item {
        flex-direction: column;
    }

    .review-label {
        min-width: auto;
        margin-bottom: 0.25rem;
    }

    .review-section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .review-edit-link {
        align-self: flex-end;
    }

    .form-stepper {
        flex-wrap: nowrap;
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .stepper-step {
        min-width: 20px;
        flex: 0 0 auto;
    }

    .stepper-circle {
        width: 20px;
        height: 20px;
    }

    .stepper-icon {
        font-size: 10px;
    }

    .stepper-line {
        flex: 1 1 auto;
        min-width: 10px;
        margin: 0;
    }
}

/* Image Modal Styles */
#imageModalDialog {
    max-width: 90vw;
    width: auto;
}

#modalImageContainer {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: #000;
}

.modal-image-transition {
    transition: opacity 0.15s ease-in-out;
    max-width: 100%;
    max-height: 90vh;
    height: auto;
    width: auto;
}

.btn-image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    z-index: 10;
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0;
    line-height: 1;
}

.btn-image-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.btn-image-nav:active {
    background-color: rgba(0, 0, 0, 0.9);
}

.btn-image-nav.btn-prev {
    left: 15px;
}

.btn-image-nav.btn-next {
    right: 15px;
}

.btn-image-nav span {
    display: block;
    line-height: 1;
    margin-top: -2px;
}

@media (max-width: 768px) {
    .btn-image-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .btn-image-nav.btn-prev {
        left: 10px;
    }

    .btn-image-nav.btn-next {
        right: 10px;
    }
}

