/* Frontend Styles for Espace Custom Form */

.ecf-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.ecf-form {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ecf-field-container {
    margin-bottom: 25px;
}

.ecf-field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.ecf-required {
    color: #e74c3c;
    font-weight: normal;
}

.ecf-field-input,
.ecf-field-textarea,
.ecf-field-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.ecf-field-input:focus,
.ecf-field-textarea:focus,
.ecf-field-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

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

.ecf-field-select {
    background-image: url('data:image/svg+xml;charset=utf-8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"%3E%3Cpath fill="%23666" d="M4 6l4 4 4-4z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

.ecf-radio-option,
.ecf-checkbox-option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.ecf-field-radio,
.ecf-field-checkbox {
    margin-right: 10px;
    margin-top: 0;
}

.ecf-radio-option label,
.ecf-checkbox-option label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

.ecf-field-file {
    padding: 8px;
    border: 2px dashed #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    transition: border-color 0.3s ease;
}

.ecf-field-file:hover {
    border-color: #2271b1;
}

.ecf-field-date,
.ecf-field-number {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.ecf-field-date:focus,
.ecf-field-number:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.ecf-field-description {
    margin-top: 5px;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.ecf-submit-container {
    text-align: center;
    margin-top: 30px;
}

.ecf-submit-btn {
    background: #9164ff;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.ecf-submit-btn:hover {
    background: #7648f4;
}

.ecf-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ecf-messages {
    margin-top: 20px;
}

.ecf-success-message,
.ecf-error-message {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.ecf-success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ecf-error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ecf-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ecf-loading .ecf-submit-btn::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: ecf-spin 1s linear infinite;
}

@keyframes ecf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Field Validation States */

.ecf-field-error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
}

.ecf-field-success {
    border-color: #27ae60 !important;
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2) !important;
}

/* Responsive Design */

@media (max-width: 768px) {
    .ecf-form-container {
        padding: 10px;
    }
    
    .ecf-form {
        padding: 20px;
    }
    
    .ecf-field-input,
    .ecf-field-textarea,
    .ecf-field-select,
    .ecf-field-date,
    .ecf-field-number {
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .ecf-submit-btn {
        width: 100%;
        padding: 15px;
        font-size: 16px;
    }
    
    .ecf-radio-option,
    .ecf-checkbox-option {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ecf-field-radio,
    .ecf-field-checkbox {
        margin-bottom: 5px;
    }
}

@media (max-width: 480px) {
    .ecf-form {
        padding: 15px;
    }
    
    .ecf-field-container {
        margin-bottom: 20px;
    }
    
    .ecf-field-label {
        font-size: 13px;
    }
}

/* Dark Mode Support */

@media (prefers-color-scheme: dark) {
    .ecf-form {
        background: #1a1a1a;
        border-color: #333;
        color: #fff;
    }
    
    .ecf-field-label {
        color: #fff;
    }
    
    .ecf-field-input,
    .ecf-field-textarea,
    .ecf-field-select,
    .ecf-field-date,
    .ecf-field-number {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .ecf-field-input:focus,
    .ecf-field-textarea:focus,
    .ecf-field-select:focus,
    .ecf-field-date:focus,
    .ecf-field-number:focus {
        border-color: #4a9eff;
        box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
    }
    
    .ecf-field-file {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .ecf-field-description {
        color: #ccc;
    }
    
    .ecf-submit-btn {
        background: #4a9eff;
    }
    
    .ecf-submit-btn:hover {
        background: #3a8eef;
    }
}