/**
 * KoinTool Swap v2.7 - Main Widget Styling
 * Protocol Update: Force Stacking (Flicker Fix) & Overflow Correction.
 */

:root {
    --kt-bg: #121318;
    --kt-card-bg: #1b1d23;
    --kt-input-bg: #0d0e12;
    --kt-primary: #3b82f6; /* Controlled by Elementor */
    --kt-text: #ffffff;
    --kt-text-dim: #94a3b8;
    --kt-border: #2d3139;
    --kt-radius: 12px;
}

.kointool-swap-container {
    width: 100%;
    max-width: 600px;
    height: auto; 
    min-height: 650px; 
    margin: 0 auto;
    background-color: var(--kt-bg);
    color: var(--kt-text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    border-radius: var(--kt-radius);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    border: 1px solid var(--kt-border);
    /* FIX: Force overflow visible so dropdowns aren't cut off */
    overflow: visible !important; 
}

/* Main Content Wrapper */
.kt-main-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-bottom: 20px;
}

/* Header */
.kt-header {
    padding: 30px 20px 10px;
    text-align: center;
}
.kt-header h3 { margin: 0; font-size: 24px; font-weight: 700; color: var(--kt-text); }
.kt-header p { margin: 5px 0 0; font-size: 14px; color: var(--kt-text-dim); }

/* Tabs */
.kt-tabs {
    display: flex;
    gap: 10px;
    padding: 20px;
    justify-content: center;
}
.kt-tabs-label {
    background: none;
    border: 1px solid var(--kt-border);
    color: var(--kt-text-dim);
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.kt-tabs-label.active {
    background-color: var(--kt-primary);
    border-color: var(--kt-primary);
    color: #fff;
}

/* Input Groups - FIX: Added !important to force stacking order and kill flickering */
.kt-input-group {
    padding: 0 25px;
    margin-bottom: 15px;
    position: relative; 
}

/* Force the "YOU SEND" group to physically stay above "YOU GET" */
.kt-input-group:first-of-type { z-index: 1000 !important; } 
.kt-input-group:last-of-type { z-index: 500 !important; }

.kt-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--kt-text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
}
.kt-input-wrapper {
    background-color: var(--kt-input-bg);
    border: 1px solid var(--kt-border);
    border-radius: var(--kt-radius);
    display: flex;
    align-items: center;
    padding: 15px;
    position: relative;
}
.kt-input-wrapper input {
    background: none;
    border: none;
    color: var(--kt-text);
    font-size: 20px;
    font-weight: 600;
    width: 60%;
    outline: none;
}

/* Asset Select & Dropdown */
.kt-asset-select-container { position: relative; width: 40%; }
.kt-asset-select {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    cursor: pointer;
    padding: 5px;
}
.kt-asset-select img { width: 24px; height: 24px; border-radius: 50%; background: #2d3139; }
.kt-asset-select span { font-weight: 600; font-size: 16px; }

.kt-coin-dropdown {
    position: absolute;
    top: 110%;
    right: 0;
    width: 280px;
    max-height: 400px;
    background-color: var(--kt-card-bg);
    border: 1px solid var(--kt-border);
    border-radius: var(--kt-radius);
    z-index: 9999 !important; /* Force dropdown to very top of everything */
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}
.kt-coin-search {
    padding: 12px;
    background: var(--kt-input-bg);
    border: none !important;
    border-bottom: 1px solid var(--kt-border) !important;
    width: 100% !important;
    font-size: 14px !important;
    color: #fff !important;
}
.kt-coin-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}
.kt-coin-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    cursor: pointer;
}
.kt-coin-item:hover { background-color: rgba(255,255,255,0.05); }
.kt-coin-item img { width: 24px; height: 24px; }

/* Divider & Rate Info */
.kt-divider { text-align: center; margin: 5px 0; color: var(--kt-primary); font-size: 20px; }
.kt-dynamic-info {
    text-align: center;
    padding: 10px 25px;
    margin-top: 10px;
}
.kt-rate-line { font-size: 14px; color: var(--kt-text-dim); font-weight: 500; }

/* Button */
.kt-btn-primary {
    background-color: var(--kt-primary);
    border: none;
    color: #fff;
    width: calc(100% - 50px);
    margin: 40px 25px 40px; 
    padding: 18px;
    border-radius: var(--kt-radius);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}