/* ═══════════════════════════════════════════════
   CubeWill Donate — Main Stylesheet
   ═══════════════════════════════════════════════ */

:root {
    --bg:            #0f0f0f;
    --surface:       #1a1a1a;
    --surface-light: #252525;
    --accent:        #7c3aed;
    --accent-hover:  #6d28d9;
    --text:          #e5e5e5;
    --text-muted:    #888888;
    --success:       #22c55e;
    --error:         #ef4444;
    --border:        #333333;
}

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

html { font-size: 16px; }

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

img { max-width: 100%; display: block; }

/* ── Header ────────────────────────────────────── */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-left { flex-shrink: 0; }
.header-left .logo { height: 40px; width: auto; }

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
}

.header-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.header-nav a:hover { color: var(--accent); }

.header-online {
    background: var(--surface-light);
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    flex-shrink: 0;
}

.online-wrap { display: flex; flex-direction: column; gap: 0.2rem; }

#online-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.online-progress {
    width: 130px;
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
}
.online-progress::-webkit-progress-bar { background: var(--border); border-radius: 3px; }
.online-progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
.online-progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }

.header-right { flex-shrink: 0; }
.server-ip {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Burger button (mobile only) */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
}
.burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s;
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Онлайн-блок в мобильном хедере (по центру между лого и бургером) */
.header-online-mobile {
    display: none;       /* скрыт на десктопе */
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    flex: 1;             /* занимает всё пространство между лого и бургером */
    text-align: center;
}
.header-online-mobile span {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.header-online-mobile .online-progress { width: 90px; }

/* Mobile nav drawer */
.mobile-nav {
    display: none;
    flex-direction: column;
    background: var(--surface-light);
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 0.25rem;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    transition: color 0.2s;
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { color: var(--accent); }

/* ── Main ──────────────────────────────────────── */
.main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* ── Catalog ───────────────────────────────────── */
.catalog-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 700;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.product-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
    animation: fadeInUp 0.35s ease both;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    border-color: var(--accent);
}

.product-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 8px;
}
.product-icon-placeholder {
    width: 80px;
    height: 80px;
    background: var(--surface-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
.product-name { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.4rem; }
.product-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    flex: 1;
}
.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 1rem;
}
.empty-catalog {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
    background: var(--surface);
    border-radius: 12px;
}

/* ── Buttons ───────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.55rem 1.4rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s, background-color 0.2s, opacity 0.2s;
}
.btn:hover  { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.35); }
.btn:active { transform: none; box-shadow: none; }

.btn-primary   { background: var(--accent);        color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success   { background: var(--success);       color: #fff; }
.btn-success:hover { opacity: 0.88; }
.btn-secondary { background: var(--surface-light); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-full { width: 100%; padding: 0.85rem; font-size: 1.05rem; }

/* ── Buy page ──────────────────────────────────── */
.buy-container { max-width: 560px; margin: 0 auto; }

.buy-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 2rem;
    border: 1px solid var(--border);
}
.buy-card h1 { font-size: 1.5rem; margin-bottom: 1.5rem; text-align: center; }

