/* ============================================================
   assets/css/gold-silver-price.css
   ============================================================
   Tool-specific rules for [gold_silver_price]. The outer card,
   header bar, title, badge and body padding all come from the
   shared .at-tool / .at-tool__header / .at-tool__title /
   .at-tool__badge / .at-tool__body rules in tools-unified.css
   (loaded as a dependency of this file) — same split as
   url-shortener.css and qr-code-generator.css. Everything below
   is only the price-table / chart / trend layout unique to this
   tool, built on the same --at-* tokens from shared.css so it
   follows the theme automatically.
   ============================================================ */

.gsp-container {
    font-family: var(--at-font-family), 'Noto Sans Bengali', sans-serif;
}

/* ---------- Header extras: live badge + last-update line ---------- */
.gsp-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.gsp-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--at-success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
    animation: gsp-pulse 1.8s ease-out infinite;
}
@keyframes gsp-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.gsp-last-update {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
}
.gsp-last-update svg { flex-shrink: 0; }

.gsp-body {
    display: flex;
    flex-direction: column;
    gap: var(--at-section-padding);
}

/* ---------- Generic sub-card used for quick-info / history / chart / trend ---------- */
.gsp-card {
    background: color-mix(in srgb, var(--at-surface) 92%, white 2%);
    border: 1px solid var(--at-border);
    border-radius: var(--at-group-radius);
    padding: var(--at-section-padding);
}
.gsp-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--at-border);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--at-foreground);
}
.gsp-card-title svg { color: var(--at-primary); flex-shrink: 0; }
.gsp-card-title--center { justify-content: center; text-align: center; }

.gsp-error:empty { display: none; }

/* ---------- Quick info grid ---------- */
.gsp-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.gsp-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 10px;
    border-radius: var(--at-group-radius);
    background: color-mix(in srgb, var(--at-surface) 80%, black 6%);
    border: 1px solid var(--at-border);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.gsp-info-item:hover {
    transform: translateY(-2px);
    border-color: var(--at-primary);
}
.gsp-info-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--at-primary);
    margin-bottom: 6px;
    word-break: break-word;
}
.gsp-info-label {
    font-size: 0.8rem;
    color: var(--at-muted);
    font-weight: 500;
}

/* ---------- Gold / Silver price cards ---------- */
.gsp-price-card {
    border: 1px solid var(--at-border);
    border-radius: var(--at-group-radius);
    overflow: hidden;
    background: color-mix(in srgb, var(--at-surface) 92%, white 2%);
}
.gsp-price-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--at-primary), var(--at-primary-dark));
    color: #fff;
}
.gsp-price-card-header--silver {
    background: linear-gradient(135deg, var(--at-accent), color-mix(in srgb, var(--at-accent) 70%, black));
    color: #08202a;
}
.gsp-price-card-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
}

/* Unit switch pill, mirrors the look of .at-tool__badge's pill shape */
.gsp-unit-switch {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 20px;
    padding: 3px;
    gap: 3px;
}
.gsp-price-card-header--silver .gsp-unit-switch { background: rgba(8, 32, 42, 0.18); }
.gsp-unit-btn {
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.85;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}
.gsp-unit-btn.is-active {
    background: #fff;
    color: var(--at-primary-dark);
    opacity: 1;
}
.gsp-price-card-header--silver .gsp-unit-btn.is-active {
    color: color-mix(in srgb, var(--at-accent) 70%, black);
}

.gsp-price-content { display: none; padding: 16px; }
.gsp-price-content.is-active { display: flex; flex-direction: column; gap: 14px; }

.gsp-karat-section {
    text-align: center;
    background: color-mix(in srgb, var(--at-surface) 80%, black 6%);
    border: 1px solid var(--at-border);
    border-radius: var(--at-group-radius);
    padding: 16px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.gsp-karat-section:hover {
    border-color: var(--at-primary);
    transform: translateY(-2px);
}
.gsp-karat-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0 auto 14px;
}
.gsp-karat-circle--gold {
    background: color-mix(in srgb, var(--at-primary) 22%, transparent);
    color: var(--at-primary);
}
.gsp-karat-circle--silver {
    background: color-mix(in srgb, var(--at-accent) 22%, transparent);
    color: var(--at-accent);
}

