/* ===== Design System (shared) ===== */
:root {
    --bg: #faf8f5;
    --bg-warm: #f5f0eb;
    --surface: #ffffff;
    --surface-muted: #f0ece7;
    --text: #2c2433;
    --text-secondary: #6b5f78;
    --text-muted: #9a8ea6;
    --primary: #8b6aae;
    --primary-light: #b9a2d4;
    --primary-dark: #6b4d8e;
    --primary-bg: rgba(139, 106, 174, 0.06);
    --accent: #c4956a;
    --outline: rgba(139, 106, 174, 0.12);
    --shadow-sm: 0 1px 3px rgba(44, 36, 51, 0.04);
    --shadow-md: 0 4px 16px rgba(44, 36, 51, 0.07);
    --shadow-lg: 0 8px 32px rgba(44, 36, 51, 0.10);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 150ms;
    --dur: 300ms;
    --dur-slow: 500ms;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    --bg: #1a1520;
    --bg-warm: #211b28;
    --surface: #2a2232;
    --surface-muted: #332a3d;
    --text: #e8e2ee;
    --text-secondary: #b0a4bc;
    --text-muted: #7a6e88;
    --primary: #b9a2d4;
    --primary-light: #d1c0e8;
    --primary-dark: #c4aede;
    --primary-bg: rgba(185, 162, 212, 0.10);
    --accent: #d4ad7a;
    --outline: rgba(185, 162, 212, 0.15);
    --shadow-sm: 0 1px 3px 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);
}

[data-theme="dark"] .header {
    background: rgba(26, 21, 32, 0.85);
}

[data-theme="dark"] .menu-panel {
    background: rgba(42, 34, 50, 0.96);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== Header ===== */
header {
    position: sticky;
    top: 0;
    z-index: 100;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 32px;
    background: rgba(250, 248, 245, 0.85);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border-bottom: 1px solid var(--outline);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
}

.brand {
    font-size: 1.15em;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-right .links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right .links a,
.theme-toggle,
.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 6px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease);
    text-decoration: none;
    line-height: 0;
}

.header-right .links a:hover,
.theme-toggle:hover,
.menu-toggle:hover {
    background-color: var(--primary-bg);
}

.header-icon,
.theme-icon,
.menu-icon {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
    transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.header-right .links a:hover .header-icon,
.theme-toggle:hover .theme-icon,
.menu-toggle:hover .menu-icon {
    color: var(--primary);
    transform: scale(1.1);
}

/* ===== Menu ===== */
.menu-icon-line {
    transition: all var(--dur) var(--ease);
    transform-origin: center;
}

.menu-toggle.active .menu-icon-line-1 {
    transform: translateY(6px) rotate(45deg);
    transform-origin: 12px 6px;
}

.menu-toggle.active .menu-icon-line-2 {
    opacity: 0;
    transform: scaleX(0);
}

.menu-toggle.active .menu-icon-line-3 {
    transform: translateY(-6px) rotate(-45deg);
    transform-origin: 12px 18px;
}

.menu-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 36, 51, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), visibility var(--dur);
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 260px;
    height: 100%;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: -8px 0 32px rgba(44, 36, 51, 0.08);
    border-left: 1px solid var(--outline);
    padding: 12px 0;
    transform: translateX(100%);
    transition: transform var(--dur) var(--ease);
    display: flex;
    flex-direction: column;
    z-index: 101;
}

.menu-overlay.active .menu-panel {
    transform: translateX(0);
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 14px 28px;
    color: var(--text);
    font-size: 0.95em;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
    border-left: 3px solid transparent;
}

.menu-link:hover {
    background: var(--primary-bg);
    color: var(--primary-dark);
    border-left-color: var(--primary);
}

/* ===== Content ===== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 24px;
}

h1 {
    font-size: 1.8em;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95em;
    margin-bottom: 36px;
}

/* ===== Donate Grid ===== */
.donate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.donate-card {
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.donate-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.donate-header {
    margin-bottom: 20px;
}

.donate-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    color: var(--primary);
}

