/**
 * Contact Form Widget — Stylesheet
 * File: assets/css/contact-form.css
 *
 * Enqueue handle: ce-contact-form-css
 * Registered in: your main plugin file or helpers
 */

/* ══════════════════════════════════════════════════════════════
   FORM WRAPPER
   ══════════════════════════════════════════════════════════════ */
.cf-form-wrap {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    font-family: inherit;
}

.cf-form-wrap *,
.cf-form-wrap *::before,
.cf-form-wrap *::after {
    box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════
   FORM HEADER (Title + Subtitle)
   ══════════════════════════════════════════════════════════════ */
.cf-header {
    margin-bottom: 24px;
}

.cf-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
    line-height: 1.3;
}

.cf-subtitle {
    font-size: 14px;
    color: #888;
    margin: 0;
    line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════
   LAYOUT — Dynamic Grid
   ══════════════════════════════════════════════════════════════ */
.cf-fields-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.cf-field-group {
    padding: 0 10px;
    margin-bottom: 20px;
    width: 100%;
}

/* ── Width Classes ── */
.cf-width-100 { width: 100%; }
.cf-width-80  { width: 80%; }
.cf-width-75  { width: 75%; }
.cf-width-66  { width: 66.66%; }
.cf-width-60  { width: 60%; }
.cf-width-50  { width: 50%; }
.cf-width-40  { width: 40%; }
.cf-width-33  { width: 33.33%; }
.cf-width-25  { width: 25%; }
.cf-width-20  { width: 20%; }

/* ── Radio & Checkbox Groups ── */
.cf-radio-group,
.cf-checkbox-group {
    display: flex;
    gap: 12px;
    margin-top: 5px;
}

.cf-layout-vertical {
    flex-direction: column;
}

.cf-layout-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
}

.cf-radio-option,
.cf-checkbox-option,
.cf-acceptance-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #444;
    padding: 6px 0;
}

/* ── Hide Native Inputs ── */
.cf-radio-option input,
.cf-checkbox-option input,
.cf-acceptance-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* ── Custom Box/Circle ── */
.cf-radio-option label,
.cf-checkbox-option label,
.cf-acceptance-option label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cf-radio-option label::before,
.cf-checkbox-option label::before,
.cf-acceptance-option label::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    background: #fff;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

/* Radio: Circle */
.cf-radio-option label::before {
    border-radius: 50%;
}

/* Checkbox: Rounded Square */
.cf-checkbox-option label::before,
.cf-acceptance-option label::before {
    border-radius: 4px;
}

/* ── Checked State ── */
.cf-radio-option input:checked + label::before,
.cf-checkbox-option input:checked + label::before,
.cf-acceptance-option input:checked + label::before {
    border-color: #b5865a;
}

/* Radio Dot */
.cf-radio-option label::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b5865a;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cf-radio-option input:checked + label::after {
    transform: translateY(-50%) scale(1);
}

/* Checkbox Tick */
.cf-checkbox-option label::after,
.cf-acceptance-option label::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    transform: translateY(-55%) rotate(45deg) scale(0);
    width: 5px;
    height: 10px;
    border: solid #b5865a;
    border-width: 0 2px 2px 0;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cf-checkbox-option input:checked + label::after,
.cf-acceptance-option input:checked + label::after {
    transform: translateY(-55%) rotate(45deg) scale(1);
}

/* ── Hover Effects ── */
.cf-radio-option:hover label::before,
.cf-checkbox-option:hover label::before,
.cf-acceptance-option:hover label::before {
    border-color: #b5865a;
}

/* ── Custom Select ── */
.cf-select-custom {
    position: relative;
    width: 100%;
    user-select: none;
}

.cf-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.2s ease;
}

.cf-select-trigger:hover {
    border-color: #b5865a;
}

