/* ========== VARIABLES Y COLORES (Fynk Theme) ========== */
:root {
    --bg-body: #1C1C1C;
    --bg-card: #2D2D2D;
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --accent: #92D545;
    /* Fynk Green */
    --accent-light: rgba(146, 213, 69, 0.2);
    /* Transparent Green for focus rings */
    --accent-hover: #7ab337;
    --highlight: #FF8B26;
    /* Fynk Orange */
    --border: #333333;
    --input-bg: #252525;

    /* Trends */
    --trend-up-bg: rgba(146, 213, 69, 0.15);
    --trend-up-text: #92D545;
    --trend-down-bg: rgba(239, 68, 68, 0.15);
    --trend-down-text: #ef4444;

    /* Impacts */
    --impact-high: #ef4444;
    --impact-med: #FF8B26;
    /* Using Fynk Orange */
    --impact-low: #92D545;
    /* Using Fynk Green */
}

/* Light Mode Override */
body.light-mode {
    --bg-body: #F3F4F6;
    --bg-card: #FFFFFF;
    --text-primary: #1C1C1C;
    --text-secondary: #4B5563;
    /* Darker gray for better readability */
    --border: #E5E7EB;
    --input-bg: #F9FAFB;
    --accent: #7ab337;
    /* Slightly darker green for light mode readability */
    --accent-light: rgba(146, 213, 69, 0.2);
    --trend-up-bg: rgba(146, 213, 69, 0.2);
    --trend-up-text: #15803d;
    /* Darker green */
    --trend-down-bg: rgba(239, 68, 68, 0.1);
    --trend-down-text: #b91c1c;
    /* Darker red */
}

/* Light Mode Overrides for Contrast */
body.light-mode .btn-calculate,
body.light-mode .badge-live,
body.light-mode .extra-badge,
body.light-mode nav a.active {
    color: #1C1C1C !important;
    /* Force Black text on green elements */
}

body.light-mode .ticker-wrap .status-open,
body.light-mode .ticker-wrap .var-up,
body.light-mode .ticker-wrap span {
    color: #1C1C1C !important;
}

body.light-mode .ticker-wrap .var-down {
    color: #b91c1c !important;
}

/* Remove Arrows/Spinners from Input Number */
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: inherit;
}

.main-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sub-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: var(--text-secondary);
    margin-left: 20px;
    font-weight: 500;
    transition: color 0.2s ease;
}

nav a.active {
    color: var(--accent);
}

.theme-btn {
    background: var(--input-bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.market-status-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.market-status {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-open {
    color: var(--accent);
}

.status-closed {
    color: #ef4444;
}

.dot-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.sentiment-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.sentiment-bar #market-sentiment {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    font-size: 0.75rem;
}

.sentiment-bar .sentiment-label {
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.sentiment-bar .sentiment-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.sentiment-bar .sentiment-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.sentiment-bar .sentiment-info {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
    white-space: nowrap;
}

.sentiment-bar .sentiment-status {
    font-weight: 700;
    font-size: 0.75rem;
}

.sentiment-bar .sentiment-desc {
    color: var(--text-secondary);
    opacity: 0.7;
    font-size: 0.65rem;
}

.ticker-wrap {
    background: var(--accent);
    color: var(--bg-body);
    padding: 8px 0;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-wrap .var-up,
.ticker-wrap .status-open,
.ticker-wrap span {
    color: var(--bg-body) !important;
}

.ticker-wrap .var-down {
    color: #b91c1c !important;
}

.ticker-track {
    display: inline-flex;
    gap: 40px;
    animation: scroll 40s linear infinite;
}

@keyframes scroll {
    100% {
        transform: translateX(-50%);
    }
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.main-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-top: 40px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.badge-live {
    background: var(--accent);
    color: var(--bg-body);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.news-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.news-card:hover {
    transform: translateY(-2px);
    border-left-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.news-meta {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.news-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    line-height: 1.4;
}

/* ========== SIDEBAR MEJORADA (EFECTOS) ========== */
.sidebar-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
}

.sidebar-section h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin: 0 0 15px 0;
    font-weight: 700;
}

.sidebar-section:not(.static-section):hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(146, 213, 69, 0.15);
}

.dollar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.dollar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    transition: all 0.2s ease;
    position: relative;
}

.dollar-card:hover {
    border-color: var(--accent);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(146, 213, 69, 0.15);
}

.dollar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.dollar-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dollar-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 5px 0;
    letter-spacing: -0.5px;
}

.dollar-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.var-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.dollar-card .var-badge {
    position: absolute;
    top: 15px;
    right: 15px;
}

.var-up {
    background: var(--trend-up-bg);
    color: var(--trend-up-text);
}

.var-down {
    background: var(--trend-down-bg);
    color: var(--trend-down-text);
}

.var-neutral {
    background: var(--input-bg);
    color: var(--text-secondary);
}

.highlight-bg {
    background: var(--accent-light);
    border-color: var(--accent);
}

.calc-header {
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.input-group {
    margin-bottom: 10px;
}

.input-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 8px;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.exchange-icon {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin: -5px 0;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.market-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.impact-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.impact-high {
    background-color: var(--impact-high);
}

.impact-med {
    background-color: var(--impact-med);
}

.impact-low {
    background-color: var(--impact-low);
}

.flag {
    font-size: 1.5rem;
    margin-right: 8px;
    vertical-align: middle;
    line-height: 1;
}

.skeleton-card,
.skeleton-box {
    background: linear-gradient(90deg, var(--border) 25%, rgba(0, 0, 0, 0.05) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
    opacity: 0.5;
    height: 100px;
    margin-bottom: 10px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.main-footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ========== CEDEARS ========== */
.cedear-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
}

.cedear-calc-box {
    height: fit-content;
    position: sticky;
    top: 20px;
}

.cedear-prices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cedear-prices-grid .input-group {
    margin-bottom: 0;
}

.button-group {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
    margin-top: 10px;
    font-family: inherit;
}

.action-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-clear-minimal {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 15px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-minimal:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-2px);
}

.result-box {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-card) 100%);
    border: 2px solid var(--accent);
    border-radius: 10px;
    padding: 16px;
    margin-top: 15px;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
    display: none;
    overflow: hidden;
}

.result-box.visible {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(37, 99, 235, 0.2);
}

.result-row:last-of-type {
    border-bottom: none;
    margin-bottom: 8px;
}

.result-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
}

.result-value {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.9rem;
    text-align: right;
}

.result-value-large {
    font-weight: 800;
    color: var(--accent);
    font-size: 1.05rem;
    text-align: right;
}

.result-footer {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    opacity: 0.8;
}

/* ========== RATIOS TABLE ========== */
.ratios-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    border-radius: 8px;
}

