/**
 * Exchange Rate Styles - Tỷ giá ngoại tệ
 * Modern, clean design
 */

/* ===================================
   WRAPPER & HEADER
   =================================== */
.mf-exchange-rate-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 20px 0;
}

.mf-er-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mf-er-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mf-er-title::before {
    content: '💹';
}

.mf-er-update-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
    opacity: 0.9;
}

.mf-er-source {
    font-weight: 500;
}

.mf-er-time {
    opacity: 0.8;
}

/* ===================================
   BLACK MARKET BOX
   =================================== */
.mf-er-black-market {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.mf-er-bm-standalone {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.mf-er-bm-standalone .mf-er-bm-header {
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 10px;
}

.mf-er-bm-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mf-er-bm-icon {
    font-size: 24px;
}

.mf-er-bm-title {
    font-size: 16px;
    font-weight: 600;
}

.mf-er-bm-rates {
    display: flex;
    gap: 25px;
}

.mf-er-bm-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mf-er-bm-type {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.9;
}

.mf-er-bm-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.mf-er-bm-value.buy {
    color: #fff;
}

.mf-er-bm-value.sell {
    color: #ffeb3b;
}

.mf-er-bm-unit {
    font-size: 11px;
    opacity: 0.8;
}

.mf-er-bm-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 10px;
    font-size: 12px;
    opacity: 0.9;
}

/* Inline style */
.mf-er-bm-inline {
    font-size: 14px;
}

.mf-er-bm-inline .buy {
    color: #2196f3;
}

.mf-er-bm-inline .sell {
    color: #f44336;
}

/* Simple style */
.mf-er-bm-simple {
    background: #fff3e0;
    border: 1px solid #ff9800;
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mf-er-bm-simple .label {
    font-weight: 600;
    color: #e65100;
}

.mf-er-bm-simple .rates strong {
    color: #1565c0;
}

/* ===================================
   EXCHANGE RATE TABLE
   =================================== */
.mf-er-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mf-er-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.mf-er-table thead {
    background: #f8f9fa;
}

.mf-er-table th {
    padding: 12px 15px;
    text-align: center;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.mf-er-table th.mf-er-th-currency {
    text-align: left;
}

.mf-er-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
}

.mf-er-row:hover {
    background: #f8f9fa;
}

.mf-er-row:last-child td {
    border-bottom: none;
}

/* Currency cell */
.mf-er-td-currency {
    text-align: left !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mf-er-flag {
    font-size: 20px;
    line-height: 1;
}

.mf-er-code {
    font-weight: 700;
    color: #1e3a5f;
    min-width: 40px;
}

.mf-er-name {
    color: #6c757d;
    font-size: 12px;
}

/* Rate cells */
.mf-er-td-buy,
.mf-er-td-transfer {
    color: #2196f3;
    font-weight: 500;
}

.mf-er-td-sell {
    color: #f44336;
    font-weight: 600;
}

/* ===================================
   CURRENCY CONVERTER
   =================================== */
.mf-er-converter {
    background: #f8f9fa;
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

.mf-er-converter-standalone {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin: 20px 0;
    border-top: none;
}

.mf-er-converter-title {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
}

.mf-er-converter-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mf-er-converter-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.mf-er-converter-input-group,
.mf-er-converter-select-group {
    flex: 1;
    min-width: 100px;
}

.mf-er-converter-input-group label,
.mf-er-converter-select-group label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.mf-er-amount {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.mf-er-amount:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

.mf-er-from-currency,
.mf-er-to-currency {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.mf-er-from-currency:focus,
.mf-er-to-currency:focus {
    outline: none;
    border-color: #2196f3;
}

.mf-er-converter-swap {
    display: flex;
    align-items: center;
    padding-bottom: 3px;
}

.mf-er-swap-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ced4da;
    border-radius: 50%;
    background: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mf-er-swap-btn:hover {
    background: #2196f3;
    color: #fff;
    border-color: #2196f3;
    transform: rotate(180deg);
}

/* Converter Result */
.mf-er-converter-result {
    background: #fff;
    border-radius: 10px;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.mf-er-result-display {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 5px;
}

.mf-er-result-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e3a5f;
}

.mf-er-result-currency {
    font-size: 16px;
    font-weight: 500;
    color: #6c757d;
}

.mf-er-result-rate {
    font-size: 12px;
    color: #6c757d;
}

.mf-er-rate-display {
    font-weight: 600;
    color: #2196f3;
}

.mf-er-converter-footer {
    text-align: center;
    padding-top: 10px;
    font-size: 11px;
    color: #adb5bd;
}

/* ===================================
   FOOTER
   =================================== */
.mf-er-footer {
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.mf-er-note {
    font-size: 11px;
    color: #6c757d;
}

/* ===================================
   USD SIMPLE
   =================================== */
.mf-er-usd-simple {
    font-weight: 600;
    color: #1e3a5f;
}

/* ===================================
   ERROR STATE
   =================================== */
.mf-er-black-market-error {
    background: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

/* ===================================
   LOADING STATE
   =================================== */
.mf-er-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.mf-er-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196f3;
    border-radius: 50%;
    animation: mf-er-spin 1s linear infinite;
}

@keyframes mf-er-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
    .mf-er-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .mf-er-update-info {
        align-items: flex-start;
    }
    
    .mf-er-black-market {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mf-er-bm-rates {
        width: 100%;
        justify-content: space-around;
    }
    
    .mf-er-table {
        font-size: 13px;
    }
    
    .mf-er-table th,
    .mf-er-table td {
        padding: 10px 8px;
    }
    
    .mf-er-name {
        display: none;
    }
    
    .mf-er-converter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .mf-er-converter-input-group,
    .mf-er-converter-select-group {
        width: 100%;
    }
    
    .mf-er-converter-swap {
        align-self: center;
        transform: rotate(90deg);
    }
    
    .mf-er-result-value {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .mf-er-title {
        font-size: 16px;
    }
    
    .mf-er-bm-value {
        font-size: 18px;
    }
    
    .mf-er-flag {
        font-size: 16px;
    }
    
    .mf-er-code {
        font-size: 13px;
    }
}

/* ===================================
   CHART STYLES
   =================================== */
.mf-er-chart-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin: 20px 0;
}

.mf-er-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.mf-er-chart-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
}

.mf-er-chart-period {
    display: flex;
    gap: 5px;
}

.mf-er-period-btn {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mf-er-period-btn:hover {
    border-color: #2196f3;
    color: #2196f3;
}

.mf-er-period-btn.active {
    background: #2196f3;
    border-color: #2196f3;
    color: #fff;
}

.mf-er-chart-container {
    position: relative;
    margin: 15px 0;
}

.mf-er-chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 12px;
    margin-top: 10px;
}

.mf-er-legend-item.sell {
    color: #f44336;
}

.mf-er-legend-item.buy {
    color: #2196f3;
}

.mf-er-chart-note {
    text-align: center;
    font-size: 11px;
    color: #9e9e9e;
    margin-top: 10px;
}

/* ===================================
   COMPARE TABLE STYLES
   =================================== */
.mf-er-compare-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 20px 0;
}

.mf-er-compare-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mf-er-compare-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mf-er-compare-time {
    font-size: 12px;
    opacity: 0.9;
}

.mf-er-compare-table-wrapper {
    overflow-x: auto;
}

.mf-er-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.mf-er-compare-table thead {
    background: #f8f9fa;
}

.mf-er-compare-table th {
    padding: 12px 15px;
    text-align: center;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.mf-er-compare-table th:first-child {
    text-align: left;
}

.mf-er-compare-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.mf-er-compare-bank {
    text-align: left !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mf-er-compare-bank .bank-logo {
    font-size: 20px;
}

.mf-er-compare-bank .bank-name {
    font-weight: 600;
    color: #1e3a5f;
}

.mf-er-compare-buy,
.mf-er-compare-transfer {
    color: #2196f3;
}

.mf-er-compare-sell {
    color: #f44336;
    font-weight: 600;
}

.mf-er-compare-spread {
    color: #ff9800;
    font-weight: 500;
}

.mf-er-compare-row:hover {
    background: #f8f9fa;
}

.mf-er-compare-black {
    background: #fff8e1;
}

.mf-er-compare-black:hover {
    background: #fff3cd;
}

.mf-er-compare-summary {
    padding: 15px 20px;
    background: #e3f2fd;
    border-top: 1px solid #bbdefb;
}

.mf-er-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.mf-er-summary-item .label {
    font-weight: 500;
    color: #1565c0;
}

.mf-er-summary-item .value.highlight {
    font-size: 18px;
    font-weight: 700;
    color: #0d47a1;
}

.mf-er-summary-note {
    font-size: 12px;
    color: #1976d2;
    font-style: italic;
}

/* ===================================
   HISTORY TABLE STYLES
   =================================== */
.mf-er-history-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 20px 0;
}

.mf-er-history-header {
    background: linear-gradient(135deg, #4a148c 0%, #7b1fa2 100%);
    color: #fff;
    padding: 15px 20px;
}

.mf-er-history-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mf-er-history-table-wrapper {
    overflow-x: auto;
}

.mf-er-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.mf-er-history-table thead {
    background: #f3e5f5;
}

.mf-er-history-table th {
    padding: 12px 15px;
    text-align: center;
    font-weight: 600;
    color: #4a148c;
    border-bottom: 2px solid #ce93d8;
}

.mf-er-history-table th:first-child {
    text-align: left;
}

.mf-er-history-table td {
    padding: 12px 15px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.mf-er-history-date {
    text-align: left !important;
}

.mf-er-history-date .date {
    font-weight: 600;
    color: #1e3a5f;
    display: block;
}

.mf-er-history-date .day {
    font-size: 11px;
    color: #9e9e9e;
}

.mf-er-history-buy {
    color: #2196f3;
}

.mf-er-history-sell {
    color: #f44336;
    font-weight: 600;
}

.mf-er-history-change {
    font-weight: 500;
}

.mf-er-history-change.up {
    color: #4caf50;
}

.mf-er-history-change.up .arrow {
    color: #4caf50;
}

.mf-er-history-change.down {
    color: #f44336;
}

.mf-er-history-change.down .arrow {
    color: #f44336;
}

.mf-er-history-row:hover {
    background: #f8f9fa;
}

.mf-er-history-footer {
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.mf-er-history-note {
    font-size: 11px;
    color: #6c757d;
}

/* ===================================
   RESPONSIVE FOR NEW COMPONENTS
   =================================== */
@media (max-width: 768px) {
    .mf-er-chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mf-er-compare-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .mf-er-compare-table {
        font-size: 13px;
    }
    
    .mf-er-compare-table th,
    .mf-er-compare-table td {
        padding: 10px 8px;
    }
    
    .mf-er-history-table {
        font-size: 13px;
    }
    
    .mf-er-history-table th,
    .mf-er-history-table td {
        padding: 10px 8px;
    }
}