.cf-select-custom.cf-open .cf-select-trigger {
    border-color: #b5865a;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.cf-select-arrow {
    width: 10px;
    height: 10px;
    border-right: 2px solid #999;
    border-bottom: 2px solid #999;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.2s ease;
    margin-left: 10px;
}

.cf-select-custom.cf-open .cf-select-arrow {
    transform: translateY(2px) rotate(-135deg);
}

.cf-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #b5865a;
    border-top: none;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cf-select-custom.cf-open .cf-select-options {
    display: block;
}

.cf-select-options li {
    padding: 10px 16px;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.cf-select-options li:hover {
    /* Styles now controlled via Elementor settings */
}

.cf-select-options li.cf-selected {
    /* Styles now controlled via Elementor settings */
}

/* ── HTML Content ── */
.cf-html-content {
    margin-bottom: 20px;
    width: 100%;
}

/* ══════════════════════════════════════════════════════════════
   FIELD GROUPS
   ══════════════════════════════════════════════════════════════ */
.cf-field-group {
    /* Margin handled by Elementor settings */
}

/* ── Labels ── */
.cf-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.4;
}

.cf-required {
    color: #e74c3c;
    margin-left: 3px;
}

/* ── Base Input / Select / Textarea ── */
.cf-input,
.cf-select,
.cf-textarea {
    display: block;
    width: 100%;
    font-size: 14px;
    color: #333;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 12px 16px;
    line-height: 1.5;
    font-family: inherit;
    transition: border-color 0.2s ease, background 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
}

/* ── Select custom arrow ── */
.cf-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ── Focus state ── */
.cf-input:focus,
.cf-select:focus,
.cf-textarea:focus {
    outline: none;
    border-color: #b5865a;
    background: #fafafa;
}

/* ── Textarea ── */
.cf-textarea {
    resize: vertical;
    min-height: 120px;
}

/* ══════════════════════════════════════════════════════════════
   CHECKBOX
   ══════════════════════════════════════════════════════════════ */
.cf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #444;
    line-height: 1.4;
}

.cf-checkbox {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #b5865a;
}

/* ══════════════════════════════════════════════════════════════
   FIELD VALIDATION ERROR
   ══════════════════════════════════════════════════════════════ */
.cf-field-error {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 5px;
    min-height: 16px;
    line-height: 1.3;
}

.cf-has-error .cf-input,
.cf-has-error .cf-select,
.cf-has-error .cf-textarea {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.10);
}

/* ══════════════════════════════════════════════════════════════
   SUBMIT BUTTON
   ══════════════════════════════════════════════════════════════ */
.cf-btn-wrap {
    margin-top: 8px;
}

.cf-submit-btn {
    display: inline-block;
    padding: 14px 36px;
    background: #b5865a;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.cf-submit-btn:hover {
    background: #9a7048;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(181, 134, 90, 0.3);
}

.cf-submit-btn:active {
    transform: none;
    box-shadow: none;
}

.cf-submit-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

/* Full-width button when alignment is set to full */
.cf-btn-wrap.cf-btn-full .cf-submit-btn {
    display: block;
    width: 100%;
    text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   STATUS MESSAGES (Success / Error)
   ══════════════════════════════════════════════════════════════ */
.cf-msg {
    display: none;
    padding: 14px 18px;
    border-radius: 5px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.cf-msg-success {
    background: #d4edda;
    color: #1a7a4a;
    border: 1px solid #c3e6cb;
}

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

/* ══════════════════════════════════════════════════════════════
   LOADING SPINNER (shown on submit)
   ══════════════════════════════════════════════════════════════ */
.cf-submit-btn.cf-loading {
    position: relative;
    padding-left: 42px;
}

.cf-submit-btn.cf-loading::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cf-spin 0.7s linear infinite;
}

@keyframes cf-spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 580px) {
    .cf-field-group[class*="cf-width-"] {
        width: 100% !important;
    }

    .cf-submit-btn {
        display: block;
        width: 100%;
        text-align: center;
    }
}