.gsp-prices-row {
    display: flex;
    gap: 14px;
    justify-content: center;
}
.gsp-price-item { flex: 1; min-width: 0; }
.gsp-price-label {
    font-size: 0.75rem;
    color: var(--at-muted);
    margin-bottom: 6px;
}
.gsp-price-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--at-primary);
    padding: 4px;
    border-radius: 6px;
    transition: background-color 0.4s ease, color 0.4s ease;
}
.gsp-price-value--silver { color: var(--at-accent); }
.gsp-price-item--buy .gsp-price-value { color: var(--at-success); }
.gsp-price-item--sell .gsp-price-value { color: var(--at-error-text-dark); }
.gsp-price-unit {
    font-size: 0.72rem;
    color: var(--at-muted);
    margin-top: 2px;
}

/* Flash highlight when a price refreshes — mirrors the plugin-wide
   fixed success/error convention (see shared.css): this is a status
   flash, not a themeable decorative color, so it stays fixed yellow
   regardless of theme, same reasoning as --at-success/--at-error. */
.gsp-price-value.gsp-flash {
    background: #facc15 !important;
    color: #1a1a1a !important;
    box-shadow: 0 0 0 1px #facc15;
}

/* ---------- Price history rows ---------- */
.gsp-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed var(--at-border);
    color: var(--at-foreground);
    font-size: 0.9rem;
}
.gsp-history-row--last { border-bottom: none; }

/* ---------- Chart ---------- */
.gsp-chart-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}
.gsp-chart-btn {
    padding: 7px 16px;
    border-radius: 20px;
    border: 1px solid var(--at-border);
    background: color-mix(in srgb, var(--at-surface) 80%, black 6%);
    color: var(--at-foreground);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.gsp-chart-btn.is-active {
    background: var(--at-primary);
    border-color: var(--at-primary);
    color: #fff;
}
.gsp-chart-wrap {
    width: 100%;
    overflow-x: auto;
}
.gsp-chart-wrap svg { display: block; width: 100%; height: auto; }
.gsp-chart-point {
    fill: var(--at-primary);
    stroke: var(--at-surface);
    stroke-width: 1.5;
}
.gsp-chart-tooltip {
    font-size: 10px;
    fill: var(--at-foreground);
}
.gsp-chart-axis-label {
    font-size: 10px;
    fill: var(--at-muted);
}

/* ---------- Trend cards ---------- */
.gsp-trend-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.gsp-trend-card {
    background: color-mix(in srgb, var(--at-surface) 80%, black 6%);
    border: 1px solid var(--at-border);
    border-left: 4px solid var(--at-primary);
    border-radius: var(--at-group-radius);
    padding: 18px;
    text-align: center;
    transition: transform 0.2s ease;
}
.gsp-trend-card:hover { transform: translateY(-3px); }
.gsp-trend-icon {
    display: inline-flex;
    color: var(--at-primary);
    margin-bottom: 10px;
}
.gsp-trend-icon svg { width: 1.6em; height: 1.6em; }
.gsp-trend-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--at-foreground);
    margin-bottom: 6px;
}
.gsp-trend-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--at-foreground);
    margin-bottom: 4px;
}
.gsp-trend-desc {
    font-size: 0.8rem;
    color: var(--at-muted);
}

/* ---------- Footer note ---------- */
.gsp-footer-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--at-muted);
    padding-top: 4px;
}
.gsp-next-update {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--at-surface) 80%, black 6%);
    border: 1px solid var(--at-border);
    color: var(--at-foreground);
}
.gsp-sync-icon { animation: gsp-spin 2.2s linear infinite; color: var(--at-primary); }
@keyframes gsp-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .gsp-live-dot, .gsp-sync-icon { animation: none !important; }
    .gsp-karat-section:hover, .gsp-info-item:hover, .gsp-trend-card:hover { transform: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .gsp-info-grid { gap: 8px; }
    .gsp-info-value { font-size: 1rem; }
    .gsp-prices-row { gap: 6px; }
    .gsp-price-value { font-size: 1rem; }
    .gsp-price-label { font-size: 0.68rem; }
    .gsp-price-card-header { flex-direction: column; align-items: stretch; text-align: center; }
    .gsp-unit-switch { justify-content: center; }
    .gsp-karat-circle { font-size: 0.78rem; min-width: 70px; }
}
