* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --primary-dark: #4338CA;
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --bg-color: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --border-color: #334155;
    --success-color: #10B981;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 20px 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #4F46E5, #10B981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Button Styles */
.connect-btn, .primary-btn, .secondary-btn, .icon-btn {
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 16px;
}

.connect-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 12px 28px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.5);
}

.connect-btn.connected {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 14px 32px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 12px 24px;
    width: 100%;
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: #475569;
}

.icon-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 18px;
    border: 1px solid var(--border-color);
}

.icon-btn:hover {
    background: #475569;
}

/* Mobile Wallet Deep Link Buttons */
.wallet-deep-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wallet-deep-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.wallet-icon {
    font-size: 24px;
}

.metamask-link {
    background: rgba(245, 130, 32, 0.12);
    color: #F59E0B;
    border-color: rgba(245, 130, 32, 0.3);
}

.metamask-link:hover {
    background: rgba(245, 130, 32, 0.22);
    transform: translateY(-1px);
}

.trust-link {
    background: rgba(59, 130, 246, 0.12);
    color: #60A5FA;
    border-color: rgba(59, 130, 246, 0.3);
}

.trust-link:hover {
    background: rgba(59, 130, 246, 0.22);
    transform: translateY(-1px);
}

/* Card Styles */
.card, .status-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease;
}

.card h2, .status-card h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Status Card */
.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.online {
    background: var(--success-color);
}

.wallet-address {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.wallet-address .address {
    flex: 1;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    font-size: 14px;
}

.network-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Balance Grid */
.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.balance-item {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.balance-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.balance-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--success-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.allowance-info, .transfer-info {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

.info-text {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Checkbox Styles */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.checkbox-container:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-label {
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
}

.form-input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Transactions List */
.transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.transaction-hash {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 8px;
    word-break: break-all;
}

.transaction-details {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

/* Instructions List */
.instructions-list {
    padding-left: 20px;
    margin-bottom: 20px;
}

.instructions-list li {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.instructions-list strong {
    color: var(--text-primary);
    font-size: 18px;
    display: block;
    margin-bottom: 5px;
}

.instructions-list p {
    margin-top: 5px;
}

/* Alert Styles */
.alert {
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning-color);
    color: var(--warning-color);
}

/* Loading Overlay — translucent, not opaque (prevents black screen) */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loadingText {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text-secondary);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-secondary);
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.toast.error {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    margin-bottom: 25px;
    color: var(--text-primary);
}

.status-box {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 15px 20px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .card, .status-card {
        padding: 20px;
    }

    .balance-grid {
        grid-template-columns: 1fr;
    }

    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
    }
}

/* ── Wallet Modal ─────────────────────────────────────────────────────── */
.wallet-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wallet-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.wallet-modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.25s ease;
}

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

.wallet-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.wallet-modal-header h2 {
    font-size: 20px;
    margin: 0;
}

.wallet-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.wallet-modal-close:hover {
    color: var(--text-primary);
}

.wallet-modal-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.wm-section {
    margin-bottom: 16px;
}

.wm-section-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    font-weight: 600;
}

.wm-wallet-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.wm-wallet-btn:last-child {
    margin-bottom: 0;
}

.wm-wallet-btn:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.wm-wallet-btn.wm-detected {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.08);
}

.wm-wallet-btn.wm-trust:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.4);
}

.wm-wallet-btn.wm-metamask:hover {
    background: rgba(245, 130, 32, 0.12);
    border-color: rgba(245, 130, 32, 0.4);
}

.wm-wallet-icon {
    font-size: 28px;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.wm-wallet-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.wm-wallet-name {
    font-weight: 600;
    font-size: 15px;
}

.wm-wallet-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.wm-wallet-tag {
    font-size: 11px;
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.15);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    margin-top: 2px;
    display: inline-block;
    width: fit-content;
}

.wm-arrow {
    font-size: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.wm-copy-row {
    display: flex;
    gap: 10px;
}

.wm-copy-input {
    flex: 1;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 13px;
    min-width: 0;
}

.wm-copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.wm-copy-btn:hover {
    background: var(--primary-dark);
}

@media (max-width: 768px) {
    .wallet-modal-content {
        width: 95%;
        padding: 24px;
        max-height: 90vh;
    }
}