/* =====================================================
   NBU Currency Plugin v3.0 — Frontend Styles
   Светлая тема, без dark mode
   ===================================================== */

/* --- Переменные ------------------------------------*/
:root {
    --nbu-radius:    10px;
    --nbu-radius-sm: 6px;
    --nbu-shadow:    0 2px 16px rgba(0,0,0,.08);
    --nbu-border:    #e3e7ed;
    --nbu-bg:        #ffffff;
    --nbu-bg2:       #f7f9fc;
    --nbu-text:      #1a2232;
    --nbu-text2:     #5a6478;
    --nbu-accent:    #2563eb;
    --nbu-accent2:   #1d4ed8;
    --nbu-native-bg: #eff6ff;
    --nbu-badge-bg:  #dbeafe;
    --nbu-badge-txt: #1e40af;
    --nbu-font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =====================================================
   [nbu_lang] — фиксирован вверху страницы
   ===================================================== */

.nbu-lang-widget {
max-width: 1200px;
    width: 100%;
    margin: 5px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.nbu-lang-standalone {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 1200px;
}

.nbu-lang-label {
    font-family: var(--nbu-font);
    font-size: .78em;
    font-weight: 600;
    color: #5a6478;
    margin-right: 4px;
    white-space: nowrap;
}

/* Кнопки-ссылки (style="buttons", по умолчанию) */
.nbu-lang-btn {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid #e3e7ed;
    background: #f7f9fc;
    color: #5a6478;
    font-family: var(--nbu-font);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .18s;
    line-height: 1.6;
    white-space: nowrap;
	margin:5px;
}
.nbu-lang-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    text-decoration: none;
}
.nbu-lang-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* Выпадающий список (style="dropdown") */
.nbu-lang-style-dropdown .nbu-lang-dropdown {
    padding: 5px 10px;
    border: 1.5px solid #e3e7ed;
    border-radius: 6px;
    font-family: var(--nbu-font);
    font-size: .88em;
    color: #1a2232;
    background: #f7f9fc;
    cursor: pointer;
    min-width: 140px;
    transition: border-color .2s;
}
.nbu-lang-style-dropdown .nbu-lang-dropdown:focus {
    outline: none;
    border-color: #2563eb;
}

/* Флаги (style="flags") */
.nbu-lang-flag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: #f7f9fc;
    font-size: 1.2em;
    cursor: pointer;
    text-decoration: none;
    transition: all .18s;
    line-height: 1;
}
.nbu-lang-flag-btn:hover {
    border-color: #2563eb;
    transform: scale(1.12);
    text-decoration: none;
}
.nbu-lang-flag-btn.active {
    border-color: #2563eb;
    background: #dbeafe;
    box-shadow: 0 0 0 2px rgba(37,99,235,.2);
}

/* Отступ body чтобы контент не уходил под панель языков */
/* Відступ для сторінок де є [nbu_lang] — щоб контент не ховався під панеллю.
   Підберіть значення = висота шапки теми + висота панелі мови (~42px).
   Для finacia.net: 60px (шапка) + 42px (панель) = 102px               */
.nbu-lang-widget ~ * {
    /* Нічого тут — відступ задається нижче через body */
}

/* Якщо [nbu_lang] є на сторінці — додаємо відступ зверху до першого віджету */
.nbu-lang-widget + .nbu-widget {
    margin-top: 58px;
}

/* =====================================================
   Базовые виджеты — явно ниже панели языков
   ===================================================== */

.nbu-widget {
    font-family: var(--nbu-font);
    font-size: 15px;
    color: #1a2232;
    /* margin: 20px 0; */
    animation: nbuFadeIn .4s ease;
    float: left;
}

@keyframes nbuFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* =====================================================
   Общие элементы
   ===================================================== */

.nbu-title {
    font-size: 1.15em;
    font-weight: 600;
    margin: 0 0 14px;
    color: #1a2232;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nbu-native-badge {
    font-size: .72em;
    font-weight: 600;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .02em;
}

/* =====================================================
   [nbu_currency] — таблица курсов
   ===================================================== */

.nbu-table-container {
    background: #ffffff;
    border: 1px solid #e3e7ed;
    border-radius: 10px;
    padding: 22px 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    width: 100%;
    max-width: 720px;
    overflow-x: auto;
}

.nbu-currency-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92em;
}

.nbu-currency-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: .82em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #5a6478;
    border-bottom: 2px solid #e3e7ed;
}

.nbu-currency-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e3e7ed;
    vertical-align: middle;
    color: #1a2232;
}