.product-info {
    text-align: center;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.product-info-icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin: 0 auto 0.75rem;
    border-radius: 8px;
}
.product-info h2 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.product-info .price { font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.product-info .description { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.4rem; }

.buy-form { display: flex; flex-direction: column; gap: 1.25rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group textarea {
    background: var(--surface-light);
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    width: 100%;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.error-message { color: var(--error); font-size: 0.85rem; }

.back-link { display: inline-block; margin-top: 1.25rem; color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.back-link:hover { color: var(--accent); }

/* ── Alerts / banners ─────────────────────────── */
.alert { border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: rgba(239,68,68,0.12); border: 1px solid var(--error); color: var(--error); }

.test-mode-banner {
    background: rgba(245,158,11,0.12);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: #f59e0b;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* ── Payment result ───────────────────────────── */
.result-icon { font-size: 2.75rem; text-align: center; margin-bottom: 0.5rem; }
.result-subtitle { color: var(--text-muted); text-align: center; margin-bottom: 1.25rem; font-size: 0.95rem; }
.test-badge { color: #f59e0b; font-size: 0.85rem; margin-top: 0.4rem; }

.result-details {
    background: var(--surface-light);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.result-details p { color: var(--text-muted); font-size: 0.9rem; }
.error-details { border: 1px solid var(--error); }
.error-text { color: var(--error); }

.note { color: var(--text-muted); font-size: 0.875rem; margin-top: 1rem; text-align: center; }

/* ── Support / Tops pages ─────────────────────── */
.support-container, .tops-container { max-width: 760px; margin: 0 auto; }
.support-card, .info-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 2rem;
    border: 1px solid var(--border);
}
.support-card h1, .info-card h1 { font-size: 1.5rem; margin-bottom: 1.25rem; }

.contact-links { display: flex; flex-direction: column; gap: 0.75rem; margin: 1.25rem 0; }
.contact-btn {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--surface-light);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: all 0.25s;
}
.contact-btn:hover { transform: translateX(6px); }
.contact-btn.telegram:hover { background: #0088cc; color: #fff; }
.contact-btn.vk:hover       { background: #4680c2; color: #fff; }

.instruction { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.instruction ol { margin: 0.75rem 0 0 1.5rem; }
.instruction li { margin: 0.4rem 0; color: var(--text-muted); font-size: 0.9rem; }
.coming-soon { font-size: 1.4rem; text-align: center; margin-bottom: 1rem; }

/* ── Requisites page ──────────────────────────── */
.requisites-block { margin-top: 1.25rem; }
.requisites-table { width: 100%; border-collapse: collapse; }
.requisites-table tr { border-bottom: 1px solid var(--border); }
.requisites-table tr:last-child { border-bottom: none; }
.requisites-table td { padding: 0.7rem 0.5rem; vertical-align: top; line-height: 1.5; font-size: 0.9rem; }
.req-label { color: var(--text-muted); font-size: 0.85rem; width: 45%; }
.requisites-table a { color: var(--accent); text-decoration: none; }
.requisites-table a:hover { text-decoration: underline; }

.terms-block { margin-top: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.terms-block:last-child { border-bottom: none; padding-bottom: 0; }
.terms-block h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }
.terms-block p { color: var(--text-muted); font-size: 0.875rem; line-height: 1.7; }
.terms-block a { color: var(--accent); text-decoration: none; }
.terms-block a:hover { text-decoration: underline; }

/* ── Footer ────────────────────────────────────── */
.footer {
    background-color: var(--surface);
    position: relative;
    overflow: hidden;
    padding: 2.5rem 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}
.footer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/static/img/icon.png') center / cover no-repeat;
    opacity: 0.07;
    z-index: 0;
    pointer-events: none;
}
.footer-content { position: relative; z-index: 1; }
.footer-icon { height: 44px; width: auto; margin: 0 auto 0.75rem; opacity: 0.8; filter: brightness(0) invert(1); }
.footer p { color: var(--text-muted); font-size: 0.78rem; margin: 0.3rem 0; line-height: 1.5; }
.footer-links { margin-top: 0.75rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.8rem; margin: 0 0.5rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }

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

.product-grid .product-card:nth-child(1) { animation-delay: 0.04s; }
.product-grid .product-card:nth-child(2) { animation-delay: 0.08s; }
.product-grid .product-card:nth-child(3) { animation-delay: 0.12s; }
.product-grid .product-card:nth-child(4) { animation-delay: 0.16s; }
.product-grid .product-card:nth-child(5) { animation-delay: 0.20s; }
.product-grid .product-card:nth-child(6) { animation-delay: 0.24s; }

/* ── Requisites page ──────────────────────────── */
.requisites-block { margin-top: 1.25rem; }

/* ═══════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 900px)
   ═══════════════════════════════════════════════ */
@media (max-width: 900px) {
    .server-ip { font-size: 0.75rem; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 640px)
   ═══════════════════════════════════════════════ */
@media (max-width: 640px) {

    /* Header */
    .header-inner { padding: 0.6rem 1rem; }
    .header-nav   { display: none; }
    .header-right { display: none; }
    .header-online { display: none; }
    .burger        { display: flex; }
    .header-online-mobile { display: flex; }
    .header-left .logo { height: 32px; }
    /* На мобильном: лого | [онлайн по центру] | бургер */
    .header-inner { justify-content: space-between; }

    /* Mobile nav */
    .mobile-nav { display: none; }
    .mobile-nav.open { display: flex; }

    /* Main */
    .main { padding: 1rem; }

    /* Catalog */
    .catalog-title { font-size: 1.4rem; margin-bottom: 1.25rem; }
    .product-grid  { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .product-card  { padding: 1rem 0.75rem; }
    .product-icon, .product-icon-placeholder { width: 56px; height: 56px; font-size: 1.75rem; }
    .product-name  { font-size: 0.95rem; }
    .product-description { font-size: 0.8rem; }
    .product-price { font-size: 1.15rem; }
    .product-card .btn { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

    /* Buy page */
    .buy-card { padding: 1.25rem 1rem; border-radius: 10px; }
    .buy-card h1 { font-size: 1.2rem; }
    .product-info .price { font-size: 1.4rem; }

    /* Support / Tops */
    .support-card, .info-card { padding: 1.25rem 1rem; }
    .support-card h1 { font-size: 1.2rem; }
    .contact-btn { padding: 0.8rem 1rem; font-size: 0.9rem; }

    /* Footer */
    .footer { padding: 1.75rem 1rem; }
    .footer-links a { margin: 0 0.3rem; font-size: 0.75rem; }

    /* Requisites */
    .req-label { white-space: normal; width: 40%; }
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Very small (≤ 380px)
   ═══════════════════════════════════════════════ */
@media (max-width: 380px) {
    .product-grid { grid-template-columns: 1fr; }
    .catalog-title { font-size: 1.2rem; }
}
