/* =============================================
   Canlı Piyasalar — Özgün Tasarım Sistemi
   ============================================= */

:root {
    --color-white: #ffffff;
    --color-bg: #f4f6f9;
    --color-bg-alt: #eef1f6;
    --color-border: #dde3ec;
    --color-text: #1a2332;
    --color-text-muted: #5a6a7e;
    --color-navy: #0f1c2e;
    --color-navy-light: #1a2d4a;
    --color-accent: #2563eb;
    --color-up: #059669;
    --color-up-bg: #ecfdf5;
    --color-down: #dc2626;
    --color-down-bg: #fef2f2;
    --color-neutral: #64748b;
    --color-gold: #b8860b;
    --color-gold-light: #fef9ec;
    --color-silver: #71717a;
    --color-silver-light: #f4f4f5;
    --shadow-sm: 0 1px 3px rgba(15, 28, 46, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 28, 46, 0.08);
    --shadow-lg: 0 8px 32px rgba(15, 28, 46, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Cascadia Code', 'Consolas', monospace;
    --header-height: 64px;
    --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--color-navy);
    color: var(--color-white);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    z-index: 9999;
    text-decoration: none;
}
.skip-link:focus { top: 16px; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.container-narrow { max-width: 760px; }

/* ---- Header ---- */
.site-header {
    background: var(--color-navy);
    color: var(--color-white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: var(--header-height);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-white);
    flex-shrink: 0;
}
.logo-icon { color: #60a5fa; display: flex; }
.logo-text {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.main-nav { flex: 1; }

.nav-list {
    display: flex;
    list-style: none;
    gap: 4px;
}

.nav-link {
    display: block;
    padding: 8px 14px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: var(--color-white);
    background: rgba(255,255,255,0.1);
}
.nav-link.active { background: rgba(96,165,250,0.2); color: #93c5fd; }

.header-status {
    display: flex;
    gap: 20px;
    flex-shrink: 0;
}
.status-item { text-align: right; }
.status-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.5);
}
.status-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-white);
}

.market-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.market-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-neutral);
}
.market-badge.open .market-dot { background: var(--color-up); box-shadow: 0 0 6px var(--color-up); }
.market-badge.closed .market-dot { background: var(--color-down); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}
.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-white);
    border-radius: 2px;
    transition: var(--transition);
}

/* ---- Main ---- */
.main-content { flex: 1; }

.page-hero {
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
    color: var(--color-white);
    padding: 40px 0 36px;
}
.page-hero-compact { padding: 32px 0 28px; }
.page-hero-gold {
    background: linear-gradient(135deg, #1a1508 0%, var(--color-navy) 60%);
}

.hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.page-title {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.page-subtitle {
    color: rgba(255,255,255,0.65);
    font-size: 15px;
}

.hero-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.meta-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    min-width: 140px;
}
.meta-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
}
.meta-value { font-size: 14px; font-weight: 600; }

.refresh-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.refresh-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-up);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---- Banners ---- */
.demo-banner, .error-banner, .stale-banner {
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}
.demo-banner {
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fcd34d;
}
.error-banner {
    background: var(--color-down-bg);
    color: var(--color-down);
    border-bottom: 1px solid #fca5a5;
}
.stale-banner {
    background: #fff7ed;
    color: #c2410c;
    border-bottom: 1px solid #fdba74;
}
.hidden { display: none !important; }

/* ---- Sections ---- */
.section { padding: 36px 0; }
.section-alt { background: var(--color-bg-alt); }

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-navy);
}
.section-title-gold { color: var(--color-gold); }
.section-title-silver { color: var(--color-silver); }

.section-badge {
    background: var(--color-navy);
    color: var(--color-white);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.gold-badge { background: var(--color-gold); }
.silver-badge { background: var(--color-silver); }

/* ---- Price Cards (Home) ---- */
.price-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.price-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative;
    overflow: hidden;
}
.price-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.price-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--color-navy);
}
.price-card.gold-card::before { background: var(--color-gold); }
.price-card.silver-card::before { background: var(--color-silver); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}
.card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-navy);
}
.card-code {
    font-size: 12px;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.card-prices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.price-block label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}
.price-block .price-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-navy);
    transition: color 0.3s;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.card-change {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
}
.card-change.up { color: var(--color-up); }
.card-change.down { color: var(--color-down); }
.card-change.neutral { color: var(--color-neutral); }

.card-prev {
    font-size: 12px;
    color: var(--color-text-muted);
}
.card-updated {
    font-size: 11px;
    color: var(--color-text-muted);
}

