﻿/* ============================================================
   tecajna.info v2 - responsive CSS
   Mobile-first, min-width breakpoints
   ============================================================ */

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

:root {
    --color-bg:          #0d1b2a;
    --color-surface:     #1a2e40;
    --color-surface2:    #213548;
    --color-border:      #2e4a62;
    --color-accent:      #00b4d8;
    --color-accent2:     #ffae00;
    --color-text:        #e0f0f8;
    --color-text-muted:  #7faabf;
    --color-text-dark:   #0d1b2a;
    --color-up:          #2ecc71;
    --color-down:        #e74c3c;
    --color-eur:         #fff176;
    --color-chf:         #ffe082;
    --color-usd:         #ffe082;
    --radius:            8px;
    --radius-sm:         4px;
    --shadow:            0 2px 12px rgba(0,0,0,0.4);
    --font:              'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: clip; /* 'clip' je jedino Ĺˇto pouzdano radi na iOS Safari */
}

body {
    font-family: var(--font);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
    position: relative; /* potrebno za overflow-x: hidden da radi na iOS */
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- Header --- */
.site-header {
    background: linear-gradient(135deg, #0a1628 0%, #0d2137 100%);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 0;
    overflow-x: hidden;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.site-logo {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: -0.5px;
}

.site-logo span { color: var(--color-accent2); }

.header-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    background: var(--color-surface);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
}

.header-date strong { color: var(--color-accent2); }

/* --- Nav --- */
.site-nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

/* Hamburger toggle — vidljiv samo na mobilnom */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    transition: color 0.2s, border-color 0.2s;
}
.nav-toggle:hover { color: var(--color-text); border-color: var(--color-accent); }

.nav-inner {
    display: flex;
    gap: 4px;
    padding: 10px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-inner a {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.nav-inner a:hover,
.nav-inner a.active {
    background: var(--color-accent);
    color: var(--color-text-dark);
    text-decoration: none;
}

/* Mobile: hamburger otvara vertikalni izbornik */
@media (max-width: 899px) {
    .site-nav { overflow: visible; }
    .nav-toggle { display: block; }
    .nav-inner {
        display: none;
        flex-direction: column;
        padding: 0 0 8px;
        gap: 0;
        overflow-x: visible;
    }
    .nav-inner.open { display: flex; }
    .nav-inner a {
        border-radius: 0;
        padding: 11px 4px;
        border-bottom: 1px solid rgba(46,74,98,0.4);
        white-space: normal;
        font-size: 0.9rem;
    }
    .nav-inner a:last-child { border-bottom: none; }
    .nav-inner a.active,
    .nav-inner a:hover {
        background: transparent;
        color: var(--color-accent);
    }
    .nav-inner a.active { font-weight: 600; }
}

/* --- Main grid --- */
.main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 16px 0 32px;
}

/* Grid itemovi po defaultu imaju min-width: auto Ĺˇto ih Ĺˇiri
   do minimalne Ĺˇirine sadrĹľaja (npr. tablica s inputima).
   min-width: 0 dopuĹˇta im da se svedu na 1fr track. */
.main-grid > * {
    min-width: 0;
}

@media (min-width: 900px) {
    .main-grid {
        grid-template-columns: minmax(0, 1fr) 280px;
    }
}

/* --- Card --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--color-surface2);
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-accent2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-body { padding: 0; }
/* Scroll wrapper za sire tablice */
.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table-scroll > table {
    min-width: 100%;
}

/* --- TeÄŤajna tablica --- */
.rate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.rate-table thead th {
    padding: 8px 10px;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface2);
}

.rate-table thead th:first-child { text-align: left; }

.rate-table tbody tr {
    border-bottom: 1px solid rgba(46,74,98,0.5);
    transition: background 0.15s;
}

.rate-table tbody tr:hover { background: rgba(0,180,216,0.06); }

.rate-table tbody tr:last-child { border-bottom: none; }

.rate-table td {
    padding: 6px 10px;
    text-align: right;
    vertical-align: middle;
}

.rate-table td:first-child { text-align: left; }

/* Highlight EUR, USD, CHF */
.rate-table tr.highlight-eur { background: rgba(255,241,118,0.07); }
.rate-table tr.highlight-usd { background: rgba(255,224,130,0.05); }
.rate-table tr.highlight-chf { background: rgba(255,224,130,0.05); }

/* --- Input kalkulator --- */
.calc-input {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: var(--font);
    font-size: 0.9rem;
    padding: 3px 6px;
    text-align: right;
    width: 90px;
    transition: border-color 0.2s, background 0.2s;
}

.calc-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(0,180,216,0.1);
}