.ratios-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.ratios-table thead {
    position: sticky;
    top: 0;
    background: var(--input-bg);
    z-index: 10;
}

.ratios-table th {
    padding: 10px 0;
    border-bottom: 2px solid var(--accent);
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
}

.ratios-table tbody tr {
    transition: background-color 0.2s ease;
}

.ratios-table tbody tr:hover {
    background-color: var(--accent-light);
}

.ratios-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

/* ========== CONVERTER INPUTS ========== */
.converter-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: flex-end;
}

.converter-inputs .input-group {
    margin-bottom: 0;
    min-width: 0;
}

/* ========== TOOLTIP MEJORADO (JS) ========== */
.custom-tooltip {
    position: fixed;
    background: #1e293b;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    max-width: 250px;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(10px);
}

.custom-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== DISCLAIMER ========== */
.disclaimer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 20px;
    font-style: italic;
    opacity: 0.8;
}

/* ========== CUSTOM TOAST ========== */
.custom-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.custom-toast.error {
    border-color: #ef4444;
}

.custom-toast.success {
    border-color: #10b981;
}

.custom-toast i {
    font-size: 1.2rem;
}

/* ========== CHART SECTION ========== */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chart-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    text-align: right;
}

.result-value-large {
    font-weight: 800;
    color: var(--accent);
    font-size: 1.05rem;
    text-align: right;
}

.result-footer {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
    opacity: 0.8;
}

/* ========== RATIOS TABLE ========== */
.ratios-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    border-radius: 8px;
}

.ratios-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.ratios-table thead {
    position: sticky;
    top: 0;
    background: var(--input-bg);
    z-index: 10;
}

.ratios-table th {
    padding: 10px 0;
    border-bottom: 2px solid var(--accent);
    text-align: left;
    font-weight: 700;
    color: var(--text-secondary);
}

.ratios-table tbody tr {
    transition: background-color 0.2s ease;
}

.ratios-table tbody tr:hover {
    background-color: var(--accent-light);
}

.ratios-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

/* ========== CALCULATOR HEADER ========== */
.calc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.calc-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    line-height: 1;
}

.calc-header i {
    font-size: 1.2rem;
    color: var(--accent);
    display: flex;
}

/* ========== CONVERTER INPUTS ========== */
.converter-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: flex-end;
}

.converter-inputs .input-group {
    margin-bottom: 0;
    min-width: 0;
}

/* ========== TOOLTIP MEJORADO (JS) ========== */
.custom-tooltip {
    position: fixed;
    background: #1e293b;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    max-width: 250px;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(10px);
}

