/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #f59e0b;
    --primary-dark: #d97706;
    --secondary: #10b981;
    --info: #3b82f6;
    --danger: #ef4444;
    --bg: #0f172a;
    --card-bg: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.logo h1 {
    font-size: 24px;
    background: linear-gradient(135deg, var(--primary), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.btn-action {
    background: linear-gradient(135deg, var(--secondary), #059669);
    color: white;
    padding: 14px 24px;
}

.btn-action:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-swap {
    width: 100%;
    padding: 18px;
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    margin-top: 20px;
}

.btn-swap:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

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

/* Main App */
.main-app {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Card */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Not Connected */
.not-connected {
    text-align: center;
    padding: 80px 20px;
}

.connect-prompt h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

.connect-prompt p {
    color: var(--text-muted);
}

/* Account Info */
.account-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 8px;
}

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

.account-value {
    font-weight: 600;
    font-family: monospace;
}

.balances-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.balance-item {
    background: var(--bg);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

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

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

/* Stake Info */
.no-stake {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.stake-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stake-stats {
    display: grid;
    gap: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 8px;
}

.stat-row span {
    color: var(--text-muted);
}

.stat-row strong {
    font-weight: 600;
}

.reward-green {
    color: var(--secondary);
}

.reward-blue {
    color: var(--info);
}

.stake-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Tier Selector */
.tier-selector h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.tier-item {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.tier-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.tier-item.selected {
    border-color: var(--primary);
    background: rgba(245, 158, 11, 0.1);
}

.tier-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.tier-amounts {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tier-usdt {
    color: var(--primary);
    font-weight: 700;
}

.tier-arrow {
    color: var(--text-muted);
}

.tier-bolt {
    color: var(--secondary);
    font-weight: 700;
}

.tier-reward {
    font-size: 14px;
    color: var(--secondary);
    font-weight: 600;
}

/* Selected Tier Info */
.selected-tier {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
}

.selected-tier h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.tier-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 8px;
}

.detail-row span {
    color: var(--text-muted);
}

.detail-row strong {
    font-weight: 600;
}

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

.detail-row.warning strong {
    color: var(--primary);
}

/* Info Text */
.info-text {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.text-muted {
    color: var(--text-muted);
}

/* Rules */
.rules-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rule-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary);
}

.rule-section ul {
    list-style: none;
    padding-left: 0;
}

.rule-section li {
    padding: 8px 0;
    color: var(--text-muted);
    font-size: 14px;
    padding-left: 20px;
    position: relative;
}

.rule-section li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
}

.rule-section.example {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
}

.example-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.example-content p {
    color: var(--text-muted);
    font-size: 14px;
}

.reward-highlight {
    font-size: 16px;
    color: var(--secondary);
    font-weight: 700;
    margin-top: 8px;
}

/* Contract Info */
.contract-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: 8px}

.info-item span {
    color: var(--text-muted);
}

.info-item a {
    color: var(--primary);
    text-decoration: none;
    font-family: monospace;
    font-size: 13px;
}

.info-item a:hover {
    text-decoration: underline;
}

.error {
    color: var(--danger);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

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

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

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

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 24px;
    max-width: 400px;
    z-index: 1001;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

#toastMessage {
    color: var(--text);
}

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

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

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

    .stake-actions {
        grid-template-columns: 1fr;
    }

    .tier-amounts {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
}
