/* ==========================================================================
   Herzwerk Survey – Frontend Styles
   Mobile-first, warm natural design
   ========================================================================== */

:root {
    --hw-bg:        #f9f7f4;
    --hw-primary:   #4a7c59;
    --hw-accent:    #c8956c;
    --hw-white:     #ffffff;
    --hw-text:      #3c3530;
    --hw-text-muted: #7a726c;
    --hw-border:    #e2ddd8;
    --hw-shadow:    0 2px 12px rgba(0, 0, 0, 0.08);
    --hw-radius-card:   12px;
    --hw-radius-input:  8px;
    --hw-radius-btn:    24px;
    --hw-transition:    0.2s ease;
    --hw-font-heading:  'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --hw-font-body:     'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ==========================================================================
   Survey Container
   ========================================================================== */

.hw-survey-container {
    font-family: var(--hw-font-body);
    color: var(--hw-text);
    background-color: var(--hw-bg);
    min-height: 300px;
    padding: 24px 16px 40px;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hw-survey-container *,
.hw-survey-container *::before,
.hw-survey-container *::after {
    box-sizing: border-box;
}

/* Header image */
.hw-survey-header-image {
    width: 100%;
    border-radius: var(--hw-radius-card);
    overflow: hidden;
    margin-bottom: 24px;
    max-height: 280px;
}

.hw-survey-header-image img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}

/* Survey title & description */
.hw-survey-title-wrap {
    text-align: center;
    margin-bottom: 28px;
}

.hw-survey-main-title {
    font-family: var(--hw-font-heading);
    font-size: 28px;
    font-weight: 700;
    color: var(--hw-text);
    margin: 0 0 10px;
    line-height: 1.3;
}

.hw-survey-description {
    font-size: 15px;
    color: var(--hw-text-muted);
    margin: 0 auto;
    max-width: 560px;
    line-height: 1.6;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.hw-progress-wrap {
    margin: 0 auto 24px;
    max-width: 640px;
}

.hw-progress-bar-track {
    background: var(--hw-border);
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 6px;
}

.hw-progress-bar-fill {
    height: 100%;
    background: var(--hw-primary);
    border-radius: 8px;
    transition: width 0.4s ease;
    min-width: 3%;
}

.hw-progress-text {
    font-size: 12px;
    color: var(--hw-text-muted);
    text-align: right;
    display: block;
}

/* ==========================================================================
   Survey Card (holds one step or all questions in one-page mode)
   ========================================================================== */

.hw-survey-card {
    background: var(--hw-white);
    border-radius: var(--hw-radius-card);
    box-shadow: var(--hw-shadow);
    padding: 28px 24px 24px;
    max-width: 640px;
    margin: 0 auto;
}

/* ==========================================================================
   Steps
   ========================================================================== */

.hw-step {
    display: none;
    animation: hw-fade-in 0.3s ease;
}

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

.hw-step-all {
    display: block;
}

@keyframes hw-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Question
   ========================================================================== */

.hw-question-wrap {
    margin-bottom: 28px;
    transition: opacity var(--hw-transition), max-height 0.3s ease;
}

.hw-question-wrap.hw-hidden {
    display: none;
}

.hw-question-label {
    font-family: var(--hw-font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--hw-text);
    margin: 0 0 6px;
    line-height: 1.4;
    display: block;
}

.hw-question-label .hw-required-star {
    color: #c94040;
    margin-left: 3px;
}

.hw-question-sub {
    font-size: 13px;
    color: var(--hw-text-muted);
    margin: 0 0 14px;
    display: block;
}

.hw-question-error {
    display: none;
    color: #c94040;
    font-size: 12px;
    margin-top: 6px;
    padding: 6px 10px;
    background: #fff5f5;
    border-radius: 6px;
    border-left: 3px solid #c94040;
}

.hw-question-error.visible {
    display: block;
    animation: hw-fade-in 0.2s ease;
}

.hw-field-error input,
.hw-field-error textarea,
.hw-field-error select {
    border-color: #c94040 !important;
    box-shadow: 0 0 0 3px rgba(201, 64, 64, 0.1) !important;
}

/* ==========================================================================
   Inputs
   ========================================================================== */

.hw-input,
.hw-textarea,
.hw-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--hw-border);
    border-radius: var(--hw-radius-input);
    font-family: var(--hw-font-body);
    font-size: 15px;
    color: var(--hw-text);
    background: var(--hw-white);
    transition: border-color var(--hw-transition), box-shadow var(--hw-transition);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.hw-input:focus,
.hw-textarea:focus,
.hw-select:focus {
    border-color: var(--hw-primary);
    box-shadow: 0 0 0 4px rgba(74, 124, 89, 0.12);
}

.hw-input::placeholder,
.hw-textarea::placeholder {
    color: #b0a9a3;
}

.hw-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.hw-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a726c' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

/* ==========================================================================
   Radio Buttons (custom)
   ========================================================================== */

.hw-radio-group,
.hw-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hw-option-label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--hw-border);
    border-radius: var(--hw-radius-input);
    cursor: pointer;
    transition: border-color var(--hw-transition), background var(--hw-transition), transform var(--hw-transition);
    user-select: none;
    min-height: 52px;
    background: var(--hw-white);
    font-size: 15px;
    color: var(--hw-text);
    line-height: 1.4;
}

