/* 
 * Price.web.id - Main Stylesheet
 * Dark Theme with Glassmorphism
 */

/* ===================================
   CSS Variables
   =================================== */
:root {
    /* Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-card-hover: rgba(30, 41, 59, 0.95);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-gold: #f59e0b;
    --accent-gold-light: #fbbf24;
    --accent-orange: #f97316;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-purple: #a855f7;

    --border-color: rgba(148, 163, 184, 0.1);
    --glow-gold: 0 0 20px rgba(245, 158, 11, 0.3);
    --glow-green: 0 0 15px rgba(34, 197, 94, 0.3);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ===================================
   Reset & Base
   =================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-gold);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===================================
   Layout
   =================================== */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--space-xl) 0;
}

/* ===================================
   Navigation
   =================================== */
.navbar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    max-width: 1280px;
    margin: 0 auto;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.navbar-brand span {
    color: var(--accent-gold);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.navbar-menu a {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-weight: 500;
}

.navbar-menu a:hover,
.navbar-menu a.active {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.navbar-menu a.active {
    color: var(--accent-gold);
}

/* Currency Selector */
.currency-selector {
    position: relative;
}

.currency-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.currency-btn:hover {
    border-color: var(--accent-gold);
}

.currency-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 180px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 200;
}

.currency-selector.open .currency-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.currency-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.currency-option:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.currency-option.active {
    color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.1);
}

.currency-option .flag {
    font-size: 1.25rem;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    padding: var(--space-sm);
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .navbar-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: var(--space-md);
        display: none;
    }

    .navbar-menu.open {
        display: flex;
    }

    .navbar-menu a {
        width: 100%;
        justify-content: center;
    }
}

/* ===================================
   Price Cards
   =================================== */
.price-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
    width: 100%;
}

/* Full width card override - for span 2 cards in 4-col grid */
.price-grid .price-card[style*="span 2"] {
    min-height: 180px;
}

/* Tablet: 2 columns */
@media (max-width: 1024px) {
    .price-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Full width on tablet for span 2 cards */
    .price-grid .price-card[style*="span 2"] {
        grid-column: span 2;
    }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
    .price-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    /* Reset span on mobile - full width single column */
    .price-grid .price-card[style*="span 2"] {
        grid-column: span 1;
    }
}

.price-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    min-width: 0;
    /* Allow shrinking */
}

.price-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--card-accent, var(--accent-gold)), transparent);
}

.price-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: var(--glow-gold);
}

.price-card.gold {
    --card-accent: var(--accent-gold);
}

.price-card.crypto {
    --card-accent: var(--accent-orange);
}

.price-card.stock {
    --card-accent: var(--accent-green);
}

.price-card.forex {
    --card-accent: var(--accent-blue);
}

.price-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    gap: var(--space-sm);
}

.price-card-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.price-card-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-md);
    color: var(--card-accent, var(--accent-gold));
    flex-shrink: 0;
}

.price-card-value {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.price-card-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.price-card-change.up {
    color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
}

.price-card-change.down {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.price-card-sparkline {
    height: 50px;
    margin-top: var(--space-md);
}

.price-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-muted);
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.price-card-footer a {
    white-space: nowrap;
}

/* ===================================
   Section Headers
   =================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-title .icon {
    color: var(--accent-gold);
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===================================
   Charts
   =================================== */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.chart-range-selector {
    display: flex;
    gap: var(--space-xs);
}

.chart-range-btn {
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.chart-range-btn:hover {
    border-color: var(--accent-gold);
    color: var(--text-primary);
}

.chart-range-btn.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--bg-primary);
}

.chart-canvas-wrapper {
    position: relative;
    height: 300px;
}

/* Chart Loading Spinner */
.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: none;
}

.chart-canvas-wrapper.loading .chart-loading {
    display: block;
}

.chart-canvas-wrapper.loading canvas {
    opacity: 0.3;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   Tables
   =================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.data-table th,
.data-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    font-size: 0.875rem;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.data-table .price {
    font-weight: 600;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
}

.data-table .change.up {
    color: var(--accent-green);
}

.data-table .change.down {
    color: var(--accent-red);
}

@media (max-width: 640px) {

    .data-table th,
    .data-table td {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.75rem;
    }

    .data-table .price {
        font-size: 0.75rem;
    }
}

/* ===================================
   Currency Rate Cards
   =================================== */
.currency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
}

.currency-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
    min-width: 0;
    overflow: hidden;
}

.currency-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.currency-flag {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.currency-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.currency-code {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.currency-rate {
    font-size: clamp(0.875rem, 3vw, 1.125rem);
    font-weight: 700;
    color: var(--accent-blue);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.currency-change {
    font-size: 0.7rem;
}

/* ===================================
   Footer
   =================================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-xl) 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-links {
    display: flex;
    gap: var(--space-lg);
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===================================
   Ads Slots
   =================================== */
.ad-slot {
    text-align: center;
    margin: var(--space-lg) 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-slot.header-ad {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.ad-placeholder {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===================================
   Language Selector
   =================================== */
.lang-selector {
    position: relative;
    margin-left: var(--space-sm);
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.lang-btn:hover {
    border-color: var(--accent-gold);
    color: var(--text-primary);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 120px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 200;
}

.lang-selector.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.lang-option:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.lang-option.active {
    color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.1);
}

/* ===================================
   Popup Ads
   =================================== */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 500px;
    width: 90%;
    position: relative;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.popup-overlay.active .popup-content {
    transform: scale(1);
}

.popup-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    transition: color var(--transition-fast);
}

.popup-close:hover {
    color: var(--text-primary);
}

/* ===================================
   Loading States
   =================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   Utilities
   =================================== */
.text-gold {
    color: var(--accent-gold);
}

.text-green {
    color: var(--accent-green);
}

.text-red {
    color: var(--accent-red);
}

.text-blue {
    color: var(--accent-blue);
}

.text-muted {
    color: var(--text-muted);
}

.bg-gold {
    background: var(--accent-gold);
}

.bg-green {
    background: var(--accent-green);
}

.bg-red {
    background: var(--accent-red);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.text-sm {
    font-size: 0.875rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 640px) {
    .price-card-value {
        font-size: 1.5rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}

/* Mobile Sticky Ad */
.mobile-sticky-ad {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
}

@media (max-width: 768px) {
    .mobile-sticky-ad {
        display: block;
    }

    .main-content {
        padding-bottom: 70px;
    }
}