/* Custom CSS for Fortune Telling Web App */

:root {
    --bg-color-1: #06020f;
    --bg-color-2: #0f0c20;
    --bg-color-3: #15102a;
    --primary-color: #7a1b9a;
    --primary-light: #ab47bc;
    --gold: #d4af37;
    --gold-glow: rgba(212, 175, 55, 0.4);
    --gold-text-color: #f3e5ab;
    --text-color: #f3f0ff;
    --text-muted: #b5aebf;
    --border-color: rgba(212, 175, 55, 0.2);
    --glass-bg: rgba(21, 16, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-glow: rgba(122, 27, 154, 0.15);
    
    /* Elements Colors */
    --gold-element: #ffd700;
    --wood-element: #00e676;
    --water-element: #29b6f6;
    --fire-element: #ff3d00;
    --earth-element: #ffb300;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color-1);
    color: var(--text-color);
    font-family: 'Inter', 'Noto Serif TC', serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Starfield Canvas background */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* App container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    z-index: 1;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-area {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.mystic-orb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle, #f3e5ab 0%, #d4af37 40%, #7a1b9a 80%, #06020f 100%);
    box-shadow: 0 0 20px #d4af37, 0 0 40px #7a1b9a;
    animation: pulsate 3s ease-in-out infinite alternate;
}

.app-header h1 {
    font-family: 'Noto Serif TC', serif;
    font-weight: 900;
    font-size: 2.8rem;
    letter-spacing: 0.2rem;
    color: var(--text-color);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4), 0 0 20px rgba(122, 27, 154, 0.6);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    letter-spacing: 0.05rem;
    font-weight: 300;
}

/* Cards & Layouts */
.mystic-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37), inset 0 0 12px var(--glass-glow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.mystic-card:hover {
    border-color: rgba(212, 175, 55, 0.4);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5), 0 0 15px var(--gold-glow);
}

.card-glow {
    position: absolute;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--primary-light) 0%, rgba(122,27,154,0) 70%);
    top: -75px;
    right: -75px;
    pointer-events: none;
    opacity: 0.3;
}

.card-content {
    padding: 2.5rem;
}

.section-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1rem;
}

.gold-text {
    color: var(--gold-text-color);
    text-shadow: 0 0 8px var(--gold-glow);
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 2rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    letter-spacing: 0.05rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.2rem;
    pointer-events: none;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    background: rgba(10, 5, 27, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
    background: rgba(15, 10, 35, 0.9);
}

/* Date input custom styling */
.input-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.9) sepia(0.5) saturate(2) hue-rotate(345deg);
    cursor: pointer;
}

/* Gender selector radio buttons */
.gender-selector {
    display: flex;
    gap: 1rem;
    height: 100%;
}

.gender-btn {
    flex: 1;
    cursor: pointer;
}

.gender-btn input {
    display: none;
}

.gender-btn-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 44px;
    background: rgba(10, 5, 27, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
    user-select: none;
}

.gender-btn input:checked + .gender-btn-custom {
    border-color: var(--gold);
    color: var(--gold-text-color);
    background: rgba(122, 27, 154, 0.2);
    box-shadow: 0 0 10px var(--gold-glow);
}

/* Buttons */
.btn-container {
    text-align: center;
    margin-top: 2.5rem;
}

.mystic-btn {
    background: linear-gradient(135deg, #7a1b9a 0%, #ab47bc 50%, #d4af37 100%);
    background-size: 200% 200%;
    color: #fff;
    border: none;
    padding: 1rem 3rem;
    font-family: 'Noto Serif TC', serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.2rem;
    border-radius: 30px;
    cursor: pointer;
    outline: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(122, 27, 154, 0.4), 0 0 0 1px var(--gold);
    transition: all 0.3s ease;
    animation: shimmer-flow 6s infinite linear;
}

.mystic-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(122, 27, 154, 0.6), 0 0 15px var(--gold-glow);
}

.mystic-btn:active {
    transform: translateY(-1px);
}

.mystic-btn-outline {
    background: transparent;
    color: var(--gold-text-color);
    border: 1px solid var(--gold);
    padding: 0.8rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mystic-btn-outline:hover {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 10px var(--gold-glow);
    transform: translateY(-2px);
}

/* Loading section */
#loading-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    text-align: center;
}

