/* Survey Display CSS - Shared between preview and live surveys */

/* Survey Container & Layout */
.survey-container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.survey-header {
    background: var(--banner-color);
    color: var(--accent-color);
    padding: 2rem;
    text-align: center;
    font-family: inherit;
}

.survey-title {
    font-size: 2rem;
    font-weight: 700;
    font-family: inherit;
    margin-bottom: 0.5rem;
}

.survey-intro {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.survey-content {
    padding: 2rem;
}

/* Survey Steps & Navigation */
.survey-step {
    display: none;
}

.survey-step.active {
    display: block;
}

.web-content-block {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1rem;
}

.web-content-block.intro h2,
.web-content-block.compliance h2,
.web-content-block.completion h2 {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    margin-bottom: 1rem;
    color: #1f2937;
}

.web-content-block.intro p,
.web-content-block.compliance p {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.web-content-block.completion p {
    font-size: 1rem;
    color: #000000 !important;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.survey-navigation {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.progress-indicator {
    display: none;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn.prev-btn {
    background: #6b7280;
    color: white;
}

.nav-btn.prev-btn:hover:not(:disabled) {
    background: #4b5563;
}

.nav-btn.next-btn,
.nav-btn.continue-btn {
    background: var(--banner-color, #a8c8a4);
    color: var(--accent-color, #ffffff);
}

.nav-btn.next-btn:hover,
.nav-btn.continue-btn:hover {
    opacity: 0.9;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Questions */
.question-container {
    display: none;
    margin-bottom: 2rem;
}

.question-container.active {
    display: block;
}

.question-item {
    margin-bottom: 2rem;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
    margin-top: 20px;
}

.question-description {
    font-size: 0.95rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.required-indicator {
    color: #dc2626;
    margin-left: 0.25rem;
}

/* Question Inputs */
.question-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px; /* Minimum 16px prevents iOS auto-zoom on focus */
    transition: border-color 0.2s;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    box-sizing: border-box;
}

.question-input:focus {
    outline: none;
    border-color: var(--banner-color, #a8c8a4);
}

/* Question Options */
.question-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-item {
    display: block;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    max-width: none;
    margin: 0;
    text-align: left;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.option-item *,
.option-input,
.option-label {
    -webkit-tap-highlight-color: transparent;
}

/* Only show hover effects on devices that support hover */
@media (hover: hover) {
    .option-item:hover {
        border-color: var(--banner-color, #a8c8a4);
        background: #f9fafb;
    }
}

/* Touch device class added via JS */
.touch-device .option-item:hover:not(.selected),
.touch-device .option-item:focus:not(.selected),
.touch-device .option-item:focus-within:not(.selected) {
    border-color: #e5e7eb !important;
    background: transparent !important;
}

.option-item.selected {
    border-color: var(--banner-color, #a8c8a4);
    background: rgba(168, 200, 164, 0.15);
}

/* iOS Safari specific fix - reset border for unselected items regardless of focus state */
@supports (-webkit-touch-callout: none) {
    .option-item:not(.selected) {
        border-color: #e5e7eb !important;
    }
    .option-item.selected {
        border-color: var(--banner-color, #a8c8a4) !important;
    }
}

/* Remove persistent hover/focus states on touch devices */
@media (hover: none) and (pointer: coarse) {
    .option-item:hover:not(.selected) {
        border-color: #e5e7eb !important;
        background: transparent !important;
    }

    .option-item:focus,
    .option-item:active,
    .option-item:focus-within,
    .option-label:focus,
    .option-label:active,
    .option-input:focus,
    .option-input:active {
        outline: none !important;
        box-shadow: none !important;
    }

    .option-item:not(.selected) {
        border-color: #e5e7eb !important;
    }

    .option-item:focus-within:not(.selected),
    .option-item:focus:not(.selected),
    .option-item:active:not(.selected) {
        border-color: #e5e7eb !important;
        background: transparent !important;
    }
}

.option-input {
    margin-right: 0.75rem;
}

.option-label {
    flex: 1;
    cursor: pointer;
    margin-bottom: 0;
}

/* Other Option Input */
.other-input {
    display: block;
    margin-top: 0.5rem;
    margin-left: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 16px; /* Minimum 16px prevents iOS auto-zoom on focus */
    width: 100%;
    max-width: 400px;
    height: auto;
    line-height: 1.5;
    background-color: #ffffff;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.other-input:focus {
    outline: none;
    border-color: var(--banner-color, #3b82f6);
    box-shadow: 0 0 0 1px var(--banner-color, #3b82f6);
}

.other-input::placeholder {
    color: #9ca3af;
}

/* Progress Bar */
.progress-bar {
    height: 4px;
    background: #e5e7eb;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--banner-color, #a8c8a4);
    transition: width 0.3s;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* Completion Screen */
.completion-message {
    text-align: center;
    padding: 3rem 2rem;
    display: none;
}

.completion-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #059669 !important;
}

.completion-text {
    font-size: 1.1rem;
    color: #6b7280 !important;
    line-height: 1.6;
}

/* Error Messages */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
}

/* Question Error Highlight */
.question-item.has-error {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    animation: errorPulse 0.5s ease-in-out;
}

.question-item.has-error .question-text {
    color: #dc2626;
}

@keyframes errorPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

/* Start Screen */
.start-screen {
    text-align: center;
    padding: 3rem 2rem;
}

.start-title {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    margin-bottom: 1rem;
}

.start-description {
    font-size: 1.1rem;
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Button Variations */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--banner-color, #a8c8a4);
    color: var(--accent-color, #ffffff);
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.btn-secondary:hover {
    background: #4b5563;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Questions Page Specific */
.questions-page {
    min-height: 300px;
    text-align: left;
}

.questions-page .question-options {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.questions-page .question-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.questions-page .question-description {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Ranking Questions */
.ranking-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.ranking-option-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.15s ease;
}

.ranking-option-row:hover {
    background-color: #f9fafb;
}

.drag-handle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    cursor: grab;
    color: #9ca3af;
    transition: color 0.15s ease;
    padding: 0.25rem;
    border-radius: 4px;
}

.drag-handle-icon:hover {
    color: #6b7280;
    background: #f3f4f6;
}

.drag-handle-icon:active {
    cursor: grabbing;
}

.ranking-option-text {
    flex: 1;
    font-size: 1rem;
    color: #374151 !important;
    font-weight: 500;
}

.ranking-option-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

/* Click-to-Rank Styles - Fresh Implementation */
.ranking-widget {
    margin-top: 0.75rem;
}

.ranking-widget .ranking-section-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* Unranked options - simple inline chips */
.ranking-widget .ranking-unranked-pool {
    margin-bottom: 1.5rem;
}

.ranking-widget .ranking-chips {
    line-height: 2.5;
}

.ranking-widget .ranking-chip {
    display: inline-block;
    padding: 6px 14px;
    margin: 0 6px 6px 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
    vertical-align: middle;
}

.ranking-widget .ranking-chip:hover {
    border-color: var(--banner-color, #1E3A8A);
    background: #f0f9ff;
    color: var(--banner-color, #1E3A8A);
}

/* Ranked items list */
.ranking-widget .ranking-ranked-pool {
    display: none;
}

.ranking-widget .ranking-ranked-pool.has-items {
    display: block;
}

.ranking-widget .ranking-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ranking-widget .ranking-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.15s ease;
}

.ranking-widget .ranking-list-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.ranking-widget .ranking-list-item.dragging {
    opacity: 0.5;
    background: #e5e7eb;
}

.ranking-widget .ranking-list-item .drag-handle {
    display: flex;
    align-items: center;
    color: #9ca3af;
    cursor: grab;
    padding: 2px;
}

.ranking-widget .ranking-list-item .rank-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    background: var(--banner-color, #1E3A8A);
    color: var(--accent-color, #ffffff);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 50%;
}

.ranking-widget .ranking-list-item .item-text {
    flex: 1;
    font-size: 0.9rem;
    color: #374151;
}

.ranking-widget .ranking-list-item .item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ranking-widget .ranking-list-item .move-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #e5e7eb;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.15s ease;
    padding: 0;
}

.ranking-widget .ranking-list-item .move-btn:hover:not(:disabled) {
    background: #d1d5db;
    color: #374151;
}

.ranking-widget .ranking-list-item .move-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ranking-widget .ranking-list-item .remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.15s ease;
    padding: 0;
    margin-left: 4px;
}

.ranking-widget .ranking-list-item .remove-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Responsive Design */
@media (max-width: 640px) {
    .survey-container {
        margin: 0;
        min-height: 100vh;
        box-shadow: none;
    }

    .survey-content {
        padding: 1rem;
    }

    .web-content-block {
        padding: 1.5rem;
    }

    .nav-buttons {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .nav-btn {
        width: 100%;
    }

    .survey-navigation {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .progress-indicator {
        text-align: center;
    }
}

