/**
 * Creya Edu Lead Engine - Main Stylesheet (Modal, Inputs, Autocomplete, Cards)
 * Standard visual match with Creya Lead Engine (compact 380px, Figtree, clean 39px inputs)
 * Theme Agnostic & Fully Isolated
 *
 * @package CreyaEduLeadEngine
 */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════════════════════
   1. BASE RESETS & SCOPE
   ══════════════════════════════════════════════════════ */
.cedu-modal-root,
.cedu-modal-root *,
.cedu-modal-root *::before,
.cedu-modal-root *::after,
.cedu-lead-form,
.cedu-lead-form *,
.cedu-lead-form *::before,
.cedu-lead-form *::after {
    box-sizing: border-box !important;
    font-family: 'Figtree', sans-serif !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* ══════════════════════════════════════════════════════
   2. MODAL POPUP WRAPPER & BACKDROP
   ══════════════════════════════════════════════════════ */
.cedu-modal-root {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 16px !important;
}

.cedu-modal-root::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.cedu-modal-root.is-active,
.cedu-modal-root.cedu-is-open,
.cedu-modal-root.is-open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.cedu-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0) !important;
    backdrop-filter: blur(0px) saturate(100%);
    -webkit-backdrop-filter: blur(0px) saturate(100%);
    opacity: 0;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), backdrop-filter 0.28s cubic-bezier(0.16, 1, 0.3, 1), -webkit-backdrop-filter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, backdrop-filter;
}

.cedu-modal-root.is-active .cedu-modal-backdrop,
.cedu-modal-root.cedu-is-open .cedu-modal-backdrop,
.cedu-modal-root.is-open .cedu-modal-backdrop {
    background: rgba(15, 23, 42, 0.76) !important;
    backdrop-filter: blur(14px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(14px) saturate(160%) !important;
    opacity: 1 !important;
}

/* ══════════════════════════════════════════════════════
   3. MODAL DIALOG & COMPACT CARD (CREYA LEAD ENGINE 380PX)
   ══════════════════════════════════════════════════════ */
.cedu-modal-dialog {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    max-width: 380px !important;
    margin: auto !important;
    display: flex !important;
    transform-origin: center center;
    transition: transform 0.2s ease, max-width 0.2s ease;
    overflow: visible !important;
}

.cedu-modal-card {
    position: relative !important;
    width: 100% !important;
    background: #ffffff !important;
    border-radius: 18px !important;
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.15) !important;
    padding: 22px 20px 20px !important;
    overflow: visible !important;
    max-height: none;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}

.cedu-modal-root.is-active .cedu-modal-card,
.cedu-modal-root.cedu-is-open .cedu-modal-card,
.cedu-modal-root.is-open .cedu-modal-card {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
}

/* Sleek Close Button */
.cedu-modal-close-btn {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
    border: none !important;
    background: #f1f5f4 !important;
    color: #58736e !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.18s ease !important;
    z-index: 5 !important;
    padding: 0 !important;
    outline: none !important;
}

.cedu-modal-close-btn:hover {
    background: #e4ece9 !important;
    color: #112824 !important;
}

.cedu-modal-close-btn:active {
    background: #e8f3f7 !important;
    color: #208e77 !important;
}

/* ══════════════════════════════════════════════════════
   4. MODAL HEADER & TYPOGRAPHY
   ══════════════════════════════════════════════════════ */
.cedu-modal-header {
    background: transparent !important;
    color: inherit !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 0 12px 0 !important;
    text-align: center !important;
    padding: 0 10px !important;
    border: none !important;
    box-shadow: none !important;
}

.cedu-modal-logo-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 6px !important;
}

.cedu-modal-logo-brand {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #174e44 !important;
    letter-spacing: -0.3px !important;
}

.cedu-modal-logo-brand span {
    color: #208e77 !important;
}

.cedu-logo-dot {
    width: 7px !important;
    height: 7px !important;
    border-radius: 50% !important;
    background: #279a81 !important;
    display: inline-block !important;
}

.cedu-modal-logo-img {
    height: 28px !important;
    max-height: 28px !important;
    width: auto !important;
    object-fit: contain !important;
    display: block !important;
}

.cedu-modal-title {
    background: transparent !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #112824 !important;
    line-height: 1.25 !important;
    margin: 0 0 3px 0 !important;
    padding: 0 !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    border: none !important;
    box-shadow: none !important;
}

.cedu-modal-subtitle {
    background: transparent !important;
    font-size: 11.5px !important;
    color: #58736e !important;
    line-height: 1.4 !important;
    margin: 0 auto !important;
    padding: 0 !important;
    max-width: 300px !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    border: none !important;
    box-shadow: none !important;
}

/* ══════════════════════════════════════════════════════
   5. FORM STACK & INPUT CONTROLS (39PX HEIGHT CLEAN DESIGN)
   ══════════════════════════════════════════════════════ */
