/* Callback Form - Frontend */
.callback-form-wrapper { width: 100%; box-sizing: border-box; padding: 0; }
.callback-form-wrapper * { box-sizing: border-box; }
.callback-form { width: 100%; }

.cf-form-row { display: flex; flex-wrap: nowrap; gap: 10px; width: 100%; align-items: flex-start; }
.cf-field { min-width: 0; }

.callback-form-wrapper input[type='tel'] {
    width: 100%; height: 48px; border: 1px solid #ccc; outline: none;
    transition: border-color 0.3s, box-shadow 0.3s; -webkit-appearance: none; appearance: none;
}
.callback-form-wrapper input[type='tel']:focus { box-shadow: 0 0 0 2px rgba(0,115,170,0.2); }

/* Time selector trigger button */
.cf-multiselect-container {
    position: relative; width: 100%; height: 48px; border: 1px solid #ccc;
    cursor: pointer; outline: none; transition: border-color 0.3s, box-shadow 0.3s;
    overflow: hidden;
}
.cf-multiselect-container:focus, .cf-multiselect-container.active { box-shadow: 0 0 0 2px rgba(0,115,170,0.2); }

.cf-multiselect-selected { 
    display: flex; align-items: center; justify-content: space-between; 
    height: 100%; gap: 8px; overflow: hidden;
}
.cf-placeholder { white-space: nowrap; }
.cf-tags { 
    display: flex; flex-wrap: nowrap; gap: 4px; flex: 1; 
    overflow: hidden; white-space: nowrap;
}
.cf-tag { 
    display: inline-flex; align-items: center; padding: 2px 8px; 
    font-size: 0.85em; gap: 4px; flex-shrink: 0;
}
.cf-tag-remove { cursor: pointer; font-weight: bold; opacity: 0.7; transition: opacity 0.2s; }
.cf-tag-remove:hover { opacity: 1; }
.cf-arrow { font-size: 10px; transition: transform 0.3s; margin-left: auto; flex-shrink: 0; }
.cf-multiselect-container.active .cf-arrow { transform: rotate(180deg); }

/* Modal Overlay */
.cf-modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 999999; justify-content: center; align-items: center;
    animation: cf-fadeIn 0.2s ease;
}
.cf-modal-overlay.active { display: flex; }

/* Modal Popup */
.cf-modal-popup {
    background: #fff; border-radius: 8px; max-width: 400px; width: 90%; max-height: 80vh;
    display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: cf-slideIn 0.3s ease;
}

@keyframes cf-slideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.cf-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; border-bottom: 1px solid #eee;
}
.cf-modal-title { margin: 0; font-size: 18px; font-weight: 600; }
.cf-modal-close {
    background: none; border: none; font-size: 24px; cursor: pointer;
    color: #999; padding: 0; line-height: 1; transition: color 0.2s;
}
.cf-modal-close:hover { color: #333; }

.cf-modal-body { padding: 15px 20px; overflow-y: auto; flex: 1; }

.cf-modal-option {
    display: flex; align-items: center; padding: 12px 15px; margin: 5px 0;
    border-radius: 6px; cursor: pointer; transition: background-color 0.2s; gap: 10px;
}
.cf-modal-option:hover { background-color: #f5f5f5; }
.cf-modal-option.selected { background-color: #e3f2fd; }
.cf-modal-option input[type="checkbox"] { 
    width: 18px; height: 18px; margin: 0; cursor: pointer; pointer-events: none;
}
.cf-modal-option span { flex: 1; font-size: 15px; pointer-events: none; }

.cf-modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 15px 20px; border-top: 1px solid #eee;
}
.cf-modal-btn {
    padding: 10px 20px; border-radius: 6px; cursor: pointer;
    font-size: 14px; font-weight: 500; transition: all 0.2s;
}
.cf-modal-btn-cancel {
    background: #f5f5f5; border: 1px solid #ddd; color: #666;
}
.cf-modal-btn-cancel:hover { background: #eee; }
.cf-modal-btn-confirm {
    background: #0073aa; border: none; color: #fff;
}
.cf-modal-btn-confirm:hover { background: #005177; }

/* Submit Button */
.callback-form-wrapper button[type='submit'] {
    border: none; cursor: pointer; white-space: nowrap; height: 48px; width: 100%;
}
.callback-form-wrapper button[type='submit']:hover { transform: translateY(-1px); }
.callback-form-wrapper button[type='submit']:active { transform: translateY(0); }
.callback-form-wrapper button[type='submit']:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.cf-message-container { margin-top: 10px; }
.cf-success-message, .cf-error-message { padding: 12px 16px; text-align: center; animation: cf-fadeIn 0.3s ease; }

@keyframes cf-fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.callback-form-wrapper.cf-loading button[type='submit'] { position: relative; color: transparent; }
.callback-form-wrapper.cf-loading button[type='submit']::after {
    content: ''; position: absolute; top: 50%; left: 50%; width: 16px; height: 16px;
    margin: -8px 0 0 -8px; border: 2px solid transparent; border-top-color: #fff;
    border-radius: 50%; animation: cf-spin 0.8s linear infinite;
}
@keyframes cf-spin { to { transform: rotate(360deg); } }

@media screen and (max-width: 768px) {
    .cf-form-row { flex-direction: column; align-items: stretch; }
    .cf-field, .cf-phone-field, .cf-time-field, .cf-submit-field { flex: none; width: 100%; }
    .callback-form-wrapper input[type='tel'],
    .cf-multiselect-container,
    .callback-form-wrapper button[type='submit'] { width: 100%; height: 48px; }
    
    .cf-modal-popup { width: 95%; max-height: 90vh; }
}

/* Divi Compatibility */
.et_pb_text .callback-form-wrapper, .et_pb_code .callback-form-wrapper { max-width: 100%; }
.et_pb_text .cf-form-row, .et_pb_code .cf-form-row { width: 100%; }
.et_pb_text .callback-form-wrapper input, .et_pb_code .callback-form-wrapper input,
.et_pb_text .callback-form-wrapper button, .et_pb_code .callback-form-wrapper button { margin-bottom: 0; }
.callback-form-wrapper input[type='tel'] { background-image: none !important; }
