/* swap.css */
:root {
    --primary: #4ADBFF;
    --secondary: #1B2D45;
    --mint: #E0FFF4;
    --outline: 4px;
}

.swap-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
}

.swap-wrapper {
    background: var(--mint);
    border: var(--outline) solid var(--secondary);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 8px 8px 0 var(--secondary);
    position: relative;
    overflow: hidden;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.swap-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 8px 8px 0 var(--secondary);
}

/* Token Input Styles */
.token-input-group {
    position: relative;
    z-index: 1;
    width: 100%;
    margin-bottom: 20px;
}

.token-input-group label {
    display: block;
    color: var(--secondary);
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 0.9rem;
}

.token-input-container {
    background: var(--primary);
    border: var(--outline) solid var(--secondary);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 4px 4px 0 var(--secondary);
}

.token-input-container:focus-within {
    box-shadow: 0 0 0 2px rgba(74, 219, 255, 0.2);
}

.token-input-container input {
    background: none;
    border: none;
    flex: 1;
    font-size: 1.2rem;
    color: var(--secondary);
    outline: none;
    font-family: 'Nunito', sans-serif;
}

.token-input-container input::placeholder {
    color: rgba(27, 45, 69, 0.5);
}

/* Token Selector Button */
.token-selector {
    background: var(--mint);
    border: 3px solid var(--secondary);
    border-radius: 12px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.6s ease;
    font-weight: bold;
    color: var(--secondary);
    transform-style: preserve-3d;
    perspective: 1000px;
}

.token-selector:hover {
    transform: translateY(-1px);
    background: var(--primary);
}

.token-selector img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* Swap Arrow */
.swap-arrow {
    text-align: center;
    margin: 15px auto;
    color: var(--secondary);
    font-size: 1.2rem;
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.swap-arrow i {
    background: var(--primary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid var(--secondary);
    cursor: pointer;
    transition: all 0.8s ease;
    position: absolute;
    left: 50%;
    transform-origin: center;
    transform: translateX(-50%);
    box-shadow: 0 0 0 rgba(0,0,0,0);
    opacity: 0.8;
}

.swap-arrow i:hover {
    opacity: 1;
    transform: translateX(-50%) scale(1.1);
}

.swap-arrow i.rotating {
    transform: translateX(-50%) rotate(180deg);
    background: var(--mint);
}

.swap-arrow i.rotating:hover {
    transform: translateX(-50%) rotate(180deg) translateY(-2px);
    box-shadow: 0 -4px 8px rgba(0,0,0,0.2);
}

/* Swap Button */
.swap-button {
    width: 100%;
    background: var(--secondary);
    color: var(--mint);
    border: none;
    border-radius: 16px;
    padding: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.6s ease;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.swap-button:not(:disabled):hover {
    transform: translateY(-1px);
}

.swap-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #999;
}

.swap-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: translateX(-100%);
    transition: transform 1s ease;
}

.swap-button:hover::after {
    transform: translateX(100%);
}

/* Loading Spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(74, 219, 255, 0.1);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: gentleSpin 2s linear infinite;
    margin: 0 auto;
    position: relative;
}

@keyframes gentleSpin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner::before,
.loading-spinner::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--mint);
    animation: spinnerGlow 1s linear infinite;
}

.loading-spinner::before {
    animation-delay: -0.5s;
}

@keyframes spinnerGlow {
    0% {
        transform: rotate(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(180deg) scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

/* Notification Styles */
#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    background: var(--mint);
    border: 3px solid var(--secondary);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 4px 4px 0 var(--secondary);
    animation: slideIn 0.5s forwards;
    max-width: 300px;
}

.notification.success i { color: #00c853; }
.notification.error i { color: #ff3d00; }

.notification-content {
    flex: 1;
    color: var(--secondary);
    font-size: 0.9rem;
}

.notification-close {
    background: none;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Balance Update Animation */
.balance-update {
    animation: balancePulse 0.5s ease;
}

@keyframes balancePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 480px) {
    .swap-wrapper {
        padding: 20px;
    }

    .token-input-container {
        padding: 10px;
    }

    .token-selector {
        padding: 4px 8px;
    }

    .token-selector img {
        width: 20px;
        height: 20px;
    }
}

/* Header Balance Styles */
#headerBalance {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary);
    border: var(--outline) solid var(--secondary);
    border-radius: 50px;
    color: var(--secondary);
    font-weight: bold;
    transition: all 0.3s ease;
}

#headerBalance.connected {
    background: var(--mint);
}

#headerBalance i {
    font-size: 1.1rem;
}

