/* =========================================
   BCE FORMS MODERN STYLE
   Version: 2.3.0 (Fix Mobile Padding)
   Prefix: .bce-
   ========================================= */

/* 1. Font & Variables */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.bce-form-container {
    /* Color Palette */
    --bce-gradient-accent: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    --bce-gradient-hover: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
    --bce-bg-body: #F3F4F6;
    --bce-bg-card: #FFFFFF;
    --bce-bg-input: #F9FAFB;
    --bce-text-heading: #111827;
    --bce-text-body: #374151;
    
    /* Structure */
    --bce-radius-input: 10px;
    --bce-radius-card: 16px;
    --bce-shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    --bce-shadow-btn: 0 4px 12px rgba(124, 58, 237, 0.25);
    
    /* Focus States */
    --bce-focus-border: #7C3AED;
    --bce-focus-ring: rgba(124, 58, 237, 0.1);

    /* Base Settings */
    font-family: 'Inter', sans-serif;
    color: var(--bce-text-body);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    box-sizing: border-box;
    
    /* FIX LỖI MOBILE: Thêm padding để không dính sát lề */
    padding-left: 15px;
    padding-right: 15px;
}

.bce-form-container * {
    box-sizing: border-box;
}

/* 2. Layout & Typography */
.bce-form-group {
    margin-bottom: 1.5rem;
    width: 100%;
}

.bce-form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bce-text-heading);
    line-height: 1.4;
}

.bce-form-label .required {
    color: #DC2626;
    margin-left: 3px;
}

/* 3. Input Fields - CỐ ĐỊNH CHIỀU CAO */
.bce-form-input, 
.bce-form-select, 
.bce-form-textarea {
    width: 100%;
    height: 48px;
    padding: 0 1rem;
    border: 1px solid #E5E7EB;
    border-radius: var(--bce-radius-input);
    background-color: var(--bce-bg-input);
    color: var(--bce-text-heading);
    font-size: 15px;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: normal;
    display: block;
}

.bce-form-textarea {
    height: auto;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
    min-height: 100px;
}

.bce-form-input:focus, 
.bce-form-select:focus, 
.bce-form-textarea:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--bce-focus-border);
    box-shadow: 0 0 0 4px var(--bce-focus-ring);
}

/* 4. Custom Select Dropdown */
.bce-select-wrapper {
    position: relative;
    width: 100%;
}

.bce-form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.bce-form-select:invalid {
    color: #9CA3AF;
}

/* 5. Custom Checkbox */
.bce-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bce-checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    margin: 0;
}

.bce-checkbox-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.bce-checkmark {
    position: relative;
    height: 20px;
    width: 20px;
    background-color: var(--bce-bg-input);
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    margin-right: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.bce-checkbox-item:hover .bce-checkmark {
    border-color: var(--bce-focus-border);
}

.bce-checkbox-item input:checked ~ .bce-checkmark {
    background-image: var(--bce-gradient-accent);
    border-color: transparent;
}

.bce-checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.bce-checkbox-item input:checked ~ .bce-checkmark:after {
    display: block;
}

/* 6. Buttons */
.bce-btn {
    width: 100%;
    height: 48px;
    padding: 0 1.5rem;
    background-image: var(--bce-gradient-accent);
    color: white;
    border: none;
    border-radius: var(--bce-radius-input);
    font-weight: 600;
    font-size: 15px; 
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--bce-shadow-btn);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
}

.bce-btn:hover {
    background-image: var(--bce-gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(124, 58, 237, 0.35);
    color: white;
}

.bce-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* 7. Newsletter Mode (Inline Layout) */
.bce-form-container.newsletter-mode form {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

/* Wrapper của ô Input trong chế độ newsletter */
.bce-form-container.newsletter-mode .bce-form-group {
    flex: 1; 
    min-width: 0;
    margin-bottom: 0;
}

/* Nút bấm trong chế độ newsletter */
.bce-form-container.newsletter-mode .bce-btn {
    width: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

/* FIX LỖI MOBILE CHO NEWSLETTER 
   Khi màn hình nhỏ, chuyển về dạng cột dọc 
*/
@media (max-width: 480px) {
    .bce-form-container.newsletter-mode form {
        flex-direction: column;
        gap: 10px; /* Khoảng cách giữa input và nút khi xếp dọc */
    }
    .bce-form-container.newsletter-mode .bce-btn {
        width: 100%; /* Nút bấm full chiều ngang */
    }
}

/* 8. Messages & Validation */
.bce-form-message {
    font-size: 0.95rem;
    line-height: 1.5;
}
.bce-form-message.success {
    background-color: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}
.bce-form-message.error {
    background-color: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.bce-validation-message {
    color: #DC2626;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

.bce-form-input.bce-form-field-error,
.bce-form-select.bce-form-field-error {
    border-color: #DC2626;
    background-color: #FEF2F2;
}