.hw-option-label:hover {
    border-color: var(--hw-primary);
    background: rgba(74, 124, 89, 0.04);
    transform: translateY(-1px);
}

.hw-option-label:active {
    transform: translateY(0);
}

/* Hide native radio/checkbox */
.hw-option-label input[type="radio"],
.hw-option-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Custom radio circle */
.hw-custom-radio,
.hw-custom-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--hw-border);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--hw-transition), background var(--hw-transition);
    background: var(--hw-white);
}

.hw-custom-checkbox {
    border-radius: 5px;
}

.hw-custom-radio::after,
.hw-custom-checkbox::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transition: background var(--hw-transition), opacity var(--hw-transition);
    opacity: 0;
}

.hw-custom-checkbox::after {
    width: 7px;
    height: 11px;
    border-radius: 0;
    border-right: 2.5px solid var(--hw-white);
    border-bottom: 2.5px solid var(--hw-white);
    background: transparent;
    transform: rotate(40deg) translateY(-2px);
}

/* Selected state */
input[type="radio"]:checked ~ .hw-custom-radio,
input[type="checkbox"]:checked ~ .hw-custom-checkbox {
    border-color: var(--hw-primary);
    background: var(--hw-primary);
}

input[type="radio"]:checked ~ .hw-custom-radio::after {
    background: var(--hw-white);
    opacity: 1;
}

input[type="checkbox"]:checked ~ .hw-custom-checkbox::after {
    opacity: 1;
}

.hw-option-label:has(input:checked) {
    border-color: var(--hw-primary);
    background: rgba(74, 124, 89, 0.06);
}

/* Legacy fallback for :has() */
.hw-option-label.hw-selected {
    border-color: var(--hw-primary);
    background: rgba(74, 124, 89, 0.06);
}

.hw-option-label.hw-selected .hw-custom-radio,
.hw-option-label.hw-selected .hw-custom-checkbox {
    border-color: var(--hw-primary);
    background: var(--hw-primary);
}

.hw-option-label.hw-selected .hw-custom-radio::after {
    background: var(--hw-white);
    opacity: 1;
}

.hw-option-label.hw-selected .hw-custom-checkbox::after {
    opacity: 1;
}

/* ==========================================================================
   Rating Stars
   ========================================================================== */

.hw-rating-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.hw-rating-star-label {
    cursor: pointer;
    font-size: 36px;
    color: #ddd8d4;
    transition: color var(--hw-transition), transform var(--hw-transition);
    line-height: 1;
    user-select: none;
    padding: 4px;
}

.hw-rating-star-label:hover,
.hw-rating-star-label.hw-star-hover,
.hw-rating-star-label.hw-star-selected {
    color: #f9a825;
    transform: scale(1.15);
}

.hw-rating-star-label input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.hw-rating-value-display {
    font-size: 13px;
    color: var(--hw-text-muted);
    margin-left: 4px;
}

/* ==========================================================================
   Navigation Buttons
   ========================================================================== */

.hw-nav-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    gap: 12px;
}

.hw-btn-prev,
.hw-btn-next,
.hw-btn-submit {
    padding: 14px 28px;
    border-radius: var(--hw-radius-btn);
    font-family: var(--hw-font-body);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all var(--hw-transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1;
    outline: none;
}

.hw-btn-prev {
    background: transparent;
    color: var(--hw-text-muted);
    border: 2px solid var(--hw-border);
}

.hw-btn-prev:hover {
    background: var(--hw-bg);
    border-color: var(--hw-text-muted);
    color: var(--hw-text);
}

.hw-btn-next,
.hw-btn-submit {
    background: var(--hw-primary);
    color: var(--hw-white);
    box-shadow: 0 4px 14px rgba(74, 124, 89, 0.3);
}

.hw-btn-next:hover,
.hw-btn-submit:hover {
    background: #3a6248;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(74, 124, 89, 0.4);
}

.hw-btn-next:active,
.hw-btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(74, 124, 89, 0.3);
}