.donate-card h2 {
    font-size: 1.25em;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.qr-placeholder {
    width: 180px;
    height: 180px;
    background: var(--bg-warm);
    border-radius: var(--radius-md);
    margin: 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9em;
    border: 2px dashed var(--outline);
}

.qr-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.donate-desc {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 12px 0 0;
    line-height: 1.6;
}

/* ===== Crypto Address List ===== */
.crypto-list {
    width: 100%;
    margin-top: 16px;
    text-align: left;
}

.crypto-item {
    margin-bottom: 12px;
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--dur-fast) var(--ease);
    background: var(--bg);
}

.crypto-item:hover {
    border-color: var(--primary-light);
}

.crypto-header {
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: var(--bg);
}

.crypto-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.crypto-label {
    font-size: 0.9em;
    color: var(--text);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crypto-toggle-icon {
    color: var(--text-muted);
    transition: transform var(--dur) var(--ease);
}

.crypto-item.active .crypto-toggle-icon {
    transform: rotate(180deg);
}

.crypto-address-preview {
    font-family: monospace;
    font-size: 0.8em;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crypto-qr-container {
    height: 0;
    overflow: hidden;
    transition: height var(--dur) var(--ease);
    background: var(--surface-muted);
    border-top: 1px solid transparent;
}

.crypto-item.active .crypto-qr-container {
    height: auto;
    border-top-color: var(--outline);
}

.crypto-qr-wrapper {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.crypto-qr-img {
    width: 140px;
    height: 140px;
    background: white;
    padding: 8px;
    border-radius: 8px;
    object-fit: contain;
}

.crypto-full-address {
    font-family: monospace;
    font-size: 0.85em;
    color: var(--text-secondary);
    word-break: break-all;
    text-align: center;
    background: var(--bg);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--outline);
    width: 100%;
}

.crypto-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.action-btn {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--outline);
    background: var(--surface);
    color: var(--text);
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}


/* ===== Footer ===== */
footer {
    padding: 40px 24px 48px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.8;
    border-top: 1px solid var(--outline);
    margin-top: 40px;
}

footer p {
    margin: 4px 0;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease);
}

footer a:hover {
    color: var(--primary);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .header {
        padding: 0 20px;
        height: 56px;
    }

    .menu-overlay {
        top: 56px;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 0 16px;
        height: 52px;
    }

    .brand {
        font-size: 1.05em;
    }

    .menu-overlay {
        top: 52px;
    }

    .menu-panel {
        width: 240px;
    }

    .container {
        padding: 32px 16px;
    }

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

/* Page animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-enter {
    opacity: 0;
    animation: fadeInUp 0.5s var(--ease) forwards;
}

.page-enter-delay-1 {
    animation-delay: 0.08s;
}

.page-enter-delay-2 {
    animation-delay: 0.16s;
}

.page-enter-delay-3 {
    animation-delay: 0.24s;
}

/* ===== Custom Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 99px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    border: 1px solid var(--outline);
    font-weight: 500;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    color: #10b981;
    /* Success green */
    display: flex;
}

/* Generated QR Container */
.qr-gen-container {
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    display: inline-block;
    cursor: zoom-in;
    transition: transform 0.2s;
}

.qr-gen-container:hover {
    transform: scale(1.05);
}

.qr-gen-container img {
    display: block;
    /* Remove bottom space */
}

/* Ensure no conflict with previous styles */
.crypto-qr-img {
    /* This might still apply if JS adds it, but container handles layout */
}

/* ===== Lightbox ===== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}

.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    transform: scale(0.9);
    transition: transform 0.3s var(--ease);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.lightbox-overlay.active .lightbox-img {
    transform: scale(1);
}

.crypto-qr-img {
    cursor: zoom-in;
    transition: transform 0.2s;
}

.crypto-qr-img:hover {
    transform: scale(1.05);
}