/* =========================================
   LIVE FOREX EXCHANGE RATES STYLES
   ========================================= */
.forex-section {
    position: relative;
    overflow: hidden;
}

.forex-card {
    background: var(--color-white);
    transition: var(--transition);
}

body.dark-mode .forex-card {
    background: var(--color-bg-card);
    border-color: rgba(255, 255, 255, 0.1);
}

.market-overview-expanded {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .market-overview-expanded .forex-table-container {
        max-height: 850px !important;
    }
}


.forex-input-group {
    margin-bottom: 1.5rem;
}

.forex-input {
    width: 100%;
    padding: 0.85rem;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
    background: var(--color-white);
    color: var(--color-text);
    font-family: var(--font-body);
    font-weight: 500;
    transition: var(--transition);
}

body.dark-mode .forex-input {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

.forex-input:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(197, 160, 57, 0.15);
}

.forex-result-box {
    background: var(--color-bg-body);
    padding: 1.75rem;
    border-radius: 1rem;
    text-align: center;
    border: 1px solid var(--color-secondary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

body.dark-mode .forex-result-box {
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.forex-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px;
    border-radius: 0.75rem;
}

.forex-table {
    width: 100%;
    border-collapse: collapse;
}

.forex-table th {
    padding: 1.25rem 0.75rem;
    color: var(--color-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

body.dark-mode .forex-table th {
    color: var(--color-white);
}

.forex-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--color-text);
}

body.dark-mode .forex-table td {
    color: rgba(255, 255, 255, 0.8);
}

.forex-table tr:hover td {
    background: rgba(197, 160, 57, 0.03);
}

body.dark-mode .forex-table tr:hover td {
    background: rgba(34, 211, 238, 0.03);
}

.forex-table-header-row {
    border-bottom: 2px solid var(--color-secondary);
}

.forex-table-loading-text {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-light);
}

.forex-disclaimer {
    font-size: 0.7rem;
    color: var(--color-text-light);
    margin-top: 1rem;
    font-style: italic;
}

body.dark-mode .forex-disclaimer,
body.dark-mode .forex-table-loading-text {
    color: rgba(255, 255, 255, 0.5);
}

body.dark-mode .forex-table-header-row {
    border-bottom-color: var(--color-accent);
}

.forex-converter {
    margin-top: 1rem;
}

#forex-rate-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

body.dark-mode #forex-rate-text {
    color: var(--color-white);
}

#forex-timestamp {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

body.dark-mode #forex-timestamp {
    color: rgba(255, 255, 255, 0.6);
}

/* Historical Rates Lookup Tool - Centered Horizontal Layout */
.history-controls-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.history-currency-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.history-currency-select {
    max-width: 220px;
    min-width: 150px;
}

.history-select {
    font-size: 0.95rem;
    padding: 0.8rem 1rem;
}

.history-swap-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--glass-border);
    background: var(--color-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-bottom: 0.2rem;
}

.history-swap-btn svg {
    width: 20px;
    height: 20px;
    color: var(--color-text);
}

.history-swap-btn:hover {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
}

.history-swap-btn:hover svg {
    color: var(--color-white);
}

body.dark-mode .history-swap-btn {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .history-swap-btn svg {
    color: var(--color-white);
}

body.dark-mode .history-swap-btn:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

body.dark-mode .history-swap-btn:hover svg {
    color: #000;
}

.history-options-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0;
    /* Removed fixed margin */
}

.history-options-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

body.dark-mode .history-options-title {
    color: var(--color-white);
}

.history-radio-group {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.03);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--glass-border);
}

body.dark-mode .history-radio-group {
    background: rgba(255, 255, 255, 0.05);
}

.history-radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-text);
    transition: var(--transition);
}

/* Custom Radio Button */
.history-radio-label input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    background: var(--color-white);
}

.history-radio-label input[type="radio"]:hover {
    border-color: var(--color-secondary);
}

.history-radio-label input[type="radio"]:checked {
    border-color: var(--color-primary);
    background: var(--color-white);
}

.history-radio-label input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
}

body.dark-mode .history-radio-label input[type="radio"] {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
}

body.dark-mode .history-radio-label input[type="radio"]:hover {
    border-color: var(--color-accent);
}

body.dark-mode .history-radio-label input[type="radio"]:checked {
    border-color: var(--color-accent);
}

body.dark-mode .history-radio-label input[type="radio"]:checked::after {
    background: var(--color-accent);
}

.history-radio-text {
    font-weight: 600;
}

.history-radio-label:hover .history-radio-text {
    color: var(--color-secondary);
}

body.dark-mode .history-radio-label:hover .history-radio-text {
    color: var(--color-accent);
}

.history-period-select {
    width: 180px;
    font-size: 0.95rem;
    padding: 0.8rem 1rem;
}

.history-custom-dates {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
    flex-wrap: wrap;
    width: 100%;
}

.history-date-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-date-input-group label {
    font-size: 0.85rem;
    color: var(--color-text);
    font-weight: 600;
}

.history-date-input-group input[type="date"] {
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

body.dark-mode .history-date-input-group label {
    color: var(--color-white);
}

.history-retrieve-btn {
    min-width: 160px;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    background: var(--color-primary);
    border-radius: 0.5rem;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0.1rem;
}

.history-retrieve-btn:hover {
    background: var(--color-secondary);
    color: var(--color-white) !important;
    transform: translateY(-2px);
}

.history-retrieve-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.history-results {
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.history-results-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--color-primary);
}

body.dark-mode .history-results-info h4 {
    color: var(--color-white);
}

.history-date-range {
    margin: 0 0 0.25rem 0;
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-weight: 500;
}

.history-data-count {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-secondary);
    font-weight: 600;
}

body.dark-mode .history-data-count {
    color: var(--color-accent);
}

.history-download-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.history-download-btn:hover {
    background: var(--color-secondary);
    transform: translateY(-2px);
}

body.dark-mode .history-download-btn {
    background: var(--color-accent);
    color: #000;
}

body.dark-mode .history-download-btn:hover {
    background: var(--color-white);
}

.history-table-container {
    max-height: 50vh;
    overflow-y: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
}

.history-table {
    width: 100%;
}

.history-table td {
    text-align: center;
}


@media (max-width: 992px) {
    .history-controls-wrapper {
        gap: 1rem;
    }
}

@media (max-width: 600px) {

    .history-controls-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .history-currency-row {
        flex-direction: column;
        align-items: stretch;
    }

    .history-currency-select {
        max-width: 100%;
    }

    .history-swap-btn {
        align-self: center;
        transform: rotate(90deg);
    }

    .history-radio-group {
        gap: 1rem;
    }
}