.cedu-lead-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 9px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.cedu-dynamic-context-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 9px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.cedu-input-group {
    display: flex;
    flex-direction: column;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
}

/* Strict Isolation: Hidden Context Slots NEVER Leak */
.cedu-is-hidden,
.cedu-input-group.cedu-is-hidden,
.cedu-context-slot.cedu-is-hidden,
.cedu-input-group[style*="display: none"],
.cedu-context-slot[style*="display: none"] {
    display: none !important;
}

.cedu-is-visible,
.cedu-context-slot.cedu-is-visible {
    display: flex !important;
}

.cedu-field-label {
    margin: 0 0 2.5px 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: #193832 !important;
    display: flex !important;
    align-items: center !important;
    gap: 3px !important;
}

.cedu-mark-req {
    color: #ef4444 !important;
    font-weight: 700 !important;
}

.cedu-input-wrapper {
    position: relative !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.cedu-field-control {
    margin: 0 !important;
    padding: 0 12px !important;
    width: 100% !important;
    height: 39px !important;
    border: 1.5px solid #d7e5e2 !important;
    border-radius: 8px !important;
    font-size: 12.5px !important;
    color: #112824 !important;
    background-color: #fafcfb !important;
    transition: all 0.18s ease !important;
    box-sizing: border-box !important;
    outline: none !important;
    font-family: 'Figtree', sans-serif !important;
}

.cedu-field-control::placeholder {
    color: #98aba7 !important;
    font-size: 11.5px !important;
    font-weight: 400 !important;
}

.cedu-field-control:focus,
.cedu-field-control:active {
    border-color: #208e77 !important;
    box-shadow: 0 0 0 3px rgba(32, 142, 119, 0.22) !important;
    background-color: #ffffff !important;
}

/* Number input styling: ensure stepper arrows are active and visible */
input[type="number"].cedu-field-control::-webkit-inner-spin-button,
input[type="number"].cedu-field-control::-webkit-outer-spin-button {
    opacity: 0.75;
    cursor: pointer;
}

input[type="number"].cedu-field-control:hover::-webkit-inner-spin-button,
input[type="number"].cedu-field-control:focus::-webkit-inner-spin-button {
    opacity: 1;
}

.cedu-textarea-control {
    height: auto !important;
    padding: 8px 12px !important;
    resize: vertical !important;
    min-height: 54px !important;
    line-height: 1.35 !important;
}

/* ══════════════════════════════════════════════════════
   6. SELECT DROPDOWN WRAPPER
   ══════════════════════════════════════════════════════ */
.cedu-select-wrapper {
    position: relative !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.cedu-select-wrapper select {
    appearance: none !important;
    -webkit-appearance: none !important;
    cursor: pointer !important;
    padding-right: 32px !important;
}

.cedu-select-arrow {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 10px !important;
    height: 6px !important;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23208e77' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    pointer-events: none !important;
    transition: transform 0.2s ease !important;
}

.cedu-select-wrapper:focus-within .cedu-select-arrow {
    transform: translateY(-50%) rotate(180deg) !important;
}

/* ══════════════════════════════════════════════════════
   7. AUTOCOMPLETE DROPDOWN (DOMISILI 500+ CITIES)
   ══════════════════════════════════════════════════════ */
.cedu-autocomplete-dropdown {
    position: absolute !important;
    top: calc(100% + 3px) !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    border: 1.5px solid #208e77 !important;
    border-radius: 8px !important;
    box-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.24) !important;
    max-height: 140px !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    box-sizing: border-box !important;
    scrollbar-width: thin !important;
    scrollbar-color: #208e77 transparent !important;
}

.cedu-autocomplete-dropdown::-webkit-scrollbar {
    width: 5px !important;
}

.cedu-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #208e77 !important;
    border-radius: 999px !important;
}

.cedu-autocomplete-item {
    padding: 8px 14px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-align: left !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.cedu-autocomplete-item:last-child {
    border-bottom: none !important;
}

.cedu-autocomplete-item:hover,
.cedu-autocomplete-item.is-highlighted {
    background: #e8f4f8 !important;
    color: #208e77 !important;
    font-weight: 700 !important;
}

.cedu-autocomplete-item mark {
    background: transparent !important;
    color: #208e77 !important;
    font-weight: 800 !important;
    text-decoration: underline !important;
}

/* ══════════════════════════════════════════════════════
   8. LOCKED STATE (CLEAN CREYA LEAD ENGINE STYLE)
   ══════════════════════════════════════════════════════ */
.cedu-field-control.cedu-field-locked,
input.cedu-field-locked,
select.cedu-field-locked {
    background-color: #f2f6f5 !important;
    border-color: #d2dedc !important;
    color: #55706b !important;
    pointer-events: none !important;
    font-weight: 600 !important;
    cursor: not-allowed !important;
}

/* ══════════════════════════════════════════════════════
   9. TACTILE CARDS (CARA BELAJAR - NO EMOJIS)
   ══════════════════════════════════════════════════════ */
.cedu-cara-cards-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
}

