/**
 * OFAP Form Builder - Public Form Styles
 */

.ofap-form-wrapper {
    --ofap-primary: #ED1C25;
    --ofap-primary-hover: #c91820;
    --ofap-secondary: #2D2A4E;
    --ofap-secondary-hover: #ffe0cc;
    --ofap-accent: #22AF9E;
    --ofap-bg: #FFEBDE;
    --ofap-option-hover: #d4d3de;
    --ofap-option-bg-hover: #ffffff;
    --ofap-white: #ffffff;
    --ofap-gray-100: #f3f4f6;
    --ofap-gray-200: #e5e7eb;
    --ofap-gray-400: #9ca3af;
    --ofap-gray-500: #6b7280;
    --ofap-gray-700: #374151;
    --ofap-radius: 12px;
    --ofap-radius-lg: 20px;
    --ofap-shadow: 0 8px 32px rgba(45, 42, 78, 0.12);
    --ofap-transition: cubic-bezier(0.4, 0, 0.2, 1);
    --ofap-title-font: 'DM Sans', sans-serif;
    --ofap-body-font: 'DM Sans', sans-serif;
    --ofap-title-size: 24px;
    --ofap-title-weight: 600;
    --ofap-label-size: 13px;
    --ofap-input-size: 15px;
    font-family: var(--ofap-body-font);
    line-height: 1.5;
}

.ofap-form-wrapper * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.ofap-form-container {
    max-width: 520px;
    margin: 0 auto;
    background: var(--ofap-white);
    border-radius: var(--ofap-radius-lg);
    box-shadow: var(--ofap-shadow);
    overflow: hidden;
}

/* Header */
.ofap-form-header {
    background: var(--ofap-primary);
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
}

.ofap-form-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.ofap-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.ofap-logo-icon {
    width: 48px;
    height: 48px;
    color: var(--ofap-white);
}

.ofap-logo-text {
    color: var(--ofap-white);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.ofap-logo-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Progress */
.ofap-progress {
    padding: 24px 32px 0;
}

.ofap-progress-bar {
    height: 4px;
    background: var(--ofap-bg);
    border-radius: 2px;
    overflow: hidden;
}

.ofap-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ofap-primary), #FE4A4A);
    border-radius: 2px;
    transition: width 0.5s var(--ofap-transition);
}

.ofap-progress-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

.ofap-progress-step {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ofap-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    background: var(--ofap-bg);
    color: var(--ofap-gray-500);
    transition: all 0.3s ease;
}

.ofap-progress-step.active .ofap-step-num {
    background: var(--ofap-primary);
    color: white;
}

.ofap-progress-step.completed .ofap-step-num {
    background: var(--ofap-accent);
    color: white;
}

/* Content */
.ofap-form-content {
    padding: 32px;
    position: relative;
    min-height: 320px;
}

/* Steps */
.ofap-step {
    display: none;
    animation: fadeSlideIn 0.4s var(--ofap-transition);
}

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

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ofap-step-title {
    font-family: var(--ofap-title-font);
    font-size: var(--ofap-title-size);
    font-weight: var(--ofap-title-weight, 600);
    color: var(--ofap-secondary);
    margin-bottom: 8px;
}

.ofap-step-subtitle {
    font-family: var(--ofap-body-font);
    color: var(--ofap-gray-500);
    font-size: 14px;
    margin-bottom: 24px;
}

/* Fields */
.ofap-fields {
    margin-bottom: 8px;
}

.ofap-field-group {
    margin-bottom: 20px;
}

.ofap-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ofap-field-row .ofap-field-group {
    margin-bottom: 0;
}

.ofap-label {
    display: block;
    font-family: var(--ofap-body-font);
    font-size: var(--ofap-label-size);
    font-weight: 500;
    color: var(--ofap-secondary);
    margin-bottom: 8px;
}

.ofap-input {
    width: 100%;
    padding: 14px 18px;
    font-family: var(--ofap-body-font);
    font-size: var(--ofap-input-size, 15px);
    color: var(--ofap-secondary);
    background: #fafbfc;
    border: 2px solid var(--ofap-gray-200);
    border-radius: var(--ofap-radius);
    transition: all 0.3s ease;
}

.ofap-input:focus {
    outline: none;
    border-color: var(--ofap-primary);
    background: var(--ofap-white);
    box-shadow: 0 0 0 4px rgba(237, 28, 37, 0.08);
}

.ofap-input::placeholder {
    color: var(--ofap-gray-400);
}

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

.ofap-phone-wrap {
    position: relative;
}

.ofap-phone-prefix {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ofap-gray-500);
    font-size: 15px;
    font-weight: 500;
}

