/* 
========================================================================
   CEYLON GOLD RATE - PREMIUM STYLING SYSTEM
   Built with modern Vanilla CSS, featuring variables, glassmorphism,
   fluid animations, and premium dark/light modes.
========================================================================
*/

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,400&display=swap');

/* --- CSS Variables & Design System --- */
:root {
    /* Color Palette - Common */
    --gold-primary: #e5b83b;
    --gold-secondary: #c29523;
    --gold-light: #f5d682;
    --gold-dark: #8c6a12;
    --gold-gradient: linear-gradient(135deg, #f5d682 0%, #e5b83b 50%, #c29523 100%);
    --gold-glow: rgba(229, 184, 59, 0.35);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    
    /* Layout Constants */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-glow: 0 8px 32px 0 rgba(229, 184, 59, 0.15);
    
    /* Font Families */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Theme Variables --- */
/* Dark Mode (Default) */
[data-theme="dark"] {
    --bg-base: #090a0c;
    --bg-surface: rgba(17, 20, 26, 0.75);
    --bg-surface-solid: #11141a;
    --bg-surface-hover: #191e27;
    --border-color: rgba(229, 184, 59, 0.12);
    --border-hover: rgba(229, 184, 59, 0.3);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --shadow-main: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    --glass-blur: blur(16px);
    --input-bg: rgba(25, 30, 39, 0.6);
    --nav-bg: rgba(9, 10, 12, 0.85);
}

/* Light Mode */
[data-theme="light"] {
    --bg-base: #f5f7fa;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --bg-surface-solid: #ffffff;
    --bg-surface-hover: #f9fafb;
    --border-color: rgba(194, 149, 35, 0.18);
    --border-hover: rgba(194, 149, 35, 0.4);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --shadow-main: 0 12px 40px 0 rgba(194, 149, 35, 0.08);
    --glass-blur: blur(16px);
    --input-bg: rgba(255, 255, 255, 0.9);
    --nav-bg: rgba(245, 247, 250, 0.85);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    height: -webkit-fill-available;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-secondary);
}

/* --- Typographical Presets --- */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
}

a {
    color: var(--gold-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--gold-light);
}

.gold-gradient-text {
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* --- Layout Wrappers --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Premium Navigation Header --- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px var(--gold-glow));
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, rgba(229, 184, 59, 0.1) 0%, rgba(194, 149, 35, 0.2) 100%);
    border: 1px solid rgba(229, 184, 59, 0.3);
    color: var(--gold-light);
    display: inline-flex;
    align-items: center;
    height: fit-content;
    margin-top: 2px;
    box-shadow: 0 0 8px rgba(229, 184, 59, 0.1);
}

.brand-sub {
    font-size: 0.75rem;
    font-family: var(--font-body);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--gold-primary);
    display: block;
    margin-top: -2px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ticker-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-hover);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 1.8s infinite alternate;
}

/* --- Button Styles & Controls --- */
.btn-theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.15rem;
    transition: all var(--transition-fast);
    background: var(--bg-surface);
}

.btn-theme-toggle:hover {
    border-color: var(--gold-primary);
    box-shadow: 0 0 12px var(--gold-glow);
    transform: rotate(15deg);
}

[data-theme="light"] .sun-icon,
[data-theme="dark"] .moon-icon {
    display: none;
}

.btn-refresh {
    background: var(--gold-gradient);
    color: #111827;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-glow);
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px var(--gold-glow);
    filter: brightness(1.08);
}

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

.btn-refresh.loading i {
    animation: rotate 1s linear infinite;
}

/* --- Hero Section & Core Metrics --- */
.hero-section {
    padding: 3rem 0 2rem;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    font-size: 1.05rem;
}

/* Main Rates Spotlight */
.rates-spotlight {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 3rem;
}

.spotlight-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-main);
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.spotlight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gold-gradient);
    opacity: 0.8;
}

.spotlight-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow), var(--shadow-main);
}

.spotlight-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.karat-badge {
    background: var(--gold-gradient);
    color: #111827;
    padding: 6px 14px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.trend-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.825rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.trend-badge.up {
    color: var(--success);
    background: var(--success-bg);
}

.trend-badge.down {
    color: var(--danger);
    background: var(--danger-bg);
}

.spotlight-price-box {
    margin-bottom: 24px;
    text-align: left;
}

.price-label {
    font-size: 0.825rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
    display: block;
}

.price-val {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-body);
    line-height: 1.1;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.price-sub {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    gap: 16px;
    text-align: left;
}

.metric-item-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.metric-item-val {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Section Toggles & Multi-Karat Grid --- */
.section-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 12px;
}

.section-title {
    font-size: 1.75rem;
    position: relative;
    padding-bottom: 6px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--gold-gradient);
    border-radius: 2px;
}