#headerBalance span {
    font-family: 'Nunito', sans-serif;
    transition: color 0.3s ease;
}

#headerBalance.balance-update span {
    color: #00ff00;
}

/* Blur effect styles */
.blur-background {
    filter: blur(5px);
    pointer-events: none;
    transition: filter 0.3s ease;
}

/* Swap panel'in blur olmaması için */
.hero-panel.swap-panel {
    filter: none !important;
    pointer-events: auto !important;
}

/* Geliştirilmiş Swap Animasyonları */
@keyframes swapDown {
    0% {
        transform: translateY(0) scale(1) rotate(0);
        opacity: 1;
        filter: brightness(1);
    }
    25% {
        transform: translateY(30%) scale(0.9) rotate(-5deg);
        opacity: 0.8;
        filter: brightness(1.2);
    }
    50% {
        transform: translateY(100%) scale(0.8) rotate(-10deg);
        opacity: 0;
        filter: brightness(1.5);
    }
    51% {
        transform: translateY(-100%) scale(0.8) rotate(10deg);
        opacity: 0;
        filter: brightness(1.5);
    }
    75% {
        transform: translateY(-30%) scale(0.9) rotate(5deg);
        opacity: 0.8;
        filter: brightness(1.2);
    }
    100% {
        transform: translateY(0) scale(1) rotate(0);
        opacity: 1;
        filter: brightness(1);
    }
}

@keyframes swapUp {
    0% {
        transform: translateY(0) scale(1) rotate(0);
        opacity: 1;
        filter: brightness(1);
    }
    25% {
        transform: translateY(-30%) scale(0.9) rotate(5deg);
        opacity: 0.8;
        filter: brightness(1.2);
    }
    50% {
        transform: translateY(-100%) scale(0.8) rotate(10deg);
        opacity: 0;
        filter: brightness(1.5);
    }
    51% {
        transform: translateY(100%) scale(0.8) rotate(-10deg);
        opacity: 0;
        filter: brightness(1.5);
    }
    75% {
        transform: translateY(30%) scale(0.9) rotate(-5deg);
        opacity: 0.8;
        filter: brightness(1.2);
    }
    100% {
        transform: translateY(0) scale(1) rotate(0);
        opacity: 1;
        filter: brightness(1);
    }
}

/* Input Container Animasyonu */
.swapping .token-input-container {
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Swap Container Efekti */
.swap-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.swap-container.swapping {
    pointer-events: none;
}

/* Parçacık Efektleri */
.swap-container.swapping::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    animation: particleWave 0.8s ease-out;
    background: repeating-radial-gradient(
        circle at center,
        var(--primary) 0%,
        transparent 10%,
        transparent 20%
    );
    opacity: 0;
}

@keyframes particleWave {
    0% {
        transform: scale(0.5);
        opacity: 0.5;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Işık Efekti */
.token-input-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        var(--primary) 0%, 
        transparent 50%, 
        var(--mint) 100%
    );
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.token-input-container:hover::before {
    display: none;
}

/* 3D Flip Efekti */
.token-selector:active {
    animation: flip 0.4s ease-out;
}

@keyframes flip {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(360deg); }
}

/* Swap Button Hover Efekti */
.swap-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.swap-button:hover::before {
    transform: translateX(100%);
}

/* Token Input Focus Efekti */
.token-input-container input:focus ~ .focus-ring {
    animation: focusPulse 2s ease-out infinite;
}

@keyframes focusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 219, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(74, 219, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 219, 255, 0);
    }
}

/* Swap Container Hover State */
.swap-container {
    transition: transform 0.3s ease;
}

.swap-container:hover {
    transform: translateY(-2px);
}

.swap-container:hover .token-input-container {
    box-shadow: 0 8px 16px rgba(27, 45, 69, 0.1);
}

/* Swap Panel Animasyonları */
.swap-wrapper:hover::before {
    opacity: 0.1;
    transform: scale(1) rotate(180deg);
}

/* Panel Arka Plan Efekti */
.swap-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle at center,
        var(--primary) 0%,
        transparent 50%
    );
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.6s ease;
    pointer-events: none;
    z-index: 0;
}

/* Panel Kenar Efekti */
.swap-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 2px;
    background: linear-gradient(
        90deg,
        var(--mint),
        var(--primary),
        var(--mint)
    );
    opacity: 0;
    transition: opacity 0.8s ease;
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.swap-wrapper:hover::after {
    opacity: 0.3;
}

/* Panel İçerik Animasyonu */
.swap-section {
    position: relative;
    z-index: 1;
}

.swap-section:hover .token-input-container {
    transform: none;
}