.cedu-cara-card {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    border-radius: 8px !important;
    background: #fafcfb !important;
    border: 1.5px solid #d7e5e2 !important;
    padding: 8px 6px !important;
    text-align: center !important;
    transition: all 0.18s ease !important;
    user-select: none !important;
}

.cedu-cara-card input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.cedu-cara-card:hover {
    border-color: #208e77 !important;
    background: #f4f8f7 !important;
}

.cedu-cara-card.is-selected {
    background: #eef5f3 !important;
    border-color: #208e77 !important;
    box-shadow: 0 0 0 2px rgba(32, 142, 119, 0.28) !important;
}

.cedu-cara-card-inner {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 2px !important;
}

.cedu-cara-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #112824 !important;
    line-height: 1.2 !important;
}

.cedu-cara-sub {
    font-size: 9.5px !important;
    color: #58736e !important;
    line-height: 1.15 !important;
}

/* ══════════════════════════════════════════════════════
   10. JENJANG PILLS (SD / SMP)
   ══════════════════════════════════════════════════════ */
.cedu-jenjang-pills-wrap {
    display: flex !important;
    gap: 6px !important;
    width: 100% !important;
}

.cedu-jenjang-pill {
    flex: 1 !important;
    position: relative !important;
    cursor: pointer !important;
}

.cedu-jenjang-pill input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.cedu-jenjang-pill-text {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 36px !important;
    background: #f4f8f7 !important;
    border: 1.5px solid #d7e5e2 !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #2e4c46 !important;
    transition: all 0.18s ease !important;
}

.cedu-jenjang-pill:hover .cedu-jenjang-pill-text {
    border-color: #208e77 !important;
    background: #e8f4f8 !important;
    color: #208e77 !important;
}

.cedu-jenjang-pill.is-selected .cedu-jenjang-pill-text,
.cedu-jenjang-pill input[type="radio"]:checked + .cedu-jenjang-pill-text {
    background: #208e77 !important;
    border-color: #208e77 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 0 0 2px rgba(32, 142, 119, 0.28) !important;
}

/* ══════════════════════════════════════════════════════
   11. BRANCH ADDRESS BOX
   ══════════════════════════════════════════════════════ */
.cedu-branch-address-box {
    margin-top: 6px !important;
    background: #eef5f3 !important;
    border: 1px solid rgba(32, 142, 119, 0.3) !important;
    border-radius: 8px !important;
    padding: 8px 10px !important;
    animation: ceduFadeIn 0.22s ease-out !important;
}

@keyframes ceduFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.cedu-branch-address-badge {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #174e44 !important;
    margin-bottom: 2px !important;
    text-transform: uppercase !important;
}

.cedu-branch-address-text {
    font-size: 11px !important;
    color: #1c6659 !important;
    line-height: 1.4 !important;
}

/* ══════════════════════════════════════════════════════
   12. SUBMIT BUTTON (CREYA STYLE 10PX RADIUS, 42PX HEIGHT)
   ══════════════════════════════════════════════════════ */
.cedu-submit-wrapper {
    margin-top: 14px !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

.cedu-submit-btn {
    width: 100% !important;
    height: 42px !important;
    background: #208e77 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 10px 16px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 14px rgba(32, 142, 119, 0.28) !important;
    transition: all 0.18s ease !important;
    outline: none !important;
    font-family: 'Figtree', sans-serif !important;
}

.cedu-submit-btn:hover {
    background: #174e44 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 18px rgba(32, 142, 119, 0.38) !important;
}

.cedu-submit-btn:active {
    transform: translateY(0) !important;
}

.cedu-btn-wa-icon {
    flex-shrink: 0 !important;
    color: #ffffff !important;
}

.cedu-submit-btn:hover .cedu-btn-wa-icon {
    transform: scale(1.1) !important;
}

/* ══════════════════════════════════════════════════════
   13. ERROR STATE
   ══════════════════════════════════════════════════════ */
.cedu-has-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) !important;
}

/* ══════════════════════════════════════════════════════
   14. RESPONSIVE MOBILE
   ══════════════════════════════════════════════════════ */
@media (max-width: 420px) {
    .cedu-modal-card {
        padding: 20px 16px 18px !important;
        border-radius: 16px !important;
    }

    .cedu-cara-cards-grid {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    .cedu-cara-card {
        padding: 8px 10px !important;
        text-align: left !important;
    }

    .cedu-cara-card-inner {
        flex-direction: column !important;
        align-items: center !important;
        gap: 2px !important;
    }
}
