/* ========================================
   VclouD 2.0 - Modern Dark Theme
   Proper contrast, clean design
   ======================================== */

:root {
    /* Primary colors - яскравий синій акцент */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #60a5fa;
    
    /* Background - темний але не чорний */
    --bg-body: #121212;
    --bg-header: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-card-hover: #262626;
    --bg-input: #252525;
    
    /* Text - максимальний контраст */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #888888;
    
    /* Accent colors */
    --price-color: #22c55e;
    --badge-olx: #ff6600;
    --badge-photos: #8b5cf6;
    
    /* Borders */
    --border-color: #333333;
    --border-light: #404040;
    
    /* Effects */
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-hover: 0 8px 24px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ========== HEADER ========== */
.header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
}

.header .container {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
}

.logo {
    text-decoration: none;
    color: var(--text-primary);
}

.logo-text {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search Box */
.search-box {
    flex: 1;
    max-width: 480px;
    min-width: 200px;
    display: flex;
    background: var(--bg-input);
    border-radius: var(--radius);
    border: 2px solid var(--border-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
}

/* Navigation */
.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 20px;
    background: var(--bg-input);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== MAIN CONTENT ========== */
.main {
    padding: 32px 0;
    min-height: calc(100vh - 200px);
}

/* Products Section */
.products-section {
    width: 100%;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.products-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.products-header h2 span {
    color: var(--text-muted);
    font-weight: 400;
}

.sort-select {
    padding: 10px 16px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.sort-select:focus {
    border-color: var(--primary);
}

/* ========== PRODUCTS GRID ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* ========== PRODUCT CARD ========== */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.product-card-image {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #0a0a0a;
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.product-card:hover .product-card-image img {
    transform: scale(1.05);
}

/* Badges */
.product-badge {
    position: absolute;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
}

.product-badge.olx {
    top: 10px;
    left: 10px;
    background: var(--badge-olx);
    color: white;
}

.product-badge.photos {
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
}

.product-badge.in-stock {
    bottom: 10px;
    left: 10px;
    background: rgba(34, 197, 94, 0.85);
    color: white;
    text-transform: none;
    font-size: 12px;
}

.product-badge.out-of-stock {
    bottom: 10px;
    left: 10px;
    background: rgba(239, 68, 68, 0.85);
    color: white;
    text-transform: none;
    font-size: 12px;
}

.out-of-stock-card {
    opacity: 0.6;
    pointer-events: auto;
}

/* Card Content */
.product-card-content {
    padding: 16px;
}

.product-card-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--price-color);
    margin-bottom: 8px;
}

.product-card-brand {
    font-size: 13px;
    color: var(--text-secondary);
}

/* No Products */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

/* ========== LOAD MORE ========== */
.load-more {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.btn-load-more {
    padding: 14px 40px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.btn-load-more:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

/* ========== FOOTER ========== */
.footer {
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    margin-top: auto;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

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

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

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

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .search-box {
        max-width: 100%;
        order: 3;
    }
    
    .nav {
        order: 2;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .logo {
        text-align: center;
        order: 1;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    
    .product-card-content {
        padding: 12px;
    }
    
    .product-card-title {
        font-size: 13px;
    }
    
    .product-card-price {
        font-size: 16px;
    }
}

/* ========== PRODUCT PAGE ========== */
.product-page {
    padding: 24px 0 60px;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 28px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { color: var(--text-muted); opacity: 0.5; }
.breadcrumbs #productName { color: var(--text-secondary); }

/* Two-column layout */
.product-content {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 48px;
    align-items: start;
    margin-bottom: 64px;
}
@media (max-width: 960px) {
    .product-content { grid-template-columns: 1fr; gap: 28px; }
}

/* ── Gallery ── */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 80px;
}
.main-image {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s;
}
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    z-index: 2;
}
.gallery-nav:hover { background: var(--primary); }
.gallery-nav.prev { left: 14px; }
.gallery-nav.next { right: 14px; }

.thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.thumbnail {
    flex-shrink: 0;
    width: 72px;
    height: 54px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.55;
    transition: opacity 0.2s, border-color 0.2s;
}
.thumbnail:hover { opacity: 0.85; }
.thumbnail.active { opacity: 1; border-color: var(--primary); }
.thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* ── Product Info ── */
.product-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.product-info h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 16px;
}
.product-price {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 6px;
    line-height: 1;
}
.product-price .price-value { color: var(--price-color); }
.product-price .price-negotiable {
    color: var(--text-secondary);
    font-size: 22px;
    font-weight: 600;
}

/* Stock */
#stockStatus {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Meta: brand + category */
.product-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 5px 12px;
}
.meta-item strong {
    color: var(--text-muted);
    font-weight: 500;
}

/* Description */
.product-description {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 20px;
}
.product-description h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.product-description p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.75;
    margin-bottom: 6px;
}
.product-description p:last-child { margin-bottom: 0; }

/* Action buttons */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    width: 100%;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}
.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}
.btn-telegram {
    background: #229ED9;
    color: #fff;
    border: none;
}
.btn-telegram:hover {
    background: #1a8bbf;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(34,158,217,0.35);
}

/* Share */
.product-share {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}
.product-share button {
    padding: 7px 14px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.product-share button:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ── Similar Products ── */
.similar-products {
    padding-top: 40px;
    border-top: 1px solid var(--border-color);
}
.similar-products h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}
.similar-products .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* ========== CART BADGE ========== */
.cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.cart-badge {
    position: absolute;
    top: -7px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* ========== FORMS ========== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    padding: 11px 14px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-error {
    font-size: 12px;
    color: #ef4444;
    min-height: 16px;
}

/* ========== AUTH TABS ========== */
.tab-btn {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.tab-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ========== PAYMENT OPTIONS ========== */
.pay-option {
    display: block;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--bg-card);
    margin-bottom: 12px;
    user-select: none;
}
.pay-option:hover { border-color: var(--border-light); }
.pay-option.active {
    border-color: var(--primary);
    background: rgba(59,130,246,0.06);
}
.pay-option input[type=radio] { display: none; }
.pay-option-content {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pay-option-content .pay-icon { font-size: 26px; }
.pay-option-content .pay-info .pay-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.pay-option-content .pay-info .pay-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}
.pay-badge {
    margin-left: auto;
    background: rgba(59,130,246,0.15);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 32px;
    max-width: 440px;
    width: 100%;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-input);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.crypto-addr-box {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    word-break: break-all;
    font-size: 13px;
    font-family: monospace;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ========== ORDER STATUS BADGES ========== */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-pending   { background: rgba(251,191,36,0.15);  color: #f59e0b; }
.status-paid      { background: rgba(34,197,94,0.15);   color: #16a34a; }
.status-shipped   { background: rgba(59,130,246,0.15);  color: #2563eb; }
.status-completed { background: rgba(139,92,246,0.15);  color: #7c3aed; }
.status-cancelled { background: rgba(239,68,68,0.15);   color: #dc2626; }

/* ========== ADD TO CART BUTTON ON CARDS ========== */
.card-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    margin-top: 10px;
}
.card-cart-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

