/* =========================================
   Canlı Altın Kuru v5.0
   Premium Finance Design — Mobile First
   ========================================= */

:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   Light Theme
   ========================================= */
[data-theme="light"] {
    --bg-primary: #f0f2f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-row-hover: rgba(212, 168, 66, 0.04);
    --bg-header: linear-gradient(135deg, #111827 0%, #1e293b 50%, #0f172a 100%);
    --header-text: #f8fafc;
    --header-border: rgba(234, 179, 8, 0.35);

    --gold-primary: #ca8a04;
    --gold-secondary: #eab308;
    --gold-light: rgba(234, 179, 8, 0.07);
    --gold-glow: rgba(234, 179, 8, 0.15);
    --blue-primary: #2563eb;
    --blue-light: rgba(37, 99, 235, 0.06);
    --blue-glow: rgba(37, 99, 235, 0.12);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: rgba(0, 0, 0, 0.06);
    --border-gold: rgba(234, 179, 8, 0.2);
    --border-blue: rgba(37, 99, 235, 0.15);

    --up-color: #16a34a;
    --up-bg: rgba(22, 163, 74, 0.08);
    --down-color: #dc2626;
    --down-bg: rgba(220, 38, 38, 0.08);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);
    --shadow-header: 0 4px 30px rgba(0, 0, 0, 0.15);

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
}

/* =========================================
   Dark Theme
   ========================================= */
[data-theme="dark"] {
    --bg-primary: #080b14;
    --bg-secondary: #111827;
    --bg-card: #1e293b;
    --bg-row-hover: rgba(234, 179, 8, 0.04);
    --bg-header: linear-gradient(135deg, #0a0e1a 0%, #111827 50%, #0f172a 100%);
    --header-text: #f1f5f9;
    --header-border: rgba(234, 179, 8, 0.25);

    --gold-primary: #facc15;
    --gold-secondary: #eab308;
    --gold-light: rgba(250, 204, 21, 0.06);
    --gold-glow: rgba(250, 204, 21, 0.1);
    --blue-primary: #60a5fa;
    --blue-light: rgba(96, 165, 250, 0.06);
    --blue-glow: rgba(96, 165, 250, 0.1);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #475569;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-gold: rgba(250, 204, 21, 0.15);
    --border-blue: rgba(96, 165, 250, 0.12);

    --up-color: #4ade80;
    --up-bg: rgba(74, 222, 128, 0.1);
    --down-color: #f87171;
    --down-bg: rgba(248, 113, 113, 0.1);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-header: 0 4px 30px rgba(0, 0, 0, 0.6);

    --glass-bg: rgba(17, 24, 39, 0.8);
    --glass-border: rgba(255, 255, 255, 0.06);
}

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

html {
    height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

/* =========================================
   Arrow Indicators
   ========================================= */
.arrow {
    font-size: 0.6em;
    margin-right: 2px;
    display: inline-block;
    animation: arrowPulse 0.5s ease-out;
}

.arrow.up {
    color: var(--up-color);
}

.arrow.down {
    color: var(--down-color);
}

.price-value.up,
.price-value.yukari {
    color: var(--up-color);
}

.price-value.down,
.price-value.asagi {
    color: var(--down-color);
}

@keyframes arrowPulse {
    0% {
        opacity: 0;
        transform: scale(1.8) translateY(-2px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* =========================================
   Header — Premium Sticky Nav
   ========================================= */
.header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--shadow-header);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 8px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 32px;
    height: 32px;
}

.logo h1 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--header-text);
    letter-spacing: -0.3px;
    white-space: nowrap;
    line-height: 1.2;
}

.logo h1 .logo-accent {
    background: linear-gradient(135deg, #facc15, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.update-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--header-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    transition: all var(--transition);
    flex-shrink: 0;
}

.status-dot.healthy {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: pulseGreen 2s ease-in-out infinite;
}

.status-dot.stale {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

@keyframes pulseGreen {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    }

    50% {
        opacity: 0.6;
        box-shadow: 0 0 4px rgba(34, 197, 94, 0.3);
    }
}

.control-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all var(--transition);
    color: var(--header-text);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--gold-primary);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

/* =========================================
   Provider Toggle
   ========================================= */
.provider-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    flex-shrink: 0;
}

.provider-btn {
    padding: 5px 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-family);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.provider-btn:hover {
    color: rgba(255, 255, 255, 0.8);
}

