/* ========================================
   EV Efficiency Converter Widget Styles
   ======================================== */

.kwh-widget {
    --widget-bg: #ffffff;
    --widget-border: rgba(34, 139, 34, 0.3);
    --widget-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --accent-primary: #228B22;
    --accent-secondary: #20B2AA;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --input-bg: rgba(0, 0, 0, 0.03);
    --input-border: rgba(0, 0, 0, 0.08);
    --input-focus: rgba(34, 139, 34, 0.3);
    --toggle-inactive: rgba(0, 0, 0, 0.06);
    --toggle-active: #228B22;

    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--widget-bg);
    border: 1px solid var(--widget-border);
    border-radius: 24px;
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--widget-shadow);
    position: relative;
    overflow: hidden;
}



/* Widget Header */
.kwh-widget__header {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.kwh-widget__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.kwh-widget__title-icon {
    font-size: 1.5rem;
}

.kwh-widget__subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Unit Toggle */
.kwh-widget__toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.kwh-widget__toggle {
    display: flex;
    background: var(--toggle-inactive);
    border-radius: 50px;
    padding: 4px;
    position: relative;
}

.kwh-widget__toggle-btn {
    padding: 0.6rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.kwh-widget__toggle-btn.active {
    color: #ffffff;
}

.kwh-widget__toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: calc(50% - 4px);
    background: var(--toggle-active);
    border-radius: 50px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(34, 139, 34, 0.3);
}

.kwh-widget__toggle.imperial .kwh-widget__toggle-slider {
    transform: translateX(100%);
}

/* Conversion Sections */
.kwh-widget__conversions {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.kwh-widget__section {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.kwh-widget__section:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(34, 139, 34, 0.15);
}

.kwh-widget__section:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(34, 139, 34, 0.2);
}

.kwh-widget__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.kwh-widget__input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.kwh-widget__input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
    width: 100%;
    outline: none;
    font-family: inherit;
}

.kwh-widget__input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

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

.kwh-widget__input[type=number] {
    -moz-appearance: textfield;
}

.kwh-widget__unit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(34, 139, 34, 0.12);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    white-space: nowrap;
}

/* Swap Button */
.kwh-widget__swap {
    display: flex;
    justify-content: center;
    margin: -0.5rem 0;
    position: relative;
    z-index: 2;
}

.kwh-widget__swap-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    background: #ffffff;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(34, 139, 34, 0.2);
}

.kwh-widget__swap-btn:hover {
    background: var(--accent-primary);
    color: #ffffff;
    transform: scale(1.1) rotate(180deg);
}

.kwh-widget__swap-btn:active {
    transform: scale(0.95);
}

/* MPGe Display (Imperial only) */
.kwh-widget__mpge-section {
    margin: 8px;
    padding: 1rem;
    background: rgba(34, 139, 34, 0.08);
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(34, 139, 34, 0.15);
}

.kwh-widget__mpge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.kwh-widget__mpge-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kwh-widget__mpge-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    min-width: 3ch;
    transition: transform 0.2s ease;
}

.kwh-widget__mpge-value.pulse {
    animation: value-pulse 0.2s ease-out;
}

.kwh-widget__mpge-unit {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.kwh-widget__mpge-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0 0;
}

/* Formula Display */
.kwh-widget__formula {
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    background: rgba(32, 178, 170, 0.1);
    border-radius: 10px;
    text-align: center;
    border: 1px solid rgba(32, 178, 170, 0.2);
}

.kwh-widget__formula-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.kwh-widget__formula-highlight {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Footer */
.kwh-widget__footer {
    margin-top: 1.5rem;
    text-align: center;
}

.kwh-widget__hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Responsive */
@media (max-width: 480px) {
    .kwh-widget {
        padding: 1.5rem;
        border-radius: 20px;
    }

    .kwh-widget__input {
        font-size: 1.5rem;
    }

    .kwh-widget__toggle-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .demo-container h1 {
        font-size: 1.8rem;
    }
}

/* Animation for value changes */
@keyframes value-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }

    100% {
        transform: scale(1);
    }
}

.kwh-widget__input.pulse {
    animation: value-pulse 0.2s ease-out;
}