/* ==========================================================
   CRM Form Builder - Global Frontend Styles
   ========================================================== */

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

/* ===== Base Form ===== */
.crm-form {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

.crm-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    position: relative;
}

.crm-form-group label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .05em;
    color: #1c2b23;
    text-transform: uppercase;
}

.crm-required { color: #ef0f5a; margin-left: 2px; }

.crm-form-group input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]),
.crm-form-group select,
.crm-form-group textarea {
    background: #f2f4f3;
    border: 1.5px solid #e3e7e5;
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 14px;
    color: #1c2b23;
    font-family: inherit;
    width: 100%;
    outline: none;
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.crm-form-group input::placeholder,
.crm-form-group textarea::placeholder { color: #9aa5a0; }

.crm-form-group input:focus,
.crm-form-group select:focus,
.crm-form-group textarea:focus {
    border-color: #0b5d3b;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(11,93,59,.1);
}

/* ===== Validation States ===== */
.crm-form-group input.crm-field-error,
.crm-form-group select.crm-field-error,
.crm-form-group textarea.crm-field-error {
    border-color: #ef0f5a !important;
    background: #fff5f7 !important;
    box-shadow: 0 0 0 3px rgba(239,15,90,.1) !important;
}

.crm-form-group input.crm-field-ok,
.crm-form-group select.crm-field-ok,
.crm-form-group textarea.crm-field-ok {
    border-color: #0b5d3b !important;
}

.crm-inline-error {
    font-size: 11px;
    color: #ef0f5a;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

/* Shake animation */
@keyframes crm-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
.crm-shake { animation: crm-shake .5s ease; }

/* ===== Submit Button ===== */
.crm-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: linear-gradient(135deg, #ff1c65, #ef0f5a);
    color: #fff;
    border: none;
    padding: 16px 24px;
    font-size: 15.5px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(239,15,90,.28);
    transition: transform .15s, box-shadow .15s, opacity .15s;
    letter-spacing: .02em;
    font-family: inherit;
}
.crm-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(239,15,90,.36);
}
.crm-submit-btn:disabled { opacity: .75; cursor: not-allowed; }

/* Button loading spinner */
.crm-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: crm-spin .7s linear infinite;
}
@keyframes crm-spin { to { transform: rotate(360deg); } }

/* ===== Form Messages ===== */
.crm-form-messages {
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 14px;
    display: none;
}
.crm-msg-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}
.crm-msg-error {
    background: #fff5f7;
    color: #b91c4a;
    border: 1px solid #fca5a5;
}

/* =============================================================
   FOOLPROOF RESPONSIVE SUCCESS SCREEN
   ============================================================= */

/* Prevent background scroll */
body.crm-no-scroll { overflow: hidden !important; }

/* The main overlay - Covers entire viewport, guarantees centering */
#crm-success-screen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    background: rgba(10, 25, 15, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

/* The card modal - Auto sizes, max height prevents overflow */
.crm-sc-modal {
    background: #ffffff !important;
    border-radius: 24px !important;
    width: 100% !important;
    max-width: 400px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 40px 32px 32px !important;
    text-align: center !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    box-sizing: border-box !important;
    
    /* Tailwind-style pop animation */
    animation: crm-sc-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both !important;
}

@keyframes crm-sc-pop {
    0% { opacity: 0; transform: scale(0.9) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---- Animated Icon ---- */
.crm-sc-icon-wrapper {
    display: flex !important;
    justify-content: center !important;
    margin-bottom: 24px !important;
}

.crm-sc-icon-circle {
    width: 80px !important;
    height: 80px !important;
    background: #d1fae5 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 0 0 10px rgba(209, 250, 229, 0.4) !important;
    animation: crm-sc-pulse 2s infinite !important;
}

@keyframes crm-sc-pulse {
    0% { box-shadow: 0 0 0 0 rgba(209, 250, 229, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(209, 250, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(209, 250, 229, 0); }
}

.crm-sc-checkmark {
    width: 44px !important;
    height: 44px !important;
}

.crm-sc-checkmark-circle {
    stroke: #059669 !important;
    stroke-width: 3 !important;
    stroke-dasharray: 166 !important;
    stroke-dashoffset: 166 !important;
    animation: crm-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards !important;
}

.crm-sc-checkmark-check {
    stroke: #059669 !important;
    stroke-width: 4 !important;
    stroke-dasharray: 48 !important;
    stroke-dashoffset: 48 !important;
    animation: crm-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards !important;
}

@keyframes crm-stroke {
    100% { stroke-dashoffset: 0; }
}

/* ---- Text Content ---- */
.crm-sc-title {
    font-family: 'Inter', 'Segoe UI', sans-serif !important;
    font-size: 24px !important;
    font-weight: 800 !important;
    color: #111827 !important;
    margin: 0 0 12px !important;
    line-height: 1.2 !important;
}

.crm-sc-msg {
    font-family: 'Inter', 'Segoe UI', sans-serif !important;
    font-size: 15px !important;
    color: #4b5563 !important;
    line-height: 1.6 !important;
    margin: 0 0 28px !important;
}

/* ---- Button ---- */
.crm-sc-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 14px 24px !important;
    background: #059669 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    font-family: 'Inter', sans-serif !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.2), 0 2px 4px -1px rgba(5, 150, 105, 0.1) !important;
}

.crm-sc-close:hover {
    background: #047857 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.3), 0 4px 6px -2px rgba(5, 150, 105, 0.1) !important;
}

/* ---- Mobile Adjustments ---- */
@media (max-width: 480px) {
    .crm-sc-modal { padding: 32px 24px 24px !important; }
    .crm-sc-title { font-size: 22px !important; }
}


/* ===== Radio / Checkbox ===== */
.crm-radio-item,
.crm-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    color: #1c2b23;
    cursor: pointer;
}
.crm-radio-item input,
.crm-checkbox-item input {
    width: 16px !important;
    height: 16px !important;
    accent-color: #0b5d3b;
}