/* Aktif Panel Efekti */
.swap-wrapper.active {
    animation: panelPulse 1s ease-in-out;
}

@keyframes panelPulse {
    0% { transform: scale(1); }
    50% { 
        transform: scale(1.02);
        box-shadow: 15px 15px 0 var(--secondary);
    }
    100% { transform: scale(1); }
}

/* İşlem Başarılı Efekti */
.swap-wrapper.success::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(74, 219, 255, 0.1),
        transparent
    );
    animation: gentleWave 1.5s ease-in-out;
}

@keyframes gentleWave {
    0% {
        transform: translateX(-100%) translateY(-100%);
    }
    50% {
        transform: translateX(0%) translateY(0%);
    }
    100% {
        transform: translateX(100%) translateY(100%);
    }
}

/* Panel Yükleniyor Efekti */
.swap-wrapper.loading {
    position: relative;
}

.swap-wrapper.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(74, 219, 255, 0.1),
        transparent
    );
    animation: gentleShimmer 2s infinite linear;
}

@keyframes gentleShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* 3D Derinlik Efekti */
.swap-section {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.token-input-group {
    transition: transform 0.3s ease;
}

.swap-section:hover .token-input-group:first-child {
    transform: translateZ(10px) translateY(-2px);
}

.swap-section:hover .token-input-group:last-child {
    transform: translateZ(10px) translateY(2px);
}

/* Input Container için Özel Kurallar */
.token-input-container {
    position: relative;
    z-index: 2;
}

/* Input odaklandığında panel animasyonlarını devre dışı bırak */
.token-input-container:focus-within ~ .swap-wrapper::before,
.token-input-container:focus-within ~ .swap-wrapper::after {
    animation: none;
    opacity: 0;
}

/* Parçacık sistemi */
.swap-container.swapping::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: 
        radial-gradient(circle at 20% 30%, var(--primary) 0%, transparent 10%),
        radial-gradient(circle at 80% 70%, var(--mint) 0%, transparent 10%),
        radial-gradient(circle at 50% 50%, var(--secondary) 0%, transparent 10%),
        radial-gradient(circle at 30% 70%, var(--primary) 0%, transparent 10%),
        radial-gradient(circle at 70% 30%, var(--mint) 0%, transparent 10%);
    background-size: 
        20px 20px,
        15px 15px,
        25px 25px,
        18px 18px,
        22px 22px;
    animation: particleFloat 1s ease-out;
    opacity: 0;
}

@keyframes particleFloat {
    0% {
        background-position: 
            center center,
            center center,
            center center,
            center center,
            center center;
        opacity: 1;
    }
    100% {
        background-position: 
            -50px -50px,
            50px 50px,
            0px -50px,
            -50px 50px,
            50px -50px;
        opacity: 0;
    }
}

/* Panel İçerik Animasyonu - Input odaklanma durumunda devre dışı */
.swap-section:not(:has(.token-input-container:focus-within)):hover .token-input-container {
    transform: none;
}

/* 3D Derinlik Efekti - Input odaklanma durumunda devre dışı */
.swap-section:not(:has(.token-input-container:focus-within)) {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.token-input-group:not(:has(input:focus)) {
    transition: transform 0.3s ease;
}

/* Swap Container Hover State - Input odaklanma durumunda devre dışı */
.swap-container:not(:has(.token-input-container:focus-within)):hover {
    transform: translateY(-2px);
}

/* Panel Kenar Efekti - Input odaklanma durumunda devre dışı */
.swap-wrapper:not(:has(.token-input-container:focus-within)):hover::after {
    opacity: 0.3;
}

/* Success Animasyonu için Parçacıklar */
.swap-wrapper.success::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, #00ff00 0%, transparent 20%),
        radial-gradient(circle at 80% 70%, #00ff88 0%, transparent 20%),
        radial-gradient(circle at 50% 50%, #88ff00 0%, transparent 20%);
    background-size: 30px 30px;
    animation: successParticles 1s ease-out;
    opacity: 0;
}

@keyframes successParticles {
    0% {
        background-position: center;
        opacity: 1;
        transform: scale(0.5);
    }
    100% {
        background-position: 
            -100px -100px,
            100px 100px,
            0 -100px;
        opacity: 0;
        transform: scale(1.5);
    }
}

/* Input Focus Ring */
.token-input-container:focus-within {
    box-shadow: 0 0 0 2px rgba(74, 219, 255, 0.2);
}

/* Panel Hover Durumu */
.swap-section {
    transition: transform 0.3s ease;
}

.swap-section:not(:has(.token-input-container:focus-within)):hover {
    transform: none;
}