.mystic-loader {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.loader-ring {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 50%;
}

.outer-ring {
    width: 140px;
    height: 140px;
    border-top-color: var(--gold);
    border-bottom-color: var(--gold);
    animation: spin-clockwise 4s linear infinite;
    top: -55px;
}

.middle-ring {
    width: 110px;
    height: 110px;
    border-left-color: var(--primary-light);
    border-right-color: var(--primary-light);
    animation: spin-counter-clockwise 3s linear infinite;
    top: -40px;
}

.inner-ring {
    width: 80px;
    height: 80px;
    border-top-color: var(--text-color);
    animation: spin-clockwise 2s linear infinite;
    top: -25px;
}

.loader-symbol {
    font-size: 2.2rem;
    height: 30px;
    animation: pulse-slow 2s infinite ease-in-out;
    margin-bottom: 60px;
}

.loader-text {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.1rem;
    color: var(--gold-text-color);
    letter-spacing: 0.05rem;
    text-shadow: 0 0 8px var(--gold-glow);
}

/* Result Section & Dashboard */
.profile-badge {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    gap: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.badge-item {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Tabs Navigation */
.tabs-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-link {
    background: rgba(25, 20, 50, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-muted);
    padding: 1rem 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.tab-link:hover {
    background: rgba(35, 28, 70, 0.8);
    color: var(--text-color);
    border-color: rgba(212, 175, 55, 0.15);
}

.tab-link.active {
    background: var(--glass-bg);
    border-color: var(--gold);
    color: var(--gold-text-color);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.15), inset 0 0 10px rgba(122, 27, 154, 0.25);
}

.tab-icon {
    font-size: 1.5rem;
}

.tab-text {
    font-family: 'Noto Serif TC', serif;
    font-weight: 600;
    font-size: 1rem;
}

/* Tabs Content Panels */
.tabs-content {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-height: 450px;
}

.tab-panel {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s ease;
}

.tab-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Grid Layout inside Tab Panel */
.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2.5rem;
}

.panel-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding-right: 2.5rem;
}

.panel-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-title {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold-text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Bazi Table Styling */
.bazi-table-container {
    overflow-x: auto;
    width: 100%;
}

.bazi-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.bazi-table th {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.1rem;
    padding: 0.8rem 0;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bazi-table td {
    padding: 1.2rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.bazi-table td:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.stems-row td {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Noto Serif TC', serif;
}

.branches-row td {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'Noto Serif TC', serif;
}

.ganzhi-char {
    display: block;
    margin-bottom: 0.2rem;
}

.element-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.pillar-label td {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

/* Five Elements Distribution Styling */
.element-distribution {
    margin-top: 1rem;
}

.element-distribution h4 {
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
}

.element-bars {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.element-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.element-label {
    width: 20px;
    font-size: 0.9rem;
    font-weight: 700;
}

.bar-outer {
    flex: 1;
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    overflow: hidden;
}

.bar-inner {
    height: 100%;
    border-radius: 5px;
    transition: width 1s ease-out;
}

.element-pct {
    width: 38px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Element color definitions */
.element-gold { color: var(--gold-element); }
.element-wood { color: var(--wood-element); }
.element-water { color: var(--water-element); }
.element-fire { color: var(--fire-element); }
.element-earth { color: var(--earth-element); }

.element-gold-bg { background: var(--gold-element); box-shadow: 0 0 8px rgba(255,215,0,0.5); }
.element-wood-bg { background: var(--wood-element); box-shadow: 0 0 8px rgba(0,230,118,0.5); }
.element-water-bg { background: var(--water-element); box-shadow: 0 0 8px rgba(41,182,246,0.5); }
.element-fire-bg { background: var(--fire-element); box-shadow: 0 0 8px rgba(255,61,0,0.5); }
.element-earth-bg { background: var(--earth-element); box-shadow: 0 0 8px rgba(255,179,0,0.5); }

/* Analysis Boxes */
.analysis-box {
    background: rgba(10, 5, 25, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.2rem;
    transition: all 0.3s ease;
}

.analysis-box:hover {
    background: rgba(15, 8, 35, 0.5);
    border-color: rgba(212, 175, 55, 0.15);
}

.analysis-heading {
    font-family: 'Noto Serif TC', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold-text-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analysis-heading::before {
    content: "🔸";
    font-size: 0.8rem;
}

.analysis-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-muted);
    text-align: justify;
}

/* Name Divination Visual Grid styling */
.name-grid-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin: auto 0;
}

.name-visual-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
}

.grid-cell {
    background: rgba(10, 5, 27, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.8rem;
    text-align: center;
}

.grid-cell.highlight-cell {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

.grid-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.grid-val {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
}

.strokes-info {
    font-size: 1rem;
    text-align: center;
    line-height: 1.6;
}

/* Chinese Zodiac Tab & Horoscope styling */
.text-center {
    text-align: center;
}

.zodiac-avatar-container {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    background: radial-gradient(circle, rgba(122, 27, 154, 0.3) 0%, rgba(6, 2, 15, 0.8) 100%);
    border: 2px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(122, 27, 154, 0.5);
}

.zodiac-avatar {
    font-size: 4rem;
    user-select: none;
}

.compat-box {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.compat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 0.9rem;
}

.compat-label {
    color: var(--text-muted);
}

.compat-val {
    font-weight: 600;
    color: var(--text-color);
}

.chong-text {
    color: #ff5252;
}

/* Horoscope Meta Grid */
.horo-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    margin-top: 1rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 0.85rem;
}

.meta-label {
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.meta-val {
    font-weight: 600;
    color: var(--gold-text-color);
}

/* Recalculate container */
.recalc-container {
    text-align: center;
    margin-top: 2.5rem;
}

/* Footer styling */
.app-footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Keyframes and Animations */
@keyframes spin-clockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-counter-clockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes pulse-slow {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

@keyframes pulsate {
    0% { transform: scale(0.95); box-shadow: 0 0 10px #d4af37, 0 0 20px #7a1b9a; }
    100% { transform: scale(1.05); box-shadow: 0 0 20px #d4af37, 0 0 40px #7a1b9a; }
}

@keyframes shimmer-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .panel-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .panel-left {
        border-right: none;
        padding-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 2rem;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .tabs-nav {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .tab-link {
        padding: 0.8rem 0.4rem;
    }
    
    .app-header h1 {
        font-size: 2.2rem;
    }
    
    .card-content {
        padding: 1.5rem;
    }
    
    .tabs-content {
        padding: 1.5rem;
    }
}