.provider-btn.active {
    background: linear-gradient(135deg, #eab308, #ca8a04);
    color: #0f172a;
    font-weight: 700;
}

/* Theme icon states */
[data-theme="light"] .theme-icon-light {
    display: inline;
}

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

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

[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

/* View icon states */
[data-view="list"] .view-icon-list {
    display: none;
}

[data-view="list"] .view-icon-card {
    display: inline;
}

[data-view="card"] .view-icon-list {
    display: inline;
}

[data-view="card"] .view-icon-card {
    display: none;
}

/* =========================================
   Main Content
   ========================================= */
.main {
    flex: 1;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    align-content: start;
}

/* =========================================
   Sections — Glassmorphism
   ========================================= */
.section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: box-shadow var(--transition);
}

.section-title {
    font-size: 0.88rem;
    font-weight: 700;
    padding: 14px 16px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.01em;
}

.gold-section .section-title {
    color: var(--gold-primary);
}

.currency-section .section-title {
    color: var(--blue-primary);
}

/* =========================================
   Table Header
   ========================================= */
.table-header {
    display: grid;
    grid-template-columns: 1fr auto auto;
    padding: 6px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    gap: 8px;
}

.col-price {
    text-align: right;
    min-width: 70px;
}

/* =========================================
   Change Badge
   ========================================= */
.change-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

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

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

/* =========================================
   LIST VIEW
   ========================================= */
[data-view="list"] .prices-container {
    display: flex;
    flex-direction: column;
}

[data-view="list"] .price-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    cursor: pointer;
    transition: background var(--transition);
    gap: 8px;
}

[data-view="list"] .price-row:last-child {
    border-bottom: none;
}

[data-view="list"] .price-row:hover {
    background: var(--bg-row-hover);
}

[data-view="list"] .price-row:active {
    background: var(--gold-light);
}

[data-view="list"] .card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    margin: 0;
    border: none;
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
}

[data-view="list"] .card-body {
    display: contents;
}

[data-view="list"] .price-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 70px;
}

[data-view="list"] .price-label {
    display: none;
}

[data-view="list"] .price-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-view="list"] .price-code {
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--gold-light);
    color: var(--gold-primary);
    letter-spacing: 0.04em;
    flex-shrink: 0;
    border: 1px solid var(--border-gold);
}

.currency-section [data-view="list"] .price-code,
[data-view="list"] .currency-section .price-code {
    background: var(--blue-light);
    color: var(--blue-primary);
    border-color: var(--border-blue);
}

[data-view="list"] .price-value {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    font-weight: 700;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    min-width: 70px;
    transition: color 0.3s;
}

/* =========================================
   CARD VIEW
   ========================================= */
[data-view="card"] .table-header {
    display: none;
}

[data-view="card"] .prices-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 12px;
}

[data-view="card"] .price-row {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--gold-primary);
    border-radius: var(--radius-md);
    padding: 0;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.currency-section [data-view="card"] .price-row,
[data-view="card"] .currency-section .price-row {
    border-left-color: var(--blue-primary);
}

[data-view="card"] .price-row:hover {
    background: var(--bg-row-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold-glow);
}

[data-view="card"] .card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px 8px;
    border-bottom: 1px solid var(--border-color);
}

[data-view="card"] .price-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-view="card"] .price-code {
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--gold-light);
    color: var(--gold-primary);
    letter-spacing: 0.04em;
    border: 1px solid var(--border-gold);
    flex-shrink: 0;
}

.currency-section [data-view="card"] .price-code,
[data-view="card"] .currency-section .price-code {
    background: var(--blue-light);
    color: var(--blue-primary);
    border-color: var(--border-blue);
}

[data-view="card"] .card-body {
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

[data-view="card"] .price-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-view="card"] .price-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

[data-view="card"] .price-value {
    font-weight: 800;
    font-size: 0.98rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 3px;
    transition: color 0.3s;
}

/* =========================================
   Loading
   ========================================= */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.4s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.loading-placeholder {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* =========================================
   SEO Content
   ========================================= */
.seo-content {
    padding: 24px 16px;
    max-width: 800px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.7;
}

.seo-content h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 800;
}

.seo-content h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 20px 0 8px;
    font-weight: 700;
}

.seo-content p {
    margin-bottom: 12px;
}

.seo-content ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

