/* Modern Dark DEX-Style UI */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #131829;
    --bg-tertiary: #1a1f35;
    --bg-card: rgba(26, 31, 53, 0.8);
    --bg-card-hover: rgba(26, 31, 53, 0.95);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-tertiary: #718096;
    --accent-primary: #0088cc;
    --accent-secondary: #00d4ff;
    --success: #00d97e;
    --warning: #ffb020;
    --error: #ff4444;
    --gradient-primary: linear-gradient(135deg, #0088cc 0%, #00d4ff 100%);
    --gradient-secondary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 136, 204, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 212, 255, 0.1) 0px, transparent 50%);
    min-height: 100vh;
    padding: 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card h3 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

/* Status Card */
#statusCard {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
    position: relative;
}

.status-indicator::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: var(--success);
}

.status-indicator.connected::after {
    background: var(--success);
    opacity: 0.6;
}

.status-indicator.disconnected {
    background: var(--error);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.info-item label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.address {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.875rem;
    word-break: break-all;
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.balance {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-secondary);
    letter-spacing: -0.02em;
}

.usd-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: -0.02em;
}

/* Assets Summary */
.assets-summary {
    display: flex;
    gap: 2rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.asset-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.asset-count .count {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.asset-count .label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

/* Can Pay Status */
.can-pay-status {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-top: 1rem;
    font-weight: 500;
    border: 2px solid;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.can-pay-status.success {
    background: rgba(0, 217, 126, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.can-pay-status.error {
    background: rgba(255, 68, 68, 0.1);
    color: var(--error);
    border-color: var(--error);
}

/* Asset Lists */
#jettonsList, #nftsList {
    display: grid;
    gap: 0.75rem;
}

.jetton-item, .nft-item {
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.jetton-item:hover, .nft-item:hover {
    background: var(--bg-secondary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.jetton-item .info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.jetton-item .symbol {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.jetton-item .symbol .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.jetton-item .symbol .badge.scam {
    background: rgba(255, 68, 68, 0.2);
    color: var(--error);
}

.jetton-item .symbol .badge.verified {
    background: rgba(0, 217, 126, 0.2);
    color: var(--success);
}

.jetton-item .balance {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.jetton-item .usd {
    color: var(--success);
    font-weight: 600;
    font-size: 1.1rem;
    text-align: right;
}

.nft-item .name {
    font-weight: 500;
    color: var(--text-primary);
}

.nft-item .index {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 160px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(0, 136, 204, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #00b86b 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(0, 217, 126, 0.4);
}

.btn-small {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    min-width: auto;
}

/* Messages */
#messageContainer {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message.success {
    background: rgba(0, 217, 126, 0.15);
    color: var(--success);
    border-color: var(--success);
}

.message.error {
    background: rgba(255, 68, 68, 0.15);
    color: var(--error);
    border-color: var(--error);
}

.message.info {
    background: rgba(0, 136, 204, 0.15);
    color: var(--accent-secondary);
    border-color: var(--accent-primary);
}

/* Loading States */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--text-primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }

    .assets-summary {
        flex-direction: column;
        gap: 1rem;
    }

    #messageContainer {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-secondary);
}

/* Loading Modal */
.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loading-modal-content {
    text-align: center;
    padding: 3rem;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.loading-modal-content h3 {
    margin: 1.5rem 0 0.75rem 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.loading-modal-content p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

/* Loading Spinner */
.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
    border-top-color: var(--accent-primary);
}

.spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
    border-top-color: var(--accent-secondary);
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
}

.spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
    border-top-color: var(--success);
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}