/**
 * AI-Powered Feature Styles
 * Styles for Dynamic Bento Personalization, Smart CTA, and Ambient Theme Mode
 */

/* ============================================
   AI Bento Personalization Styles
   ============================================ */

.master-bento-grid.ai-personalized {
    transition: opacity 0.3s ease;
}

.master-bento-grid.ai-personalized .bento-card {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Subtle indicator for personalized layout */
.master-bento-grid.ai-personalized::before {
    content: '✨';
    position: absolute;
    top: -30px;
    right: 0;
    font-size: 14px;
    opacity: 0.7;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

/* ============================================
   Smart CTA Price Anchor Styles
   ============================================ */

.button-primary.smart-cta {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Urgent CTA - stale price */
.button-primary.cta-urgent {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    animation: pulse-urgent 2s ease-in-out infinite;
}

.button-primary.cta-urgent::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 3s ease-in-out infinite;
}

@keyframes pulse-urgent {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    50% { transform: scale(1.02); box-shadow: 0 0 20px 5px rgba(255, 107, 107, 0.4); }
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* Social Proof CTA - best seller */
.button-primary.cta-social-proof {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    border: 2px solid #3d9b8a;
}

.button-primary.cta-social-proof:hover {
    background: linear-gradient(135deg, #44a08d, #3d9b8a);
    transform: translateY(-2px);
}

/* Fresh CTA - recently updated */
.button-primary.cta-fresh {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.button-primary.cta-fresh::before {
    content: 'NEW';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b6b;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Standard CTA */
.button-primary.cta-standard {
    background: var(--accent, #667eea);
    color: white;
}

/* ============================================
   Ambient Theme Mode Styles
   ============================================ */

body.ambient-theme-active {
    transition: background-color 0.5s ease;
}

/* Smooth transition for CSS variables */
:root {
    transition: --accent 0.5s ease, --accent-2 0.5s ease;
}

/* Apply ambient colors to various elements */
body.ambient-theme-active .hero-title span {
    background: linear-gradient(135deg, var(--accent, #667eea), var(--accent-2, #764ba2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: background 0.5s ease;
}

body.ambient-theme-active .button-primary {
    background: linear-gradient(135deg, var(--accent, #667eea), var(--accent-2, #764ba2));
    transition: background 0.5s ease;
}

body.ambient-theme-active .card-badge {
    background: var(--accent, #667eea);
    transition: background 0.5s ease;
}

body.ambient-theme-active .section-head h2 {
    color: var(--accent, #667eea);
    transition: color 0.5s ease;
}

/* Subtle ambient glow effect */
body.ambient-theme-active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 20%, var(--accent, rgba(102, 126, 234, 0.05)) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, var(--accent-2, rgba(118, 75, 162, 0.05)) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    transition: background 0.5s ease;
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 768px) {
    .button-primary.smart-cta {
        font-size: 14px;
        padding: 12px 20px;
    }
    
    .button-primary.cta-fresh::before {
        top: -6px;
        right: -6px;
        font-size: 9px;
    }
    
    .master-bento-grid.ai-personalized::before {
        display: none;
    }
}

/* ============================================
   Performance Optimizations
   ============================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .button-primary.cta-urgent,
    .button-primary.cta-fresh::before,
    .master-bento-grid.ai-personalized::before {
        animation: none;
    }
    
    .button-primary.smart-cta,
    body.ambient-theme-active,
    :root {
        transition: none;
    }
}

/* ============================================
   Real-time Micro-Copywriting Styles
   ============================================ */

/* Viral CTA - high click count or golden hour */
.viral-cta {
    background: linear-gradient(135deg, #ff6b6b, #ff8e53) !important;
    color: white !important;
    border: 2px solid #ff6b6b !important;
    animation: pulse-viral 2s ease-in-out infinite;
}

@keyframes pulse-viral {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
    50% { transform: scale(1.03); box-shadow: 0 0 25px 8px rgba(255, 107, 107, 0.5); }
}

/* Savings CTA - discounted products */
.savings-cta {
    background: linear-gradient(135deg, #11998e, #38ef7d) !important;
    color: white !important;
    border: 2px solid #11998e !important;
    animation: sparkle-savings 1.5s ease-in-out infinite;
}

@keyframes sparkle-savings {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(56, 239, 125, 0.5);
    }
    50% { 
        box-shadow: 0 0 20px rgba(56, 239, 125, 0.8), 0 0 30px rgba(56, 239, 125, 0.4);
    }
}

/* Time badge for time-based messaging */
.time-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    animation: fade-in-up 0.5s ease-out;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CTA transition effects */
.button-primary.viral-cta,
.button-primary.savings-cta {
    transition: all 0.3s ease;
}

.button-primary.viral-cta:hover,
.button-primary.savings-cta:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Responsive adjustments for micro-copywriting */
@media (max-width: 768px) {
    .viral-cta,
    .savings-cta {
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .time-badge {
        font-size: 11px;
        padding: 3px 10px;
    }
}

/* Reduce motion for micro-copywriting animations */
@media (prefers-reduced-motion: reduce) {
    .viral-cta,
    .savings-cta,
    .time-badge {
        animation: none !important;
    }
}

/* ============================================
   Predictive Bento Heatmap Simulation Styles
   ============================================ */

#bento-heatmap-container {
    margin-top: 24px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 1px solid #dcdcde;
}

.heatmap-bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.heatmap-cell {
    position: relative;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    min-height: 120px;
    border: 2px solid #e0e0e0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.heatmap-cell:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 10;
}

.heatmap-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.heatmap-content {
    position: relative;
    z-index: 1;
    padding: 12px;
    color: #333;
}

.heatmap-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heatmap-score {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.heatmap-attention {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.heatmap-slot {
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
}

.heatmap-recommendation {
    font-size: 11px;
    color: #d63638;
    background: #fff3f3;
    padding: 6px 8px;
    border-radius: 4px;
    border-left: 3px solid #d63638;
    margin-top: 8px;
    line-height: 1.4;
}

/* Heatmap color classes */
.heatmap-high {
    border-color: #ff0000;
}

.heatmap-high .heatmap-attention {
    color: #ff0000;
}

.heatmap-medium-high {
    border-color: #ffa500;
}

.heatmap-medium-high .heatmap-attention {
    color: #ffa500;
}

.heatmap-medium {
    border-color: #ffff00;
}

.heatmap-medium .heatmap-attention {
    color: #b8b800;
}

.heatmap-low {
    border-color: #0080ff;
}

.heatmap-low .heatmap-attention {
    color: #0080ff;
}

.heatmap-very-low {
    border-color: #00008b;
}

.heatmap-very-low .heatmap-attention {
    color: #00008b;
}

/* Heatmap legend */
.heatmap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 6px;
    display: inline-block;
}

.heatmap-empty,
.heatmap-error {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 14px;
}

.heatmap-error {
    color: #d63638;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .heatmap-bento-grid {
        grid-template-columns: 1fr;
    }
    
    .heatmap-cell {
        min-height: 100px;
    }
    
    .heatmap-legend {
        flex-direction: column;
        gap: 8px;
    }
}
