/**
 * Smart CTA — Frontend Styles (The Visible Card)
 */

/* --------------------------------------------------------------------------
   1. Shared Variables (Apply to both Bar and Popup)
   -------------------------------------------------------------------------- */
/* We apply defaults to anything using our classes to ensure Popups inherit them too */
.smartcta,
.smartcta-pop {
    --sc-btn-bg: #3b82f6;       /* Default Blue */
    --sc-btn-text: #ffffff;     /* Default White Text */
    --sc-btn-hover: #2563eb;
    --sc-subtext: rgba(255, 255, 255, 0.9);
}

/* --------------------------------------------------------------------------
   2. Base Container (Floating Bar / Inline)
   -------------------------------------------------------------------------- */
.smartcta {
    /* -- Colors -- */
    --sc-bg: #1e293b;       /* Navy */
    --sc-text: #ffffff;
    
    /* -- Layout -- */
    position: relative;
    box-sizing: border-box;
    width: var(--sc-width, 320px);
    max-width: 100%;
    padding: 24px;
    
    /* -- Appearance -- */
    background-color: var(--sc-bg);
    color: var(--sc-text);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* -- Typography -- */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-align: center;
    line-height: 1.5;
    z-index: 9999;
}

/* --------------------------------------------------------------------------
   3. Floating Logic
   -------------------------------------------------------------------------- */
.smartcta--floating {
    position: fixed;
    z-index: 100000;
    margin: 0;
    animation: smartcta-slide-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Positions */
.smartcta--pos-br { bottom: var(--sc-offset-y, 20px); right: var(--sc-offset-x, 20px); }
.smartcta--pos-bl { bottom: var(--sc-offset-y, 20px); left: var(--sc-offset-x, 20px); }
.smartcta--pos-tr { top: var(--sc-offset-y, 20px); right: var(--sc-offset-x, 20px); }
.smartcta--pos-tl { top: var(--sc-offset-y, 20px); left: var(--sc-offset-x, 20px); }

@keyframes smartcta-slide-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   4. Content Elements
   -------------------------------------------------------------------------- */
.smartcta__headline {
    margin: 0 0 8px 0 !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    color: inherit !important;
    line-height: 1.3 !important;
}

.smartcta__subtext {
    margin: 0 0 20px 0 !important;
    font-size: 0.925rem !important;
    color: var(--sc-subtext) !important;
    line-height: 1.5 !important;
}

/* Close Button */
.smartcta__dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: currentColor;
    opacity: 0.5;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
}
.smartcta__dismiss:hover {
    background-color: rgba(255,255,255,0.1);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   5. Action Button (Shared Styles)
   -------------------------------------------------------------------------- */
.smartcta__btn {
    display: inline-block;
    width: 100%;
    padding: 12px 20px;
    box-sizing: border-box;
    
    background-color: var(--sc-btn-bg);
    color: var(--sc-btn-text) !important;
    
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none !important;
    text-align: center;
    
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.smartcta__btn:hover {
    transform: translateY(-2px);
    background-color: var(--sc-btn-hover);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   6. Themes (Background Colors)
   -------------------------------------------------------------------------- */
.smartcta--theme-white {
    --sc-bg: #ffffff;
    --sc-text: #1e293b;
    --sc-subtext: #64748b;
    border: 1px solid #e2e8f0;
}

.smartcta--theme-black {
    --sc-bg: #000000;
    --sc-text: #ffffff;
    --sc-subtext: #9ca3af;
}

.smartcta--theme-glass {
    --sc-bg: rgba(15, 23, 42, 0.7);
    --sc-text: #ffffff;
    --sc-subtext: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --------------------------------------------------------------------------
   7. Button Colors (CRITICAL FIX)
   -------------------------------------------------------------------------- */
/* These classes apply to the Wrapper (.smartcta OR .smartcta-pop), so variables flow down */

.smartcta--color-blue { 
    --sc-btn-bg: #3b82f6; 
    --sc-btn-hover: #2563eb; 
    --sc-btn-text: #ffffff; 
}

.smartcta--color-green { 
    --sc-btn-bg: #10b981; 
    --sc-btn-hover: #059669; 
    --sc-btn-text: #ffffff; 
}

.smartcta--color-red { 
    --sc-btn-bg: #ef4444; 
    --sc-btn-hover: #dc2626; 
    --sc-btn-text: #ffffff; 
}

.smartcta--color-orange { 
    --sc-btn-bg: #f59e0b; 
    --sc-btn-hover: #d97706; 
    --sc-btn-text: #111827; /* Dark Text */
}

.smartcta--color-purple { 
    --sc-btn-bg: #8b5cf6; 
    --sc-btn-hover: #7c3aed; 
    --sc-btn-text: #ffffff; 
}

.smartcta--color-black { 
    --sc-btn-bg: #111827; 
    --sc-btn-hover: #000000; 
    --sc-btn-text: #ffffff; 
}

.smartcta--color-white { 
    --sc-btn-bg: #ffffff; 
    --sc-btn-hover: #f3f4f6; 
    --sc-btn-text: #111827; /* Dark Text */
}

/* --------------------------------------------------------------------------
   8. Button Styles (Outline / Soft)
   -------------------------------------------------------------------------- */
/* Outline */
.smartcta--style-outline .smartcta__btn,
.smartcta--style-outline .smartcta-pop__btn {
    background: transparent !important;
    border: 2px solid var(--sc-btn-bg);
    color: var(--sc-btn-bg) !important;
    box-shadow: none;
}
.smartcta--style-outline .smartcta__btn:hover,
.smartcta--style-outline .smartcta-pop__btn:hover {
    background: var(--sc-btn-bg) !important;
    color: var(--sc-btn-text) !important;
}

/* Soft */
.smartcta--style-soft .smartcta__btn,
.smartcta--style-soft .smartcta-pop__btn {
    /* Fallback for older browsers + modern color-mix */
    background: var(--sc-btn-bg);
    background: color-mix(in srgb, var(--sc-btn-bg), transparent 80%) !important;
    color: var(--sc-btn-bg) !important;
    box-shadow: none;
}
.smartcta--style-soft .smartcta__btn:hover,
.smartcta--style-soft .smartcta-pop__btn:hover {
    background: var(--sc-btn-bg) !important;
    color: var(--sc-btn-text) !important;
}

/* --------------------------------------------------------------------------
   9. Attention Effects
   -------------------------------------------------------------------------- */
@keyframes sc-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes sc-glow {
    0% { box-shadow: 0 0 5px var(--sc-btn-bg); }
    50% { box-shadow: 0 0 20px var(--sc-btn-bg); }
    100% { box-shadow: 0 0 5px var(--sc-btn-bg); }
}

.smartcta--attention-pulse .smartcta__btn {
    animation: sc-pulse 2s infinite;
}

.smartcta--attention-glow .smartcta__btn {
    animation: sc-glow 2s infinite;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .smartcta--floating {
        width: calc(100% - 32px);
        left: 16px !important;
        right: 16px !important;
        bottom: 16px !important;
        top: auto !important;
    }
}