.ofap-input.has-prefix {
    padding-left: 58px;
}

/* Radio Cards */
.ofap-options-grid {
    display: grid;
    gap: 12px;
}

.ofap-options-grid.ofap-options-horizontal {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 560px) {
    .ofap-options-grid.ofap-options-horizontal {
        grid-template-columns: 1fr;
    }
}

.ofap-option-card {
    position: relative;
}

.ofap-option-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.ofap-option-label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #fafbfc;
    border: 2px solid var(--ofap-gray-200);
    border-radius: var(--ofap-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.ofap-option-label:hover {
    border-color: var(--ofap-option-hover);
    background: var(--ofap-option-bg-hover);
}

.ofap-option-card input:checked + .ofap-option-label {
    border-color: var(--ofap-primary);
    background: rgba(237, 28, 37, 0.03);
}

.ofap-option-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ofap-bg);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ofap-option-card input:checked + .ofap-option-label .ofap-option-icon {
    background: var(--ofap-primary);
}

.ofap-option-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--ofap-primary);
    stroke-width: 2;
    fill: none;
}

.ofap-option-card input:checked + .ofap-option-label .ofap-option-icon svg {
    stroke: white;
}

.ofap-option-text {
    flex: 1;
}

.ofap-option-title {
    font-weight: 500;
    color: var(--ofap-secondary);
    font-size: 14px;
}

.ofap-option-desc {
    font-size: 12px;
    color: var(--ofap-gray-500);
    margin-top: 2px;
}

.ofap-option-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--ofap-gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ofap-option-card input:checked + .ofap-option-label .ofap-option-check {
    border-color: var(--ofap-primary);
    background: var(--ofap-primary);
}

.ofap-option-check svg {
    width: 12px;
    height: 12px;
    stroke: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.ofap-option-card input:checked + .ofap-option-label .ofap-option-check svg {
    opacity: 1;
    transform: scale(1);
}

/* Radio & Checkbox groups */
.ofap-radio-group,
.ofap-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ofap-radio,
.ofap-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ofap-gray-700);
}

.ofap-radio input,
.ofap-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--ofap-primary);
}

/* Actions */
.ofap-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.ofap-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--ofap-radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.ofap-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

.ofap-btn-primary {
    background: var(--ofap-primary);
    color: var(--ofap-white);
    box-shadow: 0 4px 14px rgba(237, 28, 37, 0.3);
}

.ofap-btn-primary:hover {
    background: var(--ofap-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(237, 28, 37, 0.35);
}

.ofap-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ofap-btn-primary svg {
    stroke: white;
    fill: none;
}

.ofap-btn-secondary {
    background: var(--ofap-bg);
    color: var(--ofap-secondary);
}

.ofap-btn-secondary:hover {
    background: var(--ofap-secondary-hover);
}

.ofap-btn-secondary svg {
    stroke: var(--ofap-secondary);
    fill: none;
}

/* Success */
.ofap-success-step {
    text-align: center;
    padding: 20px 0;
}

.ofap-success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ofap-accent), #2bc4b0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: successPop 0.5s var(--ofap-transition);
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.ofap-success-icon svg {
    width: 40px;
    height: 40px;
    stroke: white;
}

.ofap-success-title {
    font-size: 26px;
    font-weight: 600;
    color: var(--ofap-secondary);
    margin-bottom: 12px;
}

.ofap-success-message {
    color: var(--ofap-gray-500);
    font-size: 15px;
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto;
}

/* Layout fields */
.ofap-field-heading {
    font-size: 18px;
    font-weight: 600;
    color: var(--ofap-secondary);
    margin-bottom: 8px;
}

.ofap-field-paragraph {
    font-size: 14px;
    color: var(--ofap-gray-500);
    line-height: 1.6;
}

.ofap-field-divider {
    border: none;
    border-top: 1px solid var(--ofap-gray-200);
    margin: 16px 0;
}

/* Error state */
.ofap-input.error {
    border-color: #ef4444;
}

.ofap-error-msg {
    color: #ef4444;
    font-size: 12px;
    margin-top: 6px;
}

/* Loading */
.ofap-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 560px) {
    .ofap-form-container {
        border-radius: 16px;
    }

    .ofap-form-header {
        padding: 24px;
    }

    .ofap-progress {
        padding: 20px 24px 0;
    }

    .ofap-form-content {
        padding: 24px;
    }

    .ofap-field-row {
        grid-template-columns: 1fr;
    }

    .ofap-step-title {
        font-size: 22px;
    }

    .ofap-btn {
        padding: 14px 20px;
        font-size: 14px;
    }

    .ofap-logo-text {
        font-size: 24px;
    }
}