.seo-content li {
    margin-bottom: 6px;
}

/* =========================================
   Footer
   ========================================= */
.footer {
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.footer a {
    color: var(--gold-primary);
    transition: opacity var(--transition);
}

.footer a:hover {
    opacity: 0.7;
}

.footer-line+.footer-line {
    margin-top: 3px;
}

/* =========================================
   Responsive: Tablet (900px)
   ========================================= */
@media (min-width: 901px) {
    .header {
        padding: 14px 24px;
    }

    .logo h1 {
        font-size: 1.15rem;
    }

    .logo-icon,
    .logo-icon svg {
        width: 36px;
        height: 36px;
    }

    .main {
        padding: 20px;
        gap: 20px;
    }

    .section-title {
        padding: 16px 20px 12px;
        font-size: 0.95rem;
    }

    .table-header {
        padding: 8px 20px;
    }

    [data-view="list"] .price-row {
        padding: 13px 20px;
    }

    .col-price {
        min-width: 100px;
    }

    [data-view="list"] .price-cell {
        min-width: 100px;
    }

    [data-view="list"] .price-value {
        font-size: 0.9rem;
        min-width: 100px;
    }

    [data-view="list"] .price-name {
        font-size: 0.9rem;
    }

    [data-view="card"] .prices-container {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 12px;
        padding: 16px;
    }

    .footer {
        padding: 16px 24px;
        font-size: 0.72rem;
    }
}

/* =========================================
   Responsive: Mobile Single Column (900px)
   ========================================= */
@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }

    [data-view="card"] .prices-container {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* =========================================
   Responsive: Small Mobile (480px)
   ========================================= */
@media (max-width: 480px) {
    .header {
        padding: 10px 12px;
        gap: 8px;
    }

    .logo h1 {
        font-size: 0.88rem;
    }

    .provider-btn {
        padding: 4px 10px;
        font-size: 0.68rem;
    }

    .update-badge {
        padding: 3px 7px;
        font-size: 0.65rem;
    }

    .control-btn {
        width: 30px;
        height: 30px;
        font-size: 0.82rem;
    }

    .main {
        padding: 8px;
        gap: 8px;
    }

    .section {
        border-radius: var(--radius-md);
    }

    .section-title {
        padding: 10px 12px 8px;
        font-size: 0.82rem;
    }

    .table-header {
        padding: 5px 12px;
        font-size: 0.6rem;
        gap: 4px;
    }

    .col-price {
        min-width: 60px;
    }

    [data-view="list"] .price-row {
        padding: 9px 12px;
        gap: 4px;
    }

    [data-view="list"] .price-cell {
        min-width: 60px;
    }

    [data-view="list"] .price-value {
        font-size: 0.75rem;
        min-width: 60px;
    }

    [data-view="list"] .price-name {
        font-size: 0.78rem;
    }

    [data-view="list"] .price-code {
        font-size: 0.5rem;
        padding: 1px 4px;
    }

    [data-view="card"] .prices-container {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 8px;
    }

    [data-view="card"] .price-name {
        font-size: 0.78rem;
    }

    [data-view="card"] .price-value {
        font-size: 0.85rem;
    }

    [data-view="card"] .card-header {
        padding: 8px 10px 6px;
    }

    [data-view="card"] .card-body {
        padding: 6px 10px 8px;
    }

    .footer {
        padding: 10px 12px;
        font-size: 0.62rem;
    }
}

/* =========================================
   Responsive: Very Small (360px)
   ========================================= */
@media (max-width: 360px) {
    .logo h1 {
        font-size: 0.82rem;
    }

    .logo-icon,
    .logo-icon svg {
        width: 26px;
        height: 26px;
    }

    .provider-toggle {
        order: 10;
    }

    .update-badge {
        display: none;
    }

    .col-price {
        min-width: 54px;
    }

    [data-view="list"] .price-cell {
        min-width: 54px;
    }

    [data-view="list"] .price-value {
        font-size: 0.7rem;
        min-width: 54px;
    }

    [data-view="card"] .prices-container {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Micro-interactions
   ========================================= */
@media (prefers-reduced-motion: no-preference) {
    .price-row {
        transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    }

    .section {
        animation: fadeInUp 0.4s ease-out;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(8px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .gold-section {
        animation-delay: 0s;
    }

    .currency-section {
        animation-delay: 0.1s;
    }
}