/* Premium Segmented Toggle */
.segmented-control {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: 30px;
    display: inline-flex;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-option {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 25px;
    transition: all var(--transition-fast);
    user-select: none;
    border: none;
    background: none;
    color: var(--text-secondary);
}

.control-option.active {
    background: var(--gold-gradient);
    color: #111827;
    box-shadow: 0 4px 12px var(--gold-glow);
}

/* Comprehensive Pricing Cards */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 3.5rem;
}

.pricing-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    position: relative;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-main);
}

.pricing-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), var(--shadow-main);
}

.pricing-card-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.pricing-card-karat {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
}

.pricing-card-purity {
    font-size: 0.75rem;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 12px;
    color: var(--text-secondary);
}

.pricing-card-price {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.pricing-card-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    font-size: 0.825rem;
    color: var(--text-secondary);
}

/* --- Features Block: Calculator & Graph --- */
.features-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 32px;
    margin-bottom: 4rem;
    align-items: start;
}

@media (max-width: 992px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-main);
}

.card-title-area {
    margin-bottom: 1.5rem;
}

/* Sleek Line Chart */
.chart-container {
    position: relative;
    width: 100%;
    height: 360px;
}

/* Gold Price Calculator UI */
.calculator-form {
    display: grid;
    gap: 20px;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.form-group label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.form-control {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-fast);
}

.form-control:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(229, 184, 59, 0.15);
}

/* Custom styles for select tag arrow */
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23e5b83b' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.input-suffix {
    position: absolute;
    right: 16px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrapper .form-control {
    padding-right: 48px;
}

/* Calculator Output Area */
.calc-output {
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 8px;
    transition: background-color var(--transition-normal);
}

.calc-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-label {
    font-weight: 700;
    font-size: 1rem;
}

.result-price {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--gold-primary);
    font-family: var(--font-body);
    letter-spacing: -0.02em;
    filter: drop-shadow(0 2px 4px var(--gold-glow));
}

/* --- Interactive FAQ Accordion --- */
.faq-section {
    max-width: 800px;
    margin: 0 auto 5rem;
}

.faq-title {
    text-align: center;
    margin-bottom: 2.5rem;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.faq-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-main);
}

.faq-item:hover {
    border-color: var(--border-hover);
}

.faq-question-btn {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 20px 24px;
    text-align: left;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.faq-icon-wrapper {
    background: var(--bg-surface-hover);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--gold-primary);
    transition: transform var(--transition-normal), background-color var(--transition-normal);
    border: 1px solid var(--border-color);
}

.faq-item.active {
    border-color: var(--gold-primary);
}

.faq-item.active .faq-icon-wrapper {
    transform: rotate(180deg);
    background: var(--gold-primary);
    color: #111827;
    border-color: var(--gold-primary);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal) ease-out;
}

.faq-answer-inner {
    padding: 0 24px 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    border-top: 1px solid transparent;
}

.faq-item.active .faq-answer {
    max-height: 200px;
}

.faq-item.active .faq-answer-inner {
    border-top-color: var(--border-color);
}

/* --- Footer Area --- */
.app-footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface-solid);
    padding: 3rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    transition: border-color var(--transition-normal), background-color var(--transition-normal);
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.footer-disclaimer {
    max-width: 700px;
    margin: 1.5rem auto 1.5rem;
    font-size: 0.775rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.footer-copy {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    font-size: 0.775rem;
}

.footer-brand-link {
    color: var(--gold-primary);
    font-weight: 600;
    transition: color var(--transition-fast), text-shadow var(--transition-fast);
}

.footer-brand-link:hover {
    color: var(--gold-light);
    text-shadow: 0 0 8px var(--gold-glow);
}

/* --- Micro-Animations --- */
@keyframes pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 4px var(--success);
    }
    100% {
        transform: scale(1.1);
        box-shadow: 0 0 12px var(--success);
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    .rates-spotlight {
        grid-template-columns: 1fr;
    }
    .pricing-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    .faq-question-btn {
        padding: 16px 20px;
        font-size: 1.05rem;
    }
    .faq-answer-inner {
        padding: 0 20px 16px;
    }
}
