/* ===================================================================
   CursValutar.info.ro - redesign modern
   Paleta de brand pastrata: verde #047700
   =================================================================== */

:root {
    --green:        #047700;
    --green-dark:   #035c00;
    --green-darker: #024a00;
    --lime:         #77aa00;
    --lime-dark:    #448800;
    --green-soft:   #e8f3e6;
    --green-tint:   #f3f9f1;

    --ink:        #1b2a1b;
    --muted:      #5c6b5c;
    --line:       #dfe6df;
    --line-soft:  #eef2ee;
    --bg:         #f4f7f3;
    --card:       #ffffff;

    --up:    #c0392b;   /* crestere curs = leul scade (rosu)  */
    --down:  #1e8e3e;   /* scadere curs  = leul creste (verde)*/
    --steady:#8a8a8a;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(3,92,0,.06);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);

    --maxw: 1080px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--green-dark); }

img { max-width: 100%; height: auto; border: 0; }

/* ----------------------------- Header ----------------------------- */
.site-header {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-darker) 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(2,74,0,.25);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
}
.brand .logo-mark {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: #fff;
    color: var(--green);
    display: grid; place-items: center;
    font-weight: 800;
    font-size: 22px;
    box-shadow: var(--shadow-sm);
}
.brand .logo-text { line-height: 1.1; }
.brand .logo-text b { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.brand .logo-text span { display: block; font-size: 11.5px; opacity: .85; }

.top-links {
    display: flex;
    gap: 16px;
    font-size: 13px;
    flex-wrap: wrap;
}
.top-links a {
    color: #eafaea;
    text-decoration: none;
    opacity: .9;
}
.top-links a:hover { opacity: 1; text-decoration: underline; }

/* hero band */
.hero-band {
    background: var(--green-dark);
    color: #fff;
}
.hero-band .hero-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 9px 20px;
    text-align: center;
    font-size: 13.5px;
    opacity: .92;
}

/* --------------------------- Layout ------------------------------- */
.page {
    max-width: var(--maxw);
    margin: 24px auto;
    padding: 0 20px;
    display: grid;
    gap: 24px;
    align-items: start;
}
.content { min-width: 0; }
.sidebar { min-width: 0; }

/* ----------------------------- Cards ------------------------------ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 22px;
}
.card-body { padding: 20px 22px; }

.info-note {
    background: var(--green-tint);
    border-left: 4px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.info-note h1 {
    font-size: 17px;
    margin: 0 0 6px;
    color: var(--green-dark);
}
.info-note p { margin: 0; font-size: 13.5px; color: var(--muted); }

/* --------------------------- Filter form -------------------------- */
.filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.field input[type="date"],
.field select {
    font: inherit;
    font-size: 15px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    min-width: 190px;
    transition: border-color .15s, box-shadow .15s;
}
.field input[type="date"]:focus,
.field select:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(4,119,0,.12);
}
.btn-primary {
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(180deg, var(--lime) 0%, var(--lime-dark) 100%);
    border: 0;
    border-radius: var(--radius-sm);
    padding: 11px 26px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(68,136,0,.35);
    transition: transform .08s, box-shadow .15s, filter .15s;
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 4px 12px rgba(68,136,0,.4); }
.btn-primary:active { transform: translateY(1px); }

/* --------------------------- Rates table -------------------------- */
.rates-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.rates-head h2 { margin: 0; font-size: 18px; color: var(--green-dark); }
.rates-head .dates { font-size: 13px; color: var(--muted); }
.rates-head .dates b { color: var(--ink); }

.rates {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}
.rates thead th {
    text-align: right;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    font-weight: 700;
    padding: 0 12px 10px;
    border-bottom: 2px solid var(--green-soft);
}
.rates thead th.left { text-align: left; }
.rates thead th.center { text-align: center; }

.rates tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--line-soft);
    text-align: right;
    white-space: nowrap;
}
.rates tbody tr:hover { background: var(--green-tint); }
.rates tbody tr.is-ref { background: var(--green-soft); }

.cur-code {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    color: var(--green-dark);
}
.cur-code .flag {
    width: 26px; height: 18px;
    border-radius: 3px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 0 1px rgba(0,0,0,.08);
    flex: 0 0 auto;
}
.cur-name { text-align: left; color: var(--ink); white-space: normal; }

.val { font-variant-numeric: tabular-nums; }
.val.main { font-weight: 700; font-size: 15.5px; }
.val.prev { color: var(--muted); }

.delta { font-variant-numeric: tabular-nums; font-weight: 600; }
.delta.up    { color: var(--up); }
.delta.down  { color: var(--down); }
.delta.steady{ color: var(--steady); }
.delta .arrow { font-size: 12px; }

/* ----------------------- Link moneda (clicabil) ------------------- */
.cur-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}
.cur-link:hover .cur-code { text-decoration: underline; }
.cur-link::after {
    content: "›";
    color: var(--green);
    font-weight: 700;
    opacity: 0;
    transition: opacity .15s, transform .15s;
}
.cur-link:hover::after { opacity: 1; transform: translateX(2px); }

/* --------------------------- Pagina istoric ----------------------- */
.crumbs { margin: 0 0 16px; font-size: 13.5px; }
.crumbs a { color: var(--green-dark); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.hist-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
}
.hist-title h1 { margin: 0; font-size: 20px; color: var(--green-dark); }
.hist-title .hist-sub { font-size: 13px; color: var(--muted); }
.flag-lg {
    width: 46px !important;
    height: 32px !important;
    border-radius: 5px;
    background-size: 100%;
}

.hist-filter { margin-bottom: 14px; }

.quick-ranges { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--green-tint);
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.chip:hover {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-val { font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-val.delta .arrow { font-size: 13px; }

.chart-wrap { position: relative; width: 100%; }
#histChart { display: block; width: 100%; }

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(2,74,0,.94);
    color: #fff;
    font-size: 12.5px;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
    z-index: 5;
}

@media (max-width: 720px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
    .stats { grid-template-columns: 1fr; }
}

/* --------------------------- Sidebar / ads ------------------------ */
.ad-box {
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    margin-bottom: 22px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ad-rail { display: flex; flex-direction: column; align-items: center; }

/* ----------------------------- Footer ----------------------------- */
.site-footer {
    background: var(--green-darker);
    color: #cfe8cd;
    margin-top: 10px;
}
.footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 22px 20px;
    text-align: center;
    font-size: 13px;
}
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* --------------------------- Responsive --------------------------- */
@media (max-width: 880px) {
    .page { grid-template-columns: 1fr; }
    .sidebar { order: 2; }
}
@media (max-width: 560px) {
    body { font-size: 14px; }
    .filter { gap: 12px; }
    .field input[type="date"], .field select { min-width: 0; width: 100%; }
    .field, .filter > .btn-primary { width: 100%; }
    .btn-primary { width: 100%; }
    .card-body { padding: 16px; }

    /* tabel -> carduri pe mobil */
    .rates thead { display: none; }
    .rates, .rates tbody, .rates tr, .rates td { display: block; width: 100%; }
    .rates tbody tr {
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        margin-bottom: 10px;
        padding: 6px 4px;
    }
    .rates tbody td {
        border: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 7px 12px;
    }
    .rates tbody td::before {
        content: attr(data-label);
        font-size: 11.5px;
        text-transform: uppercase;
        letter-spacing: .4px;
        color: var(--muted);
        font-weight: 700;
        margin-right: 12px;
    }
    .cur-name { text-align: right; }
}