.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--color-border);
    transition: var(--transition);
    padding: 4px;
    line-height: 1;
}
.fav-btn:hover, .fav-btn.active { color: #f59e0b; }
.fav-btn.active { transform: scale(1.1); }

/* Price flash animation */
.price-flash-up { animation: flashUp 0.8s ease; }
.price-flash-down { animation: flashDown 0.8s ease; }
@keyframes flashUp {
    0% { background: var(--color-up-bg); color: var(--color-up); }
    100% { background: transparent; }
}
@keyframes flashDown {
    0% { background: var(--color-down-bg); color: var(--color-down); }
    100% { background: transparent; }
}

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table thead {
    background: var(--color-navy);
    color: var(--color-white);
}
.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--color-bg); }

.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

.item-name { font-weight: 600; color: var(--color-navy); }
.item-code {
    display: block;
    font-size: 12px;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.price-cell {
    font-family: var(--font-mono);
    font-weight: 600;
    white-space: nowrap;
}

.change-cell {
    font-family: var(--font-mono);
    font-weight: 600;
    white-space: nowrap;
}
.change-cell.up { color: var(--color-up); }
.change-cell.down { color: var(--color-down); }
.change-cell.neutral { color: var(--color-neutral); }

.loading-cell {
    text-align: center;
    color: var(--color-text-muted);
    padding: 32px !important;
}

/* ---- Mobile Cards ---- */
.mobile-cards { display: none; }

.mobile-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 10px;
}
.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.mobile-card-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}
.mobile-card-row .label { color: var(--color-text-muted); }

/* ---- Calculator ---- */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}
.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-bg);
}

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}
.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-white);
    transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: var(--color-navy);
    color: var(--color-white);
    width: 100%;
}
.btn-primary:hover { background: var(--color-navy-light); }

.result-rows { display: flex; flex-direction: column; gap: 0; }
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}
.result-row-total {
    border-bottom: none;
    padding-top: 16px;
    margin-top: 4px;
}
.result-label { font-size: 14px; color: var(--color-text-muted); }
.result-value {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 15px;
    color: var(--color-navy);
}
.result-total { font-size: 1.4rem; color: var(--color-gold); }
.result-note {
    margin-top: 16px;
    font-size: 13px;
    color: var(--color-text-muted);
    font-style: italic;
}

.labor-table-section { margin-top: 16px; }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-icon {
    font-size: 48px;
    color: var(--color-border);
    margin-bottom: 16px;
}
.empty-state h2 {
    font-size: 1.2rem;
    color: var(--color-navy);
    margin-bottom: 8px;
}
.empty-state p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ---- Skeleton Loading ---- */
.loading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    grid-column: 1 / -1;
}
.skeleton-card {
    height: 180px;
    background: linear-gradient(90deg, #e8ecf1 25%, #f4f6f9 50%, #e8ecf1 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-lg);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Footer ---- */
.site-footer {
    background: var(--color-navy);
    color: rgba(255,255,255,0.7);
    padding: 40px 0 20px;
    margin-top: auto;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}
.footer-brand strong {
    display: block;
    color: var(--color-white);
    font-size: 14px;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
}
.footer-disclaimer { font-size: 13px; line-height: 1.7; }
.footer-links h3 {
    color: var(--color-white);
    font-size: 14px;
    margin-bottom: 12px;
}
.footer-links ul { list-style: none; }
.footer-links a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 4px 0;
    transition: var(--transition);
}
.footer-links a:hover { color: var(--color-white); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
}

.legal-content { padding: 20px 0; }
.legal-content p { margin-bottom: 16px; color: var(--color-text-muted); }
.legal-content a { color: var(--color-accent); }

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--color-navy);
    color: var(--color-white);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .header-status { display: none; }
    .nav-toggle { display: flex; }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0; right: 0;
        background: var(--color-navy);
        border-top: 1px solid rgba(255,255,255,0.1);
        transform: translateY(-110%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        box-shadow: var(--shadow-lg);
    }
    .main-nav.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    .nav-list {
        flex-direction: column;
        padding: 12px;
    }
    .nav-link { padding: 12px 16px; }

    .hero-top { flex-direction: column; }
    .hero-meta { width: 100%; }
    .meta-card { flex: 1; min-width: 0; }

    .calculator-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }

    .table-wrapper { display: none; }
    .mobile-cards { display: block; }
}

@media (max-width: 480px) {
    .price-cards { grid-template-columns: 1fr; }
    .card-prices { grid-template-columns: 1fr; }
}