.calc-input.readonly {
    opacity: 0.7;
    cursor: default;
}

.calc-input.active {
    border-color: var(--color-accent2);
    background: rgba(255,174,0,0.1);
    color: var(--color-accent2);
}

.symbol-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.symbol-label.highlight { color: var(--color-accent2); }

/* Promjena teÄŤaja */
.change-up   { color: var(--color-up); font-size: 0.8rem; }
.change-down { color: var(--color-down); font-size: 0.8rem; }
.change-flat { color: var(--color-text-muted); font-size: 0.8rem; }

/* Graf link */
.graf-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--color-surface2);
    border: 1px solid var(--color-border);
    color: var(--color-accent);
    font-size: 0.75rem;
    transition: background 0.2s;
}

.graf-link:hover {
    background: var(--color-accent);
    color: var(--color-text-dark);
    text-decoration: none;
}

/* --- Sidebar paneli --- */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

/* Kripto lista */
.crypto-list { list-style: none; }

.crypto-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(46,74,98,0.5);
    font-size: 0.88rem;
}

.crypto-item:last-child { border-bottom: none; }

.crypto-symbol {
    font-weight: 700;
    color: var(--color-accent2);
    min-width: 40px;
}

.crypto-price {
    font-weight: 600;
    color: var(--color-text);
}

.crypto-change { font-size: 0.78rem; }

/* Commodity lista */
.commodity-list { list-style: none; }

.commodity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(46,74,98,0.5);
    font-size: 0.85rem;
    gap: 8px;
}

.commodity-item:last-child { border-bottom: none; }

.commodity-name {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    flex: 1;
}

.commodity-price {
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

.commodity-change {
    font-size: 0.75rem;
    white-space: nowrap;
}

/* --- Konverzijska tablica --- */
.conv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.conv-table th, .conv-table td {
    padding: 7px 10px;
    text-align: center;
    border-bottom: 1px solid rgba(46,74,98,0.4);
}

.conv-table th {
    color: var(--color-accent2);
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--color-surface2);
}

.conv-table td { color: var(--color-text); }

/* --- Ad slots --- */
.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface2);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 90px;
    max-width: 100%;
}

.ad-slot-leaderboard { width: 100%; }

/* SprijeÄŤi AdSense da Ĺˇiri stranicu */
ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* --- Footer --- */
.site-footer {
    background: #080f1a;
    border-top: 1px solid var(--color-border);
    padding: 32px 0 16px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    overflow-x: hidden;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (min-width: 600px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
    .footer-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
}

.footer-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-accent2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.footer-bottom {
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
    text-align: center;
    font-size: 0.78rem;
}

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

/* --- Kretanje teÄŤaja stranica --- */
.chart-nav {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    flex-wrap: wrap;
}

.chart-nav a {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    transition: all 0.2s;
}

.chart-nav a:hover,
.chart-nav a.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-text-dark);
    text-decoration: none;
}

.chart-container {
    padding: 16px;
    position: relative;
    height: 320px;
}

@media (min-width: 600px) {
    .chart-container { height: 400px; }
}

/* --- Upute --- */
.upute {
    padding: 12px 16px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    background: rgba(0,0,0,0.15);
}

.upute strong { color: var(--color-accent2); }

