/* Ezy Contact Forms - Modern Frontend Styles */

:root {
    --ecf-primary: #6366f1;
    --ecf-primary-hover: #4f46e5;
    --ecf-primary-light: #eef2ff;
    --ecf-success: #10b981;
    --ecf-danger: #ef4444;
    --ecf-text: #1f2937;
    --ecf-text-light: #6b7280;
    --ecf-text-muted: #9ca3af;
    --ecf-bg: #ffffff;
    --ecf-bg-secondary: #f9fafb;
    --ecf-border: #e5e7eb;
    --ecf-radius: 12px;
    --ecf-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

.ecf-form-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.ecf-form-container * {
    box-sizing: border-box;
}

/* Form Wrapper */
.ecf-form {
    background: var(--ecf-bg);
    border-radius: var(--ecf-radius);
    padding: 40px;
    box-shadow: var(--ecf-shadow);
    position: relative;
    overflow: hidden;
}

.ecf-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ecf-primary), #a855f7, #ec4899);
}

/* Form Header */
.ecf-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.ecf-form-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--ecf-text);
    margin: 0 0 8px;
}

.ecf-form-desc {
    font-size: 16px;
    color: var(--ecf-text-light);
    margin: 0;
}

/* Fields */
.ecf-field {
    margin-bottom: 24px;
}

.ecf-field-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ecf-text);
    margin-bottom: 8px;
}

.ecf-field-label .required {
    color: var(--ecf-danger);
    margin-left: 4px;
}

.ecf-input,
.ecf-textarea,
.ecf-select {
    width: 100%;
    padding: 14px 18px;
    font-size: 15px;
    color: var(--ecf-text);
    background: var(--ecf-bg-secondary);
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
}

.ecf-input::placeholder,
.ecf-textarea::placeholder {
    color: var(--ecf-text-muted);
}

.ecf-input:hover,
.ecf-textarea:hover,
.ecf-select:hover {
    background: #f3f4f6;
}

.ecf-input:focus,
.ecf-textarea:focus,
.ecf-select:focus {
    background: var(--ecf-bg);
    border-color: var(--ecf-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.ecf-textarea {
    min-height: 140px;
    resize: vertical;
}

.ecf-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 48px;
    cursor: pointer;
}

.ecf-field-desc {
    font-size: 13px;
    color: var(--ecf-text-muted);
    margin-top: 8px;
}

/* Checkbox & Radio */
.ecf-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ecf-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--ecf-bg-secondary);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.ecf-option:hover {
    background: #f3f4f6;
}

.ecf-option input {
    width: 20px;
    height: 20px;
    accent-color: var(--ecf-primary);
}

.ecf-option span {
    font-size: 15px;
    color: var(--ecf-text);
}

/* Math Challenge */
.ecf-math {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, var(--ecf-primary-light), #faf5ff);
    border-radius: var(--ecf-radius);
    margin-bottom: 24px;
}

.ecf-math-icon {
    width: 50px;
    height: 50px;
    background: var(--ecf-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.ecf-math-content {
    flex: 1;
}

.ecf-math-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ecf-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ecf-math-question {
    font-size: 20px;
    font-weight: 700;
    color: var(--ecf-text);
}

.ecf-math-input {
    width: 80px;
    padding: 12px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--ecf-border);
    border-radius: 10px;
    background: var(--ecf-bg);
    transition: all 0.2s;
}

.ecf-math-input:focus {
    border-color: var(--ecf-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

/* Submit Button */
.ecf-submit {
    width: 100%;
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--ecf-primary), var(--ecf-primary-hover));
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.ecf-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.ecf-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.ecf-submit:hover::before {
    left: 100%;
}

.ecf-submit:active {
    transform: translateY(0);
}

.ecf-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ecf-submit .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

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

/* Honeypot */
.ecf-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* Error State */
.ecf-field.has-error .ecf-input,
.ecf-field.has-error .ecf-textarea,
.ecf-field.has-error .ecf-select {
    border-color: var(--ecf-danger);
    background: #fef2f2;
}

.ecf-field-error {
    color: var(--ecf-danger);
    font-size: 13px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================
   SUCCESS STATE - Form Hidden, Show Message
   ========================================== */

.ecf-form.submitted {
    display: none;
}

.ecf-success-wrapper {
    display: none;
}

.ecf-success-wrapper.show {
    display: block;
    animation: fadeInUp 0.5s ease;
}

.ecf-success {
    background: var(--ecf-bg);
    border-radius: var(--ecf-radius);
    padding: 60px 40px;
    box-shadow: var(--ecf-shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ecf-success-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: successPop 0.5s ease 0.2s both;
}

.ecf-success-icon svg {
    width: 50px;
    height: 50px;
    stroke: #fff;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkmark 0.5s ease 0.5s forwards;
}

.ecf-success-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--ecf-text);
    margin: 0 0 12px;
    animation: fadeInUp 0.5s ease 0.3s both;
}

.ecf-success-message {
    font-size: 16px;
    color: var(--ecf-text-light);
    margin: 0 0 24px;
    animation: fadeInUp 0.5s ease 0.4s both;
}

.ecf-success-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ecf-primary);
    background: var(--ecf-primary-light);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    animation: fadeInUp 0.5s ease 0.5s both;
}

.ecf-success-btn:hover {
    background: var(--ecf-primary);
    color: #fff;
}

/* Redirect Countdown */
.ecf-redirect-notice {
    margin-top: 24px;
    animation: fadeInUp 0.5s ease 0.5s both;
}

.ecf-redirect-notice p {
    font-size: 14px;
    color: var(--ecf-text-light);
    margin: 0 0 12px;
}

.ecf-countdown {
    font-weight: 700;
    color: var(--ecf-primary);
    font-size: 18px;
}

.ecf-redirect-bar {
    width: 200px;
    height: 6px;
    background: var(--ecf-bg-secondary);
    border-radius: 3px;
    margin: 0 auto;
    overflow: hidden;
}

.ecf-redirect-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--ecf-primary), #a855f7);
    border-radius: 3px;
    width: 0%;
}

@keyframes ecf-progress {
    from { width: 0%; }
    to { width: 100%; }
}

/* Confetti Canvas */
#ecf-confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes checkmark {
    to {
        stroke-dashoffset: 0;
    }
}

/* Message (Error) */
.ecf-message {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeInUp 0.3s ease;
}

.ecf-message-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.ecf-message-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 640px) {
    .ecf-form {
        padding: 24px;
    }
    
    .ecf-form-title {
        font-size: 22px;
    }
    
    .ecf-math {
        flex-direction: column;
        text-align: center;
    }
    
    .ecf-success {
        padding: 40px 24px;
    }
}

/* Themes */
.ecf-form-container.theme-ocean {
    --ecf-primary: #0ea5e9;
    --ecf-primary-hover: #0284c7;
    --ecf-primary-light: #e0f2fe;
}

.ecf-form-container.theme-forest {
    --ecf-primary: #22c55e;
    --ecf-primary-hover: #16a34a;
    --ecf-primary-light: #dcfce7;
}

.ecf-form-container.theme-sunset {
    --ecf-primary: #f97316;
    --ecf-primary-hover: #ea580c;
    --ecf-primary-light: #ffedd5;
}

.ecf-form-container.theme-rose {
    --ecf-primary: #ec4899;
    --ecf-primary-hover: #db2777;
    --ecf-primary-light: #fce7f3;
}
