/* TWW Survey Frontend Styles */

.tww-survey-container {
    max-width: 700px;
    margin: 30px auto;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.tww-survey-header {
    margin-bottom: 30px;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 20px;
}

.tww-survey-title {
    margin: 0 0 10px 0;
    font-size: 28px;
    color: #1d2327;
}

.tww-survey-description {
    margin: 0;
    color: #50575e;
    line-height: 1.6;
}

/* Sections */
.tww-survey-section {
    margin-bottom: 30px;
}

.tww-survey-section h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #1d2327;
}

/* Fields */
.tww-survey-field {
    margin-bottom: 20px;
}

.tww-survey-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1d2327;
}

.tww-survey-input,
.tww-survey-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    transition: border-color 0.2s ease;
}

.tww-survey-input:focus,
.tww-survey-textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.tww-survey-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Questions */
.tww-survey-questions {
    margin-top: 30px;
}

.tww-survey-question {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.tww-survey-question-label {
    display: block;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.5;
}

.tww-survey-question-label .question-number {
    color: #2271b1;
    margin-right: 5px;
}

.required {
    color: #d63638;
    font-weight: bold;
    margin-left: 3px;
}

/* Radio and Checkbox Groups */
.tww-survey-radio-group,
.tww-survey-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tww-survey-radio,
.tww-survey-checkbox {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #ffffff;
    border: 2px solid #dcdcde;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tww-survey-radio:hover,
.tww-survey-checkbox:hover {
    border-color: #2271b1;
    background: #f0f6fc;
}

.tww-survey-radio input[type="radio"],
.tww-survey-checkbox input[type="checkbox"] {
    margin: 0 12px 0 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.tww-survey-radio input[type="radio"]:checked,
.tww-survey-checkbox input[type="checkbox"]:checked {
    accent-color: #2271b1;
}

.tww-survey-radio span,
.tww-survey-checkbox span {
    flex: 1;
    font-size: 15px;
    color: #2c3338;
}

/* Submit Button */
.tww-survey-submit {
    margin-top: 30px;
    text-align: center;
}

.tww-survey-button {
    background: #2271b1;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tww-survey-button:hover {
    background: #135e96;
}

.tww-survey-button:active {
    transform: translateY(1px);
}

.tww-survey-button:disabled {
    background: #8c8f94;
    cursor: not-allowed;
}

/* Messages */
.tww-survey-messages {
    margin-top: 20px;
}

.tww-survey-success {
    background: #d7f0d7;
    border: 1px solid #5fb15f;
    border-radius: 6px;
    padding: 15px 20px;
    color: #2c6e2c;
    font-weight: 600;
    text-align: center;
}

.tww-survey-error {
    background: #f7d4d4;
    border: 1px solid #d63638;
    border-radius: 6px;
    padding: 15px 20px;
    color: #8a2424;
    font-weight: 600;
    text-align: center;
}

/* Loading State */
.tww-survey-loading {
    opacity: 0.6;
    pointer-events: none;
}

.tww-survey-loading .tww-survey-button::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: tww-spin 0.6s linear infinite;
}

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

/* Form Hidden State (after submission) */
.tww-survey-form.submitted {
    display: none;
}

/* Validation */
.tww-survey-input:invalid,
.tww-survey-textarea:invalid {
    border-color: #d63638;
}

.tww-survey-input:invalid:focus,
.tww-survey-textarea:invalid:focus {
    box-shadow: 0 0 0 1px #d63638;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .tww-survey-container {
        padding: 20px;
        margin: 20px 10px;
    }
    
    .tww-survey-title {
        font-size: 24px;
    }
    
    .tww-survey-question {
        padding: 15px;
    }
    
    .tww-survey-button {
        width: 100%;
        padding: 14px 20px;
    }
}

@media screen and (max-width: 480px) {
    .tww-survey-container {
        padding: 15px;
    }
    
    .tww-survey-title {
        font-size: 20px;
    }
    
    .tww-survey-radio,
    .tww-survey-checkbox {
        padding: 10px 12px;
    }
}