.hw-btn-next:focus,
.hw-btn-submit:focus {
    outline: 3px solid rgba(74, 124, 89, 0.4);
    outline-offset: 2px;
}

.hw-btn-submit.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

.hw-btn-submit.loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.5);
    border-top-color: white;
    border-radius: 50%;
    animation: hw-spin 0.6s linear infinite;
    margin-left: 4px;
}

@keyframes hw-spin {
    to { transform: rotate(360deg); }
}

/* Arrow icons */
.hw-arrow-right::after { content: ' →'; }
.hw-arrow-left::before  { content: '← '; }

/* ==========================================================================
   Honeypot field
   ========================================================================== */

.hw-honeypot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    pointer-events: none;
    height: 0;
    overflow: hidden;
    visibility: hidden;
}

/* ==========================================================================
   Thank You Screen
   ========================================================================== */

.hw-thank-you {
    text-align: center;
    padding: 40px 24px;
    animation: hw-fade-in 0.4s ease;
    max-width: 640px;
    margin: 0 auto;
}

.hw-thank-you-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: hw-bounce-in 0.5s ease;
}

/* Thank-you images */
.hw-thank-you-images {
    margin: 24px auto 8px;
    max-width: 560px;
}

.hw-thank-you-images--single .hw-thank-you-img {
    width: 100%;
    border-radius: var(--hw-radius-card);
    box-shadow: var(--hw-shadow);
    display: block;
}

.hw-thank-you-images--grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.hw-thank-you-images--grid .hw-thank-you-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--hw-radius-card);
    box-shadow: var(--hw-shadow);
    transition: transform var(--hw-transition), box-shadow var(--hw-transition);
}

.hw-thank-you-images--grid .hw-thank-you-img:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

@keyframes hw-bounce-in {
    0%   { transform: scale(0); opacity: 0; }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.hw-thank-you-title {
    font-family: var(--hw-font-heading);
    font-size: 32px;
    font-weight: 700;
    color: var(--hw-primary);
    margin: 0 0 16px;
    line-height: 1.3;
}

.hw-thank-you-message {
    font-size: 16px;
    color: var(--hw-text-muted);
    line-height: 1.7;
    margin: 0 auto 24px;
    max-width: 480px;
}

.hw-thank-you-message p {
    margin: 0 0 12px;
}

.hw-redirect-countdown {
    font-size: 13px;
    color: var(--hw-text-muted);
    margin-top: 20px;
}

.hw-redirect-countdown strong {
    color: var(--hw-primary);
}

/* ==========================================================================
   Error / Info messages
   ========================================================================== */

.hw-survey-error,
.hw-survey-info {
    text-align: center;
    padding: 20px 24px;
    border-radius: var(--hw-radius-card);
    font-size: 15px;
}

.hw-survey-error {
    background: #fff5f5;
    color: #c94040;
    border: 1px solid #fecaca;
}

.hw-survey-info {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Submission error message */
.hw-submit-error {
    background: #fff5f5;
    border: 1px solid #fecaca;
    color: #c94040;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
    animation: hw-fade-in 0.2s ease;
}

/* ==========================================================================
   One-page mode
   ========================================================================== */

.hw-survey-onepage .hw-question-wrap {
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--hw-border);
}

.hw-survey-onepage .hw-question-wrap:last-of-type {
    border-bottom: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (min-width: 600px) {
    .hw-survey-main-title {
        font-size: 32px;
    }

    .hw-survey-card {
        padding: 36px 40px 32px;
    }

    .hw-question-label {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .hw-survey-container {
        padding: 16px 12px 32px;
    }

    .hw-survey-card {
        padding: 20px 16px 20px;
    }

    .hw-survey-main-title {
        font-size: 22px;
    }

    .hw-question-label {
        font-size: 16px;
    }

    .hw-btn-prev,
    .hw-btn-next,
    .hw-btn-submit {
        padding: 12px 20px;
        font-size: 14px;
    }

    .hw-rating-star-label {
        font-size: 28px;
    }

    .hw-thank-you-title {
        font-size: 24px;
    }

    .hw-option-label {
        padding: 12px 14px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.hw-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
