/* ========== Reset & Base ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a1a;
    --bg-card: rgba(18, 18, 40, 0.75);
    --bg-card-hover: rgba(24, 24, 52, 0.85);
    --border-card: rgba(139, 92, 246, 0.15);
    --border-glow: rgba(139, 92, 246, 0.35);
    --text-primary: #f0f0ff;
    --text-secondary: #a5a5c0;
    --text-muted: #6b6b8a;
    --accent-purple: #a78bfa;
    --accent-pink: #f472b6;
    --accent-cyan: #67e8f9;
    --accent-emerald: #6ee7b7;
    --accent-amber: #fbbf24;
    --gradient-main: linear-gradient(135deg, #a78bfa, #f472b6);
    --gradient-card: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(244, 114, 182, 0.08));
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --font-main: 'Prompt', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ========== Background Effects ========== */
.bg-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3), transparent 70%);
    top: -15%;
    right: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(244, 114, 182, 0.25), transparent 70%);
    bottom: -10%;
    left: -8%;
    animation-delay: -7s;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(103, 232, 249, 0.2), transparent 70%);
    top: 40%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(40px, 30px) scale(1.02); }
}

/* ========== Layout ========== */
.container {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px 20px;
}

/* ========== Header ========== */
.header {
    text-align: center;
    margin-bottom: 36px;
    animation: fadeInDown 0.8s ease-out;
}

.header-icon {
    margin-bottom: 16px;
    display: inline-block;
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.4)); }
    50% { filter: drop-shadow(0 0 20px rgba(167, 139, 250, 0.7)); }
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 300;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    backdrop-filter: blur(20px);
    transition: all 0.35s ease;
    animation: fadeInUp 0.6s ease-out both;
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-icon {
    font-size: 1.4rem;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========== Formula Card ========== */
.formula-display {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 18px 24px;
    text-align: center;
    margin-bottom: 20px;
}

.formula-display code {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 600;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.formula-legend {
    display: grid;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.92rem;
}

.legend-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.85rem;
    background: var(--gradient-main);
    color: #fff;
}

.legend-text {
    color: var(--text-secondary);
    font-weight: 300;
}

/* ========== Date Picker ========== */
.date-picker {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}

.picker-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.picker-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.picker-group select {
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 500;
    padding: 12px 36px 12px 16px;
    background: rgba(139, 92, 246, 0.06);
    border: 1.5px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a78bfa' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.picker-group select:hover {
    border-color: var(--accent-purple);
    background-color: rgba(139, 92, 246, 0.1);
}

.picker-group select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.picker-group select option {
    background: #1a1a3a;
    color: var(--text-primary);
}

/* ========== Calculate Button ========== */
.calculate-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--gradient-main);
    color: #fff;
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.35s ease;
    position: relative;
    overflow: hidden;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.35);
}

.calculate-btn:hover::before {
    opacity: 1;
}

.calculate-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.calculate-btn:hover .btn-icon {
    transform: scale(1.3) rotate(15deg);
}

/* ========== Results Section ========== */
.results-section {
    transition: all 0.5s ease;
}

.results-section.hidden {
    display: none;
}

.results-section .card {
    animation: fadeInUp 0.5s ease-out both;
}

.results-section .card:nth-child(1) { animation-delay: 0.1s; }
.results-section .card:nth-child(2) { animation-delay: 0.25s; }
.results-section .card:nth-child(3) { animation-delay: 0.4s; }
.results-section .card:nth-child(4) { animation-delay: 0.55s; }

/* ========== Birth Info ========== */
.birth-info {
    background: rgba(103, 232, 249, 0.06);
    border: 1px solid rgba(103, 232, 249, 0.15);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 18px;
    font-size: 1rem;
    color: var(--accent-cyan);
    font-weight: 500;
    text-align: center;
}

/* ========== Mapping Grid ========== */
.mapping-grid {
    display: grid;
    gap: 10px;
}

.mapping-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(139, 92, 246, 0.04);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(139, 92, 246, 0.08);
    transition: all 0.3s ease;
}

.mapping-row:hover {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.2);
}

.mapping-label {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 30px;
}

.mapping-arrow {
    color: var(--accent-purple);
    font-size: 0.85rem;
}

.mapping-formula {
    color: var(--text-secondary);
    font-size: 0.88rem;
    flex: 1;
}

.mapping-equals {
    color: var(--accent-pink);
    font-weight: 600;
    font-family: var(--font-mono);
}

.mapping-value {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1rem;
    color: var(--accent-emerald);
    min-width: 40px;
    text-align: right;
}

/* ========== Expression Display ========== */
.expression-display {
    background: rgba(244, 114, 182, 0.06);
    border: 1px solid rgba(244, 114, 182, 0.15);
    border-radius: var(--radius-md);
    padding: 22px 28px;
    text-align: center;
}

.expression-display code {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-pink);
    word-break: break-all;
    letter-spacing: 1px;
}

/* ========== Steps ========== */
.steps-list {
    display: grid;
    gap: 6px;
}

.step-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(110, 231, 183, 0.04);
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    animation: stepSlideIn 0.4s ease-out both;
}

.step-row:hover {
    background: rgba(110, 231, 183, 0.08);
    border-left-color: var(--accent-emerald);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(110, 231, 183, 0.12);
    color: var(--accent-emerald);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-expression {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-all;
}

.step-expression .step-op {
    color: var(--accent-purple);
    font-weight: 600;
}

.step-expression .step-result {
    color: var(--accent-amber);
    font-weight: 600;
}

@keyframes stepSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== Answer ========== */
.answer-display {
    text-align: center;
    padding: 20px;
}

.answer-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 400;
}

.answer-value {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: answer-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes answer-pop {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.answer-card {
    border-color: rgba(244, 114, 182, 0.25);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(244, 114, 182, 0.06));
}

.answer-card:hover {
    border-color: rgba(244, 114, 182, 0.4);
    box-shadow: 0 0 40px rgba(244, 114, 182, 0.15);
}

/* ========== Footer ========== */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 30px 20px 40px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 300;
}

/* ========== Animations ========== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
    .container {
        padding: 24px 14px 14px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .date-picker {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .formula-display code {
        font-size: 1.05rem;
        letter-spacing: 1px;
    }

    .card {
        padding: 20px;
    }

    .expression-display code {
        font-size: 1rem;
    }

    .answer-value {
        font-size: 1.6rem;
    }

    .step-expression {
        font-size: 0.85rem;
    }
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}
