/**
 * NEXAIT Currency Suite - Frontend Styles
 *
 * @package NexaIT_Currency_Suite
 */

/* ========================================
   CURRENCY TABLE STYLES
   ======================================== */

.nexait-currency-table {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.nexait-table-header {
    background: #b02e27;
    color: #ffffff;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nexait-table-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.nexait-table-header .last-update {
    font-size: 14px;
    opacity: 0.9;
}

.nexait-table-wrapper {
    overflow-x: auto;
}

.nexait-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.nexait-table thead {
    background: #b02e27;
    color: #ffffff;
}

.nexait-table thead th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nexait-table tbody tr {
    border-bottom: 1px solid #ecf0f1;
    transition: background 0.3s ease;
}

.nexait-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.nexait-table tbody tr:hover {
    background: #fff5f4;
}

.nexait-table tbody td {
    padding: 18px 20px;
    font-size: 15px;
}

/* Currency Info Column */
.currency-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.currency-flag {
    width: 32px;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.currency-code {
    font-weight: 700;
    font-size: 16px;
    color: #2c3e50;
    min-width: 45px;
}

.currency-name {
    color: #7f8c8d;
    font-size: 14px;
}

/* Rate Columns */
.rate-buy,
.rate-sell {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
    font-family: 'Courier New', monospace;
}

.rate {
    display: inline-block;
    transition: all 0.3s ease;
}

.rate.rate-updating {
    animation: rateUpdate 0.5s ease;
}

@keyframes rateUpdate {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

/* Trend Column */
.trend {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
}

.trend-up {
    color: #27ae60;
}

.trend-down {
    color: #e74c3c;
}

.trend-stable {
    color: #95a5a6;
}

.trend small {
    display: block;
    font-size: 11px;
    margin-top: 2px;
}

/* Responsive Table */
@media screen and (max-width: 768px) {
    .nexait-table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .nexait-table {
        font-size: 13px;
    }

    .nexait-table thead th,
    .nexait-table tbody td {
        padding: 12px 10px;
    }

    .currency-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .currency-name {
        display: none;
    }
}

/* ========================================
   CURRENCY CALCULATOR STYLES
   ======================================== */

.nexait-calculator {
    --nexait-accent: #b02e27;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 30px rgba(176, 46, 39, 0.08);
    padding: 32px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

.calculator-header {
    margin-bottom: 25px;
}

.calculator-header h3 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
    color: #2c3e50;
}

/* Calculator Body */
.calculator-body {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nexait-calculator.layout-vertical .calculator-body {
    flex-direction: column;
    gap: 20px;
}

.currency-input {
    flex: 1;
    min-width: 260px;
}

.currency-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.nexait-calculator.layout-vertical .input-group {
    flex-direction: column;
}

.nexait-calculator.layout-vertical .amount-card,
.nexait-calculator.layout-vertical .currency-card {
    min-width: 100%;
    width: 100%;
}

.nexait-calculator.layout-vertical .swap-button-wrapper {
    align-self: center;
}

.input-card {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #f7f9ff;
    border: 1.5px solid #d8e3f7;
    border-radius: 16px;
    padding: 14px 18px;
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.amount-card {
    flex: 1.2;
}

.currency-card {
    flex: 0.9;
    position: relative;
    min-width: 180px;
}

.input-card:focus-within {
    background: #ffffff;
    border-color: var(--nexait-accent, #b02e27);
    box-shadow: 0 0 0 4px rgba(176, 46, 39, 0.15);
}

.result-card {
    background: #eef2fb;
    border-color: #d9e2f5;
}

.result-card .result-input {
    color: #1f2a37;
    opacity: 0.85;
}

.result-card:focus-within {
    box-shadow: none;
}

.amount-input,
.result-input,
.currency-select {
    border: none;
    background: transparent;
    width: 100%;
    padding: 0;
    margin: 0;
    font-size: clamp(18px, 2vw, 26px);
    font-weight: 600;
    color: #1f2937;
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
}

.amount-input:focus,
.result-input:focus,
.currency-select:focus {
    outline: none;
}

.amount-input {
    cursor: text;
}

.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.amount-input[type="number"] {
    appearance: textfield;
}

.result-input {
    cursor: default;
}

.currency-card::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 18px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1f2a37;
    pointer-events: none;
    transform: translateY(-25%);
    transition: border-color 0.25s ease;
}

.currency-select {
    appearance: none;
    cursor: pointer;
    font-size: clamp(14px, 1.5vw, 18px);
    font-weight: 600;
    color: #1f2937;
    padding-right: 32px;
}

.currency-select option {
    font-size: 16px;
    font-weight: 500;
    color: #1f2937;
}

.currency-card:focus-within::after {
    border-top-color: var(--nexait-accent, #b02e27);
}

/* Swap Button */
.swap-button-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.swap-button {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--nexait-accent, #b02e27);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 12px 24px rgba(176, 46, 39, 0.25);
}

.swap-button:hover {
    transform: rotate(180deg);
    filter: brightness(0.95);
    box-shadow: 0 16px 28px rgba(176, 46, 39, 0.3);
}

.swap-button:active {
    transform: rotate(180deg) scale(0.95);
    filter: brightness(0.9);
}

.swap-button svg {
    width: 24px;
    height: 24px;
}

/* Calculator Info */
.calculator-info {
    padding: 18px 24px;
    background: #f5f8ff;
    border-radius: 12px;
    border-left: 4px solid var(--nexait-accent, #b02e27);
}

.rate-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.rate-info .label {
    font-weight: 600;
    color: #7f8c8d;
}

.rate-info .rate-value {
    font-weight: 700;
    color: var(--nexait-accent, #b02e27);
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
}

/* Loading State */
.calculator-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ecf0f1;
    border-top-color: var(--nexait-accent, #b02e27);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Calculator */
@media screen and (max-width: 768px) {
    .nexait-calculator {
        padding: 24px;
    }

    .calculator-body {
        flex-direction: column;
        gap: 20px;
    }

    .input-group {
        flex-direction: column;
    }

    .currency-card {
        min-width: 100%;
    }

    .currency-card::after {
        right: 20px;
    }

    .amount-input,
    .result-input {
        font-size: 20px;
    }

    .currency-select {
        font-size: 16px;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.nexait-hidden {
    display: none !important;
}

.nexait-fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .nexait-table-header,
    .calculator-header {
        background: none !important;
        color: #000 !important;
    }

    .swap-button,
    .calculator-loading {
        display: none !important;
    }
}
