/**
 * TCP Crypto Converter Widget Styles
 *
 * @package TCP_Crypto_Widgets
 */

/* Base Converter Styles */
.tcp-converter {
    background: var(--tcp-bg-secondary, #f8f9fa);
    border-radius: 12px;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.tcp-converter-title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: var(--tcp-text-primary, #1a1a2e);
}

/* Converter Row */
.tcp-converter-row {
    margin-bottom: 12px;
}

.tcp-converter-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--tcp-text-secondary, #6c757d);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Input Group */
.tcp-converter-input-group {
    display: flex;
    align-items: stretch;
    background: var(--tcp-bg-primary, #ffffff);
    border: 1px solid var(--tcp-border-color, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tcp-converter-input-group:focus-within {
    border-color: var(--tcp-primary-color, #3861fb);
    box-shadow: 0 0 0 3px rgba(56, 97, 251, 0.1);
}

/* Amount Input */
.tcp-converter-amount,
.tcp-converter-result {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 18px;
    font-weight: 500;
    color: var(--tcp-text-primary, #1a1a2e);
    outline: none;
}

.tcp-converter-amount::placeholder,
.tcp-converter-result::placeholder {
    color: var(--tcp-text-muted, #adb5bd);
}

.tcp-converter-result {
    background: var(--tcp-bg-tertiary, #f1f3f5);
    color: var(--tcp-text-primary, #1a1a2e);
}

/* Remove number input spinners */
.tcp-converter-amount::-webkit-outer-spin-button,
.tcp-converter-amount::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tcp-converter-amount[type=number] {
    -moz-appearance: textfield;
}

/* Select Wrapper */
.tcp-converter-select-wrapper {
    position: relative;
    min-width: 100px;
    border-left: 1px solid var(--tcp-border-color, #e0e0e0);
}

.tcp-converter-select {
    width: 100%;
    height: 100%;
    padding: 12px 32px 12px 12px;
    border: none;
    background: var(--tcp-bg-secondary, #f8f9fa);
    font-size: 14px;
    font-weight: 600;
    color: var(--tcp-text-primary, #1a1a2e);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.tcp-converter-select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--tcp-text-secondary, #6c757d);
    pointer-events: none;
}

/* Swap Button */
.tcp-converter-swap {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.tcp-swap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--tcp-border-color, #e0e0e0);
    border-radius: 50%;
    background: var(--tcp-bg-primary, #ffffff);
    color: var(--tcp-text-secondary, #6c757d);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tcp-swap-btn:hover {
    background: var(--tcp-primary-color, #3861fb);
    border-color: var(--tcp-primary-color, #3861fb);
    color: #ffffff;
    transform: rotate(180deg);
}

.tcp-swap-icon {
    font-size: 16px;
    line-height: 1;
}

/* Rate Display */
.tcp-converter-rate {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--tcp-border-color, #e0e0e0);
    text-align: center;
}

.tcp-rate-text {
    font-size: 13px;
    color: var(--tcp-text-secondary, #6c757d);
}

/* Layout Variations */

/* Horizontal Layout */
.tcp-converter-horizontal {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.tcp-converter-horizontal .tcp-converter-row {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.tcp-converter-horizontal .tcp-converter-swap {
    flex: 0 0 auto;
    padding: 0;
    align-self: flex-end;
    margin-bottom: 4px;
}

.tcp-converter-horizontal .tcp-converter-rate {
    flex: 0 0 100%;
    margin-top: 8px;
    padding-top: 8px;
}

/* Inline Layout (for header) */
.tcp-converter-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
}

.tcp-converter-inline .tcp-converter-row {
    margin-bottom: 0;
}

.tcp-converter-inline .tcp-converter-label {
    display: none;
}

.tcp-converter-inline .tcp-converter-input-group {
    background: var(--tcp-bg-primary, #ffffff);
}

.tcp-converter-inline .tcp-converter-amount,
.tcp-converter-inline .tcp-converter-result {
    padding: 8px 12px;
    font-size: 14px;
}

.tcp-converter-inline .tcp-converter-select {
    padding: 8px 24px 8px 8px;
    font-size: 12px;
}

.tcp-converter-inline .tcp-converter-swap {
    padding: 0;
}

.tcp-converter-inline .tcp-swap-btn {
    width: 28px;
    height: 28px;
}

.tcp-converter-inline .tcp-converter-rate {
    display: none;
}

/* Compact Layout */
.tcp-converter-compact .tcp-converter-amount,
.tcp-converter-compact .tcp-converter-result {
    padding: 10px 12px;
    font-size: 16px;
}

.tcp-converter-compact .tcp-converter-select {
    padding: 10px 28px 10px 10px;
    font-size: 13px;
}

/* Loading State */
.tcp-converter.tcp-loading .tcp-converter-result {
    background: linear-gradient(90deg, #f1f3f5 25%, #e9ecef 50%, #f1f3f5 75%);
    background-size: 200% 100%;
    animation: tcp-shimmer 1.5s infinite;
}

@keyframes tcp-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Error State */
.tcp-converter.tcp-error .tcp-converter-input-group {
    border-color: var(--tcp-negative-color, #ea3943);
}

.tcp-converter-error-message {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(234, 57, 67, 0.1);
    border-radius: 6px;
    font-size: 13px;
    color: var(--tcp-negative-color, #ea3943);
}

/* Widget Sidebar Styles */
.widget .tcp-converter {
    padding: 16px;
}

.widget .tcp-converter-amount,
.widget .tcp-converter-result {
    font-size: 16px;
    padding: 10px 12px;
}

.widget .tcp-converter-select {
    font-size: 13px;
    padding: 10px 28px 10px 10px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .tcp-converter {
        padding: 16px;
    }

    .tcp-converter-horizontal {
        flex-direction: column;
    }

    .tcp-converter-horizontal .tcp-converter-row {
        width: 100%;
        min-width: 0;
    }

    .tcp-converter-horizontal .tcp-converter-swap {
        width: 100%;
        justify-content: center;
        padding: 8px 0;
    }

    .tcp-converter-amount,
    .tcp-converter-result {
        font-size: 16px;
        padding: 12px;
    }

    .tcp-converter-select {
        min-width: 80px;
        font-size: 13px;
    }

    /* Stack inputs vertically on mobile */
    .tcp-converter-input-group {
        flex-direction: column;
    }

    .tcp-converter-select-wrapper {
        border-left: none;
        border-top: 1px solid var(--tcp-border-color, #e0e0e0);
    }

    .tcp-converter-select {
        padding: 10px 32px 10px 12px;
    }
}

@media (max-width: 480px) {
    .tcp-converter {
        padding: 12px;
        border-radius: 8px;
    }

    .tcp-converter-label {
        font-size: 11px;
    }

    .tcp-converter-amount,
    .tcp-converter-result {
        font-size: 14px;
        padding: 10px;
    }

    .tcp-swap-btn {
        width: 32px;
        height: 32px;
    }

    .tcp-rate-text {
        font-size: 12px;
    }
}

/* Dark Mode Support */
.dark-mode .tcp-converter,
[data-theme="dark"] .tcp-converter {
    --tcp-bg-primary: #1e1e2f;
    --tcp-bg-secondary: #16162a;
    --tcp-bg-tertiary: #252540;
    --tcp-text-primary: #ffffff;
    --tcp-text-secondary: #a0a0b0;
    --tcp-text-muted: #6c6c80;
    --tcp-border-color: #2d2d45;
}

/* Accessibility */
.tcp-converter-select:focus,
.tcp-converter-amount:focus {
    outline: 2px solid var(--tcp-primary-color, #3861fb);
    outline-offset: -2px;
}

.tcp-swap-btn:focus {
    outline: 2px solid var(--tcp-primary-color, #3861fb);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .tcp-converter-input-group {
        border-width: 2px;
    }

    .tcp-converter-select-wrapper {
        border-left-width: 2px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .tcp-swap-btn:hover {
        transform: none;
    }

    .tcp-converter.tcp-loading .tcp-converter-result {
        animation: none;
    }
}