.nbu-currency-table tr:last-child td { border-bottom: none; }
.nbu-currency-table tr:hover td      { background: #f7f9fc; }

.nbu-row-native td {
    background: #eff6ff;
    border-left: 3px solid #2563eb;
}
.nbu-row-native td:first-child {
    border-radius: 6px 0 0 6px;
}

.nbu-flag        { font-size: 1.15em; margin-right: 4px; }
.nbu-cc-name     { color: #5a6478; font-size: .88em; }
.nbu-rate-cell   { font-weight: 600; font-variant-numeric: tabular-nums; color: #1a2232; }
.nbu-change-cell { font-size: .88em; }

.nbu-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e3e7ed;
    font-size: .82em;
    color: #5a6478;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nbu-link-btn {
    background: none;
    border: none;
    color: #2563eb;
    cursor: pointer;
    font-size: .82em;
    padding: 0;
    text-decoration: underline;
}
.nbu-link-btn:hover { color: #1d4ed8; }

.nbu-source-info {
    width: 100%;
    background: #f7f9fc;
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 6px;
    font-size: .82em;
    color: #5a6478;
    word-break: break-word;
}

/* =====================================================
   [nbu_converter] — конвертер
   ===================================================== */

.nbu-converter-container {
    background: #ffffff;
    border: 1px solid #e3e7ed;
    border-radius: 10px;
    padding: 22px 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    max-width: 480px;
}

.nbu-conv-body { margin-top: 8px; }

.nbu-conv-row {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    align-items: center;
}

.nbu-conv-amount {
    width: 130px;
    flex-shrink: 0;
    padding: 10px 12px;
    border: 1.5px solid #e3e7ed;
    border-radius: 6px;
    font-size: 1em;
    color: #1a2232;
    background: #f7f9fc;
    transition: border-color .2s;
    font-variant-numeric: tabular-nums;
}
.nbu-conv-amount:focus {
    outline: none;
    border-color: #2563eb;
    background: #ffffff;
}
.nbu-conv-amount[readonly] {
    opacity: .75;
    cursor: default;
}

.nbu-conv-select {
    flex: 1;
    padding: 10px 12px;
    border: 1.5px solid #e3e7ed;
    border-radius: 6px;
    font-size: .88em;
    color: #1a2232;
    background: #f7f9fc;
    cursor: pointer;
    transition: border-color .2s;
}
.nbu-conv-select:focus {
    outline: none;
    border-color: #2563eb;
}

.nbu-conv-swap-row {
    display: flex;
    justify-content: center;
    margin: 4px 0;
}

.nbu-swap-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #2563eb;
    background: #ffffff;
    color: #2563eb;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .22s;
}
.nbu-swap-btn:hover {
    background: #2563eb;
    color: #ffffff;
    transform: rotate(180deg);
}

.nbu-conv-result {
    margin-top: 14px;
    padding: 12px 16px;
    background: #f7f9fc;
    border-radius: 6px;
    text-align: center;
    font-size: 1em;
    color: #5a6478;
    border: 1px solid #e3e7ed;
}
.nbu-conv-result strong {
    color: #1a2232;
    font-variant-numeric: tabular-nums;
}

/* =====================================================
   [nbu_graph] — график
   ===================================================== */

.nbu-graph-widget .nbu-graph-container {
    background: #ffffff;
    border: 1px solid #e3e7ed;
    border-radius: 10px;
    padding: 22px 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,.07);
    width: 100%;
}

.nbu-graph-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.nbu-graph-header .nbu-title { margin: 0; flex-shrink: 0; }

.nbu-graph-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nbu-graph-cc-select {
    padding: 6px 10px;
    border: 1.5px solid #e3e7ed;
    border-radius: 6px;
    font-size: .85em;
    color: #1a2232;
    background: #f7f9fc;
    cursor: pointer;
    max-width: 150px;
    transition: border-color .2s;
}
.nbu-graph-cc-select:focus {
    outline: none;
    border-color: #2563eb;
}

.nbu-period-pills { display: flex; gap: 4px; }

.nbu-period-pill {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1.5px solid #e3e7ed;
    background: #f7f9fc;
    color: #5a6478;
    font-size: .8em;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s;
    line-height: 1.4;
    white-space: nowrap;
}
.nbu-period-pill:hover,
.nbu-period-pill.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.nbu-graph-stats {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 12px;
}

.nbu-stat-current {
    font-size: 1.25em;
    font-weight: 700;
    color: #1a2232;
    font-variant-numeric: tabular-nums;
}

.nbu-stat-change {
    font-size: .88em;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.nbu-change-up   { color: #15803d; background: #dcfce7; }
.nbu-change-down { color: #b91c1c; background: #fee2e2; }

.nbu-canvas-wrap {
    border-radius: 6px;
    overflow: hidden;
}

/* =====================================================
   Загрузка и ошибки
   ===================================================== */

.nbu-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px;
    color: #5a6478;
    font-size: .9em;
    font-family: var(--nbu-font);
}

.nbu-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #e3e7ed;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: nbuSpin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes nbuSpin { to { transform: rotate(360deg); } }

.nbu-error {
    color: #dc2626;
    padding: 12px 16px;
    border: 1px solid #dc2626;
    border-radius: 6px;
    font-size: .9em;
    background: rgba(220,38,38,.06);
    font-family: var(--nbu-font);
}

/* =====================================================
   Адаптивность — мобильные экраны
   ===================================================== */

@media (max-width: 600px) {
    /* Виджеты */
    .nbu-table-container,
    .nbu-converter-container,
    .nbu-graph-widget .nbu-graph-container {
        padding: 14px 12px;
    }

    .nbu-conv-row        { flex-direction: column; }
    .nbu-conv-amount,
    .nbu-conv-select     { width: 100%; flex: none; }

    .nbu-currency-table td,
    .nbu-currency-table th { padding: 8px; }

    .nbu-title           { font-size: 1em; }

    .nbu-graph-header    { flex-direction: column; }
    .nbu-graph-controls  { width: 100%; }
    .nbu-graph-cc-select { max-width: 100%; width: 100%; }
    .nbu-period-pills    { width: 100%; justify-content: flex-start; }

    /* Панель мови на мобілі */
    .nbu-lang-widget {
        top: 56px;
        padding: 6px 10px;
    }
    .nbu-lang-standalone {
        gap: 3px;
    }
    .nbu-lang-btn {
        padding: 2px 5px;
        font-size: 10px;
    }
}

/* Изменение курса в таблице — компактная версия badge */
.nbu-change-cell .nbu-stat-change {
    font-size: .78em;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}