.custom-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========== DISCLAIMER ========== */
.disclaimer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 20px;
    font-style: italic;
    opacity: 0.8;
}

/* ========== CUSTOM TOAST ========== */
.custom-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.custom-toast.error {
    border-color: #ef4444;
}

.custom-toast.success {
    border-color: #10b981;
}

.custom-toast i {
    font-size: 1.2rem;
}

/* ========== CHART SECTION ========== */
.chart-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chart-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.icon-btn:hover {
    background: var(--bg-card);
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========== TASAS DE REFERENCIA (SIDEBAR) ========== */
.rates-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rates-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}

.rates-row.last {
    border-bottom: none;
    padding-bottom: 0;
}

.rates-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.rates-value-red {
    color: #ef4444;
    font-weight: 700;
}

.rates-value-orange {
    color: #f59e0b;
    font-weight: 700;
}

/* ========== TASAS PAGE ========== */
.rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.rate-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rate-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border-color: var(--accent);
}

.entity-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.entity-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-secondary);
    overflow: hidden;
    flex-shrink: 0;
}

.entity-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.entity-details h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.entity-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.extra-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.rate-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.tna-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.tna-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.icon-btn:hover {
    background: var(--bg-card);
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========== TASAS DE REFERENCIA (SIDEBAR) ========== */
.rates-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rates-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}

.rates-row.last {
    border-bottom: none;
    padding-bottom: 0;
}

.rates-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.rates-value-red {
    color: #ef4444;
    font-weight: 700;
}

.rates-value-orange {
    color: #f59e0b;
    font-weight: 700;
}

/* ========== TASAS PAGE ========== */
.rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.rate-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rate-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border-color: var(--accent);
}

.entity-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.entity-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-secondary);
    overflow: hidden;
    flex-shrink: 0;
}

.entity-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}



/* Ualá specific background */
.entity-icon.brand-uala,
.entity-icon.brand-mp,
.entity-icon.brand-cocos {
    background: #ffffff !important;
}

.entity-details h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.entity-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.extra-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.rate-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.tna-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.tna-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.progress-bg {
    height: 6px;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
}

/* Custom Scrollbar for tables */
.ratios-table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.ratios-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.ratios-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.ratios-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease-out;
}

/* ========== DOLLAR BRECHA ========== */
.dollar-brecha {
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 4px;
}

/* Inflation Table Columns */
.inflation-month {
    text-align: left;
    color: var(--text-secondary);
}

.inflation-val {
    text-align: right;
    font-weight: 700;
}

.inflation-accum {
    text-align: right;
    color: var(--text-primary);
    font-weight: 500;
}

/* ========== CRYPTO TABLE ========== */
.crypto-col-name {
    padding: 12px 0;
}

.crypto-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.crypto-sym {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.crypto-val {
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.crypto-col-change {
    text-align: right;
}

.rate-extra-info {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
    line-height: 1.2;
}

/* ========== MODAL STYLES ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: var(--input-bg);
    color: var(--text-primary);
}

.term-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.term-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.term-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.term-number {
    background: var(--accent);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.term-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    padding-left: 28px;
}

.btn-conditions {
    width: 100%;
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-conditions:hover {
    background: var(--input-bg);
    border-color: var(--accent);
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
    .main-header .container {
        padding: 0 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .nav-group {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }

    nav {
        display: flex;
        gap: 0;
        justify-content: center;
        width: 100%;
        font-size: 0.9rem;
    }

    nav a {
        margin: 0 10px;
    }

    .theme-btn {
        margin-left: 0;
    }

    .sub-header {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-align: center;
    }

    .main-layout,
    .cedear-layout {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-top: 25px;
    }

    .sidebar-section {
        order: 2;
        /* Main content first, sidebar second */
    }

    /* Exceptions for specific sidebars if needed */
    .market-sidebar {
        order: 2;
    }

    .cedear-prices-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .btn-clear-minimal {
        width: 100%;
    }

    .cedear-calc-box {
        position: static;
        /* Remove sticky on mobile */
    }

    .section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ticker-item {
        font-size: 0.8rem;
    }

    .rates-grid {
        grid-template-columns: 1fr;
    }

    .modal-container {
        width: 95%;
        padding: 20px;
    }

    .converter-inputs {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .exchange-icon {
        transform: rotate(90deg);
        /* Rotate arrow for vertical stack */
        margin: 5px 0;
    }

    /* Fix for Chart Section on Mobile */
    .chart-section {
        padding: 15px;
        margin-top: 15px;
    }

    .chart-container {
        height: 250px;
    }

    .chart-header h3 {
        font-size: 0.9rem;
    }
}