/* --- Utility --- */
.text-right { text-align: right; }
.text-muted  { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-accent2 { color: var(--color-accent2); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }

/* --- Mobile tweaks --- */
@media (max-width: 600px) {

    /* Containeri
       max-width: 100vw je kljuÄŤno: 100% ovisi o parent Ĺˇirini (koja moĹľe biti Ĺˇira od viewporta),
       dok 100vw uvijek = toÄŤna Ĺˇirina ekrana â€” jedino pouzdano rjeĹˇenje na iOS WebKit */
    .container { padding: 0 16px; box-sizing: border-box; max-width: 100vw; }
    main.container { overflow: visible; }
    .main-grid { width: 100%; max-width: 100%; overflow: visible; }
    .main-grid > * { min-width: 0; max-width: 100%; }

    /* Kartice */
    .card { border-radius: var(--radius-sm); max-width: 100%; overflow: hidden; }
    .card-header { padding: 10px 12px; }
    .card-title { font-size: 0.8rem; }
    .card-body { max-width: 100%; }

    /* Tablica teÄŤajeva */
    .table-scroll { width: 100%; max-width: 100%; overflow-x: hidden; }
    .table-scroll > table { width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
    .rate-table { font-size: 0.96rem; table-layout: fixed; width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
    .rate-table thead th { padding: 6px 2px; font-size: 0.76rem; }
    .rate-table td, .rate-table th { min-width: 0; overflow: hidden; padding: 4px 2px; white-space: nowrap; text-overflow: ellipsis; }

    /* Sakrij stupce koji ne stanu na mobitel */
    .rate-table .col-kupovni,
    .rate-table .col-prodajni,
    .rate-table .col-promjena,
    .rate-table thead th.col-kupovni,
    .rate-table thead th.col-prodajni,
    .rate-table thead th.col-promjena { display: none; }

    /* Forsiraj 4 stupca bez clipa: Iznos / Valuta / Srednji / Graf */
    .rate-table thead th:last-child,
    .rate-table tbody td:last-child {
        display: table-cell !important;
        width: 12%;
        text-align: center;
    }
    .rate-table thead th:nth-child(1), .rate-table tbody td:nth-child(1) { width: 33%; }
    .rate-table thead th:nth-child(2), .rate-table tbody td:nth-child(2) { width: 21%; }
    .rate-table thead th:nth-child(4), .rate-table tbody td:nth-child(4) { width: 34%; }
    .rate-table thead th:nth-child(7), .rate-table tbody td:nth-child(7) { width: 12%; }

    /* Inputi - smanjeno da stanu u 25% stupca tablice (89px - 12px paddinga = 77px content)
       -webkit-appearance: none uklanja iOS UA min-width koji forcira Ĺˇiru tablicu */
    /* iOS Safari auto-zoom na focus nestaje kad je font-size inputa >= 16px */
    .calc-input { width: 92% !important; max-width: 92% !important; font-size: 16px; padding: 2px 3px;
                  -webkit-appearance: none; min-width: 0; }
    .calc-input[data-role="srednji"] { width: 92% !important; max-width: 92% !important; }

    /* Ostalo u tablici */
    .symbol-label { font-size: 0.88rem; }
    .graf-link { width: 24px; height: 24px; font-size: 0.72rem; margin-left: auto; margin-right: auto; }

    /* Konverzijska tablica */
    .conv-table { min-width: 0 !important; width: 100% !important; table-layout: fixed; font-size: 0.68rem; }
    .conv-table th, .conv-table td { min-width: 0; padding: 6px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .conv-table th:first-child, .conv-table td:first-child { width: 28%; }
    .conv-table th:nth-child(n+2), .conv-table td:nth-child(n+2) { width: 18%; }

    /* Graf stranice */
    .chart-container { padding: 12px 8px; height: 260px; }
    .chart-nav { padding: 10px 12px; gap: 6px; }
    canvas { max-width: 100% !important; width: 100% !important; }

    /* AdSense - leaderboard sakrij, ostale stegni */
    .ad-slot-leaderboard { display: none; }
    .ad-slot { min-height: 0; max-width: 100%; overflow: hidden; }

    /* Nav */
    .nav-inner { gap: 4px; padding: 8px 0; overflow-x: visible; flex-wrap: wrap; }
    .nav-inner a { padding: 5px 8px; font-size: 0.74rem; flex: 1 1 calc(50% - 4px); text-align: center; }

    /* Header */
    .site-logo { font-size: 1.6rem; }
    .header-date { font-size: 0.78rem; padding: 3px 8px; }

    /* Footer */
    .footer-grid { gap: 16px; }

    /* Upute */
    .upute { font-size: 0.78rem; }
}




