/* Custom CSS for Swap dApp - Mobile Optimized */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --gradient-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --border-radius: 15px;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header Styles */
.navbar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Swap Card Styles */
.swap-card {
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

.card-header.bg-gradient {
    background: var(--gradient-bg) !important;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Token Input Styles */
.token-input-container {
    position: relative;
}

.input-group {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-control {
    border: 2px solid #e9ecef;
    border-right: none;
    font-size: 1.2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background: white;
}

.token-selector {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-left: none;
    min-width: 120px;
    transition: all 0.3s ease;
}

.token-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.token-symbol {
    font-weight: bold;
    color: #495057;
    font-size: 0.9rem;
}

.balance-info {
    text-align: right;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.max-btn {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s ease;
}

.max-btn:hover {
    color: var(--primary-color);
    text-decoration: underline;
    transform: scale(1.05);
}

/* Swap Arrow */
.swap-arrow {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
    position: relative;
    z-index: 10;
    background: white;
}

.swap-arrow:hover {
    transform: rotate(180deg);
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.swap-arrow:active {
    transform: rotate(180deg) scale(0.95);
}

/* Balance Summary Card */
.balance-summary-card {
    background: rgba(13, 110, 253, 0.05);
    border: 1px solid rgba(13, 110, 253, 0.1);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.balance-summary-card:hover {
    background: rgba(13, 110, 253, 0.08);
    transform: translateY(-2px);
}

.balance-item {
    text-align: center;
    padding: 0.5rem;
}

.balance-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
}

/* Swap Button */
.swap-btn {
    border-radius: 12px;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    background: var(--gradient-bg);
    border: none;
    position: relative;
    overflow: hidden;
}

.swap-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
}

.swap-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.swap-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Network Warning */
#networkWarning {
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
}

/* Status Messages */
.alert {
    border-radius: 12px;
    border: none;
    font-weight: 500;
    animation: slideInDown 0.3s ease-out;
}

.alert-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
}

.alert-danger {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #17a2b8, #007bff);
    color: white;
}

/* Modal Styles */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--card-shadow);
}

.modal-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.wallet-option {
    transition: all 0.3s ease;
    border-radius: 12px;
}

.wallet-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
    border-color: var(--primary-color);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.swap-card {
    animation: fadeInUp 0.6s ease-out;
}

/* Loading Animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Wallet Connection Status */
.wallet-connected {
    background: var(--success-color) !important;
    animation: pulse 2s infinite;
}

.wallet-disconnected {
    background: var(--secondary-color) !important;
}

/* Hover Effects */
.card:hover {
    transform: translateY(-5px);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .swap-card {
        margin: 15px 0;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .form-control {
        font-size: 1rem;
        padding: 12px;
    }
    
    .token-selector {
        min-width: 90px;
        padding: 12px 10px;
    }
    
    .token-symbol {
        font-size: 0.8rem;
    }
    
    .swap-btn {
        padding: 12px;
        font-size: 1rem;
    }
    
    .swap-arrow {
        width: 45px;
        height: 45px;
    }
    
    .balance-summary-card {
        padding: 0.75rem;
    }
    
    .balance-item {
        padding: 0.25rem;
    }
    
    .balance-label {
        font-size: 0.7rem;
    }
    
    .balance-value {
        font-size: 0.8rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 5px;
    }
    
    .card-header h3 {
        font-size: 1.2rem;
    }
    
    .form-control {
        font-size: 0.9rem;
    }
    
    .token-selector {
        min-width: 80px;
        padding: 10px 8px;
    }
    
    .balance-info {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25rem;
    }
    
    .max-btn {
        align-self: flex-end;
    }
}

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .swap-arrow {
        width: 50px;
        height: 50px;
    }
    
    .wallet-option {
        min-height: 60px;
    }
    
    .form-control {
        min-height: 50px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        color: #ffffff;
    }
    
    .swap-card {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(20px);
    }
    
    .form-control {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        color: #ffffff;
    }
    
    .form-control:focus {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .token-selector {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .balance-summary-card {
        background: rgba(13, 110, 253, 0.1);
        border-color: rgba(13, 110, 253, 0.2);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-bg);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Focus indicators for accessibility */
.btn:focus,
.form-control:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .swap-card {
        border: 2px solid #000000;
    }
    
    .btn {
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .swap-arrow:hover {
        transform: none;
    }
}
