/* Custom Sets Manager - Frontend Styles */
/* Clean, professional design with brand color #004279 */

/* Form Container */
.csm-form-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 66, 121, 0.08);
    border: 1px solid #E8F2FF;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

/* Progress Steps */
.csm-progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 0 10px;
    position: relative;
}

.csm-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.csm-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    color: #004279;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-weight: 600;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    font-size: 14px;
}

.csm-step.active .csm-step-circle {
    background: #004279;
    border-color: #004279;
    color: white;
    transform: scale(1.1);
}

.csm-step.completed .csm-step-circle {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

.csm-step-label {
    font-size: 12px;
    color: #004279;
    margin-top: 8px;
    font-weight: 500;
}

.csm-step.active .csm-step-label {
    color: #004279;
    font-weight: 600;
}

.csm-step.completed .csm-step-label {
    color: #10B981;
    font-weight: 600;
}

/* Progress Line */
.csm-progress-line {
    position: absolute;
    top: 16px;
    left: 10px;
    right: 10px;
    height: 2px;
    background: #E2E8F0;
    z-index: 1;
}

.csm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #004279, #0056B3);
    transition: width 0.3s ease;
    border-radius: 1px;
}

/* Form Slides */
.csm-slide {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.csm-slide.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Questions */
.csm-question {
    margin-bottom: 30px;
}

.csm-question h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Options Container */
.csm-options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual Options */
.csm-option {
    position: relative;
    padding: 16px 20px;
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 56px;
}

/* Radio and checkbox options - horizontal layout */
.csm-option:has(input[type="radio"]),
.csm-option:has(input[type="checkbox"]) {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
}

/* Text input options - vertical layout */
.csm-option:has(input[type="text"]),
.csm-option:has(input[type="email"]),
.csm-option:has(input[type="tel"]),
.csm-option:has(input[type="password"]),
.csm-option:has(textarea) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
}

.csm-option:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 66, 121, 0.08);
}

.csm-option input[type="radio"]:checked+label,
.csm-option input[type="checkbox"]:checked+label {
    color: #004279;
    font-weight: 600;
}

.csm-option input[type="radio"]:checked~.csm-option-content,
.csm-option input[type="checkbox"]:checked~.csm-option-content {
    color: #004279;
    font-weight: 600;
}

.csm-option input[type="radio"]:checked {
    background: #004279;
    border-color: #004279;
}

.csm-option input[type="checkbox"]:checked {
    background: #004279;
    border-color: #004279;
}

.csm-option input[type="radio"],
.csm-option input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    margin-right: 16px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    cursor: pointer;
    accent-color: #004279;
    flex-shrink: 0;
    order: 1;
}

.csm-option label {
    cursor: pointer;
    font-size: 15px;
    color: #374151;
    line-height: 1.5;
    margin: 0 !important;
    flex: 1;
    font-weight: 500;
    order: 2;
}

/* Ensure radio and checkbox options maintain horizontal layout */
.csm-option:has(input[type="radio"]),
.csm-option:has(input[type="checkbox"]) {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

.csm-option:has(input[type="radio"]) input[type="radio"],
.csm-option:has(input[type="checkbox"]) input[type="checkbox"] {
    order: 1 !important;
    flex-shrink: 0 !important;
}

.csm-option:has(input[type="radio"]) label,
.csm-option:has(input[type="checkbox"]) label {
    order: 2 !important;
    flex: 1 !important;
}

/* Fallback for browsers that don't support :has() */
.csm-option input[type="radio"]+label,
.csm-option input[type="checkbox"]+label {
    order: 2 !important;
    flex: 1 !important;
}

/* Force horizontal layout for radio/checkbox containers */
.csm-options-container .csm-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

/* Fallback for browsers without :has() support */
.csm-option input[type="radio"]+label,
.csm-option input[type="checkbox"]+label {
    order: 2 !important;
    flex: 1 !important;
}

/* Text input fallback - vertical layout */
.csm-option input[type="text"],
.csm-option input[type="email"],
.csm-option input[type="tel"],
.csm-option input[type="password"],
.csm-option textarea {
    order: 2 !important;
    margin-top: 8px !important;
}

.csm-option label:has(+ input[type="text"]),
.csm-option label:has(+ input[type="email"]),
.csm-option label:has(+ input[type="tel"]),
.csm-option label:has(+ input[type="password"]),
.csm-option label:has(+ textarea) {
    order: 1 !important;
    margin-bottom: 8px !important;
}

/* Email, Phone and Validation Code input styles */
.csm-option input[type="email"],
.csm-option input[type="phone"],
input.csm-input[type="email"],
input.csm-input[type="phone"],
.csm-option input[type="validation_code"],
input.csm-input[type="validation_code"] {
    width: 100%;
    max-width: 400px;
    padding: 14px 16px;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    font-size: 15px;
    margin-top: 8px;
    display: block;
    box-sizing: border-box;
    background: #FFFFFF;
    transition: all 0.2s ease;
    font-family: inherit;
}

.csm-option input[type="email"]:focus,
.csm-option input[type="phone"]:focus,
input.csm-input[type="email"]:focus,
input.csm-input[type="phone"]:focus,
.csm-option input[type="validation_code"]:focus,
input.csm-input[type="validation_code"]:focus {
    border-color: #004279;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 66, 121, 0.1);
    transform: translateY(-1px);
}

/* Specific styling for email and phone fields */
.csm-email-field,
.csm-phone-field,
.csm-code-field {
    display: flex !important;
    flex-direction: column !important;
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.csm-email-field label,
.csm-phone-field label,
.csm-code-field label {
    order: 1;
    margin-bottom: 12px;
    margin-top: 0;
    font-weight: 600;
    color: #1E293B;
    font-size: 15px;
}

.csm-email-field input,
.csm-phone-field input,
.csm-code-field input {
    order: 2;
    margin-top: 0;
    margin-bottom: 0;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 15px;
    background: #F8FAFC;
}

.csm-email-field input:focus,
.csm-phone-field input:focus,
.csm-code-field input:focus {
    background: #FFFFFF;
    border-color: #004279;
    box-shadow: 0 0 0 3px rgba(0, 66, 121, 0.1);
}

.csm-email-field .csm-validation-message,
.csm-phone-field .csm-validation-message,
.csm-code-field .csm-validation-message {
    order: 3;
    margin-top: 8px;
    margin-bottom: 0;
}

/* Specific phone input styles */
.csm-option input[type="tel"] {
    min-width: 400px;
    width: 400px;
}

/* Navigation Buttons */
.csm-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #E2E8F0;
    margin-top: auto;
}

.csm-prev,
.csm-next,
.csm-submit-button {
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    text-align: center;
    font-family: inherit;
}

.csm-prev {
    background: #F8FAFC;
    color: #004279;
    border: 2px solid #E2E8F0;
}

.csm-prev:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
    color: #475569;
    transform: translateY(-1px);
}

.csm-next {
    background: #004279;
    color: white;
    border: 2px solid #004279;
}

.csm-next:hover {
    background: #003366;
    border-color: #003366;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 66, 121, 0.3);
}

.csm-submit-button {
    background: #10B981;
    color: white;
    border: 2px solid #10B981;
    /* Always visible - JavaScript controls when to show/hide */
}

.csm-submit-button:hover {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Loading animation for verify button */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Validation Message */
.csm-validation-message {
    margin-top: 8px;
    padding: 10px 14px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 8px;
    color: #DC2626;
    font-size: 13px;
    font-weight: 500;
    min-height: 0;
}

.csm-validation-message.success {
    background: #F0FDF4;
    border-color: #BBF7D0;
    color: #16A34A;
}

/* Hide empty validation messages */
.csm-validation-message:empty {
    display: none;
}

/* Thank You Message */
.csm-thank-you-message {
    text-align: center;
    padding: 50px 30px;
    font-size: 18px;
    line-height: 1.6;
    color: #1E293B;
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    border-radius: 16px;
    margin: 20px 0;
    border: 2px solid #E2E8F0;
}

.csm-thank-you-message h3 {
    color: #004279;
    font-size: 24px;
    margin-bottom: 16px;
    font-weight: 700;
}

/* Success Message */
.csm-success-message {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border: 2px solid #BBF7D0;
    border-radius: 16px;
    margin: 20px 0;
}

.csm-success-message h3 {
    font-size: 22px;
    color: #16A34A;
    margin-bottom: 12px;
    font-weight: 700;
}

.csm-success-message p {
    color: #166534;
    font-size: 15px;
    margin: 0;
}

/* SMS Verification Styles */
.csm-verification-status {
    margin: 20px 0;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #004279;
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    border: 1px solid #E2E8F0;
}

.csm-verification-status.csm-verified {
    border-left-color: #10B981;
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border-color: #BBF7D0;
}

.csm-status-message {
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 15px;
}

.csm-status-message.success {
    color: #10B981;
}

.csm-status-message.error {
    color: #DC2626;
}

.csm-verification-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.csm-send-code-btn,
.csm-verify-code-btn,
.csm-resend-code-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid #004279;
    background: #004279;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.csm-send-code-btn:hover,
.csm-verify-code-btn:hover,
.csm-resend-code-btn:hover {
    background: #003366;
    border-color: #003366;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 66, 121, 0.3);
}

.csm-send-code-btn:disabled,
.csm-verify-code-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.csm-code-field {
    display: none;
}

.csm-code-field.show {
    display: block;
}

/* Form verification state - removed green styling */

/* Mobile Optimizations */
@media (max-width: 768px) {
    .csm-form-container {
        padding: 20px 15px;
        margin: 10px;
        border-radius: 12px;
    }

    .csm-question h3 {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .csm-option {
        padding: 14px 16px;
        min-height: 50px;
    }

    .csm-option label {
        font-size: 14px;
    }

    .csm-prev,
    .csm-next,
    .csm-submit-button {
        padding: 12px 20px;
        font-size: 14px;
        min-width: 100px;
    }

    .csm-navigation {
        flex-direction: column;
        gap: 12px;
    }

    .csm-navigation>* {
        width: 100%;
    }

    .csm-option input[type="tel"] {
        min-width: 100%;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .csm-form-container {
        padding: 15px 10px;
        margin: 5px;
    }

    .csm-question h3 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .csm-option {
        padding: 12px 14px;
        min-height: 48px;
    }

    .csm-option label {
        font-size: 13px;
    }

    .csm-prev,
    .csm-next,
    .csm-submit-button {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 90px;
    }

    .csm-verification-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .csm-send-code-btn,
    .csm-verify-code-btn,
    .csm-resend-code-btn {
        justify-content: center;
    }
}