/* === BaZi Widget — Scoped Styles for WordPress === */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables scoped under #bazi-app */
#bazi-app {
    --color-wood: #22c55e;
    --color-fire: #ef4444;
    --color-earth: #eab308;
    --color-metal: #9ca3af;
    --color-water: #3b82f6;
    --color-gold: #d97706;
    --color-cream: #fefcf3;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
    color: #1f2937;
}

/* === Chinese Character Styling === */
#bazi-app .font-chinese {
    font-family: 'Noto Serif SC', 'SimKai', 'KaiTi', serif;
    font-weight: 600;
}

/* === Section Titles === */
#bazi-app .section-title {
    display: flex;
    align-items: center;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

/* === Pillar Cards === */
#bazi-app .pillar-card {
    border-radius: 0.75rem;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#bazi-app .pillar-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* === Luck Cycle Cards === */
#bazi-app .luck-card {
    border-radius: 0.75rem;
    padding: 0.75rem;
    min-width: 5rem;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#bazi-app .luck-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* === Timeline Scrollbar === */
#bazi-app .luck-timeline::-webkit-scrollbar {
    height: 6px;
}

#bazi-app .luck-timeline::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 3px;
}

#bazi-app .luck-timeline::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

#bazi-app .luck-timeline::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* === Select Styling === */
#bazi-app select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* === Radio & Checkbox accent === */
#bazi-app input[type="radio"]:checked,
#bazi-app input[type="checkbox"]:checked {
    accent-color: var(--color-gold);
}

/* === Alpine.js cloak === */
#bazi-app [x-cloak] {
    display: none !important;
}

/* === Animations === */
@keyframes baziFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

#bazi-app .pillar-card,
#bazi-app .luck-card {
    animation: baziFadeIn 0.4s ease both;
}

#bazi-app .pillar-card:nth-child(1) { animation-delay: 0.05s; }
#bazi-app .pillar-card:nth-child(2) { animation-delay: 0.10s; }
#bazi-app .pillar-card:nth-child(3) { animation-delay: 0.15s; }
#bazi-app .pillar-card:nth-child(4) { animation-delay: 0.20s; }

/* ============================================
   Element Color Utility Classes (BaZi-scoped)
   ============================================ */

/* --- Background colors (solid) --- */
#bazi-app .bz-bg-wood { background-color: #22c55e; }
#bazi-app .bz-bg-fire { background-color: #ef4444; }
#bazi-app .bz-bg-earth { background-color: #eab308; }
#bazi-app .bz-bg-metal { background-color: #9ca3af; }
#bazi-app .bz-bg-water { background-color: #3b82f6; }

/* --- Background colors (10% opacity) --- */
#bazi-app .bz-bg-wood-10 { background-color: rgba(34, 197, 94, 0.1); }
#bazi-app .bz-bg-fire-10 { background-color: rgba(239, 68, 68, 0.1); }
#bazi-app .bz-bg-earth-10 { background-color: rgba(234, 179, 8, 0.1); }
#bazi-app .bz-bg-metal-10 { background-color: rgba(156, 163, 175, 0.1); }
#bazi-app .bz-bg-water-10 { background-color: rgba(59, 130, 246, 0.1); }

/* --- Text colors --- */
#bazi-app .bz-text-wood { color: #22c55e; }
#bazi-app .bz-text-fire { color: #ef4444; }
#bazi-app .bz-text-earth { color: #eab308; }
#bazi-app .bz-text-metal { color: #9ca3af; }
#bazi-app .bz-text-water { color: #3b82f6; }

/* --- Border colors (30% opacity) --- */
#bazi-app .bz-border-wood { border-color: rgba(34, 197, 94, 0.3); }
#bazi-app .bz-border-fire { border-color: rgba(239, 68, 68, 0.3); }
#bazi-app .bz-border-earth { border-color: rgba(234, 179, 8, 0.3); }
#bazi-app .bz-border-metal { border-color: rgba(156, 163, 175, 0.3); }
#bazi-app .bz-border-water { border-color: rgba(59, 130, 246, 0.3); }

/* --- Gold & Cream --- */
#bazi-app .bz-bg-gold { background-color: #d97706; }
#bazi-app .bz-text-gold { color: #d97706; }
#bazi-app .bz-bg-cream { background-color: #fefcf3; }

/* === Print Styles === */
@media print {
    #bazi-app {
        font-size: 11pt;
    }

    #bazi-app .print-hidden {
        display: none !important;
    }

    #bazi-app .pillar-card,
    #bazi-app .luck-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
    }

    #bazi-app .pillar-card:hover,
    #bazi-app .luck-card:hover {
        transform: none;
        box-shadow: none;
    }

    #bazi-app section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    #bazi-app .luck-timeline {
        overflow: visible !important;
    }

    #bazi-app .luck-timeline > div {
        flex-wrap: wrap !important;
        min-width: auto !important;
    }
}

/* === Mobile Adjustments === */
@media (max-width: 480px) {
    #bazi-app .pillar-card {
        padding: 0.75rem 0.5rem;
    }

    #bazi-app .font-chinese {
        font-size: inherit;
    }
}
