/**
 * 1_Main.css
 * Gold For Expats - Main Stylesheet
 * 
 * DESIGN: Dark theme with gold accents
 * APPROACH: Mobile-first responsive design
 * 
 * BREAKPOINTS:
 * - Mobile: < 480px (default)
 * - Tablet: 481px - 768px
 * - Desktop: 769px - 1024px
 * - Large: > 1024px
 */

/* ============== CSS VARIABLES ============== */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #242424;
    --bg-card-hover: #2d2d2d;
    
    /* Gold Accent Colors */
    --gold-primary: #d4af37;
    --gold-light: #f4d03f;
    --gold-dark: #b8960c;
    --gold-gradient: linear-gradient(135deg, #d4af37 0%, #f4d03f 50%, #d4af37 100%);
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #707070;
    --text-on-gold: #1a1a1a;
    
    /* Status Colors */
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #ef4444;
    --info: #60a5fa;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 4px 15px rgba(212, 175, 55, 0.3);
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Poppins', var(--font-primary);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    
    /* Touch targets (minimum 44px for mobile) */
    --touch-target: 48px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

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

/* ============== TYPOGRAPHY ============== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

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

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

/* ============== LAYOUT ============== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px; /* Space for bottom nav */
}

.main-content {
    flex: 1;
    padding: var(--space-md) 0;
}

/* ============== HEADER ============== */
.header {
    background: var(--bg-secondary);
    padding: var(--space-md);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

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

.logo-text {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Language Selector */
.lang-selector {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    min-height: var(--touch-target);
}

/* ============== COUNTRY SELECTOR ============== */
.country-selector-section {
    padding: var(--space-lg) var(--space-md);
    text-align: center;
}

.country-selector-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.country-selector-wrapper {
    position: relative;
    max-width: 300px;
    margin: 0 auto;
}

#countrySelector {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 2px solid var(--gold-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    min-height: var(--touch-target);
    text-align: center;
}

#countrySelector:focus {
    outline: none;
    box-shadow: var(--shadow-gold);
}

.country-selector-wrapper::after {
    content: '▼';
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-primary);
    pointer-events: none;
    font-size: 0.75rem;
}

/* ============== PRICE CARDS ============== */
.prices-section {
    padding: 0 var(--space-md);
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-lg);
    position: relative;
}

.section-title h2 {
    display: inline-block;
    padding: 0 var(--space-md);
    position: relative;
}

.section-title h2::before,
.section-title h2::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40px;
    height: 2px;
    background: var(--gold-gradient);
}

.section-title h2::before {
    right: 100%;
    margin-right: var(--space-sm);
}

.section-title h2::after {
    left: 100%;
    margin-left: var(--space-sm);
}

#pricesContainer {
    display: grid;
    gap: var(--space-md);
    grid-template-columns: 1fr;
}

.price-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.price-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.price-card[data-purity="24K"] {
    border-color: var(--gold-primary);
    border-width: 2px;
}

.price-card-header {
    background: linear-gradient(135deg, var(--bg-card-hover) 0%, var(--bg-card) 100%);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.purity-badge {
    background: var(--gold-gradient);
    color: var(--text-on-gold);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.875rem;
}

.purity-name {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.price-card-body {
    padding: var(--space-md);
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.price-row:last-child {
    border-bottom: none;
}

.price-row.main-price {
    padding: var(--space-md) 0;
}

.price-row.main-price .price {
    font-size: 1.5rem;
    color: var(--gold-primary);
    font-weight: 700;
}

.unit {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.price {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
}

/* ============== LAST UPDATED ============== */
.last-updated-section {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
}

#lastUpdated {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.refresh-btn {
    background: transparent;
    border: 1px solid var(--gold-primary);
    color: var(--gold-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    margin-left: var(--space-md);
    min-height: var(--touch-target);
    transition: all var(--transition-fast);
}

.refresh-btn:hover {
    background: var(--gold-primary);
    color: var(--text-on-gold);
}

/* ============== FALLBACK NOTICE ============== */
#fallbackNotice {
    display: none;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin: var(--space-md);
    text-align: center;
    color: var(--warning);
    font-size: 0.875rem;
}

.notice-icon {
    margin-right: var(--space-sm);
}

/* ============== LOADING STATE ============== */
.loading-state {
    text-align: center;
    padding: var(--space-2xl);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-card);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-md);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    color: var(--text-secondary);
}

/* ============== ERROR STATE ============== */
.error-state {
    text-align: center;
    padding: var(--space-2xl);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin: var(--space-md);
}

.error-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: var(--space-md);
}

.retry-btn {
    background: var(--gold-primary);
    color: var(--text-on-gold);
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--space-md);
    min-height: var(--touch-target);
    transition: background var(--transition-fast);
}

.retry-btn:hover {
    background: var(--gold-light);
}

/* ============== BOTTOM NAVIGATION ============== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--space-sm) 0;
    z-index: 100;
}

.nav-items {
    display: flex;
    justify-content: space-around;
    max-width: 500px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: var(--space-sm);
    min-width: 60px;
    transition: color var(--transition-fast);
}

.nav-item:hover,
.nav-item.active {
    color: var(--gold-primary);
}

.nav-icon {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============== RESPONSIVE: TABLET ============== */
@media (min-width: 481px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    
    .container {
        padding: 0 var(--space-lg);
    }
    
    #pricesContainer {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .price-row.main-price .price {
        font-size: 1.75rem;
    }
}

/* ============== RESPONSIVE: DESKTOP ============== */
@media (min-width: 769px) {
    .page-wrapper {
        padding-bottom: 0;
    }
    
    
    /* Show desktop header nav instead */
    .desktop-nav {
        display: flex;
    }
    
    #pricesContainer {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
    
    .price-card {
        padding: var(--space-sm);
    }
}

/* ============== RESPONSIVE: LARGE DESKTOP ============== */
@media (min-width: 1025px) {
    #pricesContainer {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .price-card-header {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
}
/* ============== FEATURE CARDS ============== */
.features-section {
    padding: var(--space-xl) var(--space-md);
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    max-width: 800px;
    margin: 0 auto;
}

.feature-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-fast);
}

.feature-card:hover {
    border-color: var(--gold-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.feature-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 var(--space-sm);
    color: var(--gold-primary);
}

.feature-desc {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 var(--space-md);
}

.feature-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gold-primary);
}

/* Tablet - 2 columns */
@media (min-width: 600px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* ============== UTILITY CLASSES ============== */
.text-gold {
    color: var(--gold-primary);
}

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

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============== ANIMATIONS ============== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============== PRINT STYLES ============== */
@media print {
    .header,
    .bottom-nav,
    .refresh-btn {
        display: none;
    }
    
    .page-wrapper {
        padding-bottom: 0;
    }
    
    .price-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}
