/* ==========================================
   DIGIMARKET - MODERN DARK THEME CSS
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Theme Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --bg-card: #1c2128;
    
    /* Text Colors */
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #656d76;
    
    /* Accent Colors */
    --accent-primary: #2ea043;
    --accent-secondary: #1f6feb;
    --accent-warning: #d29922;
    --accent-danger: #f85149;
    
    /* Border Colors */
    --border-primary: #30363d;
    --border-secondary: #21262d;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2ea043, #1f6feb);
    --gradient-card: linear-gradient(145deg, #1c2128, #161b22);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================
   HEADER STYLES
   ========================================== */

.main-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 2rem;
}

.logo h1 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
}

.logo a {
    text-decoration: none;
}

.search-bar {
    flex: 1;
    max-width: 500px;
}

.search-form {
    position: relative;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 12px 50px 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: color 0.3s ease;
}

.search-btn:hover {
    color: var(--accent-secondary);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-switcher {
    position: relative;
}

.lang-btn-wrapper {
    position: relative;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.lang-btn-wrapper:hover .lang-current {
    background: var(--bg-hover);
    border-color: var(--accent-secondary);
}

.lang-dropdown-hover {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.lang-btn-wrapper:hover .lang-dropdown-hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Старые стили для обратной совместимости */
.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-secondary);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.lang-option:hover {
    background: var(--bg-hover);
}

.lang-option.active {
    background: var(--accent-secondary);
    color: white;
}

.main-nav {
    border-top: 1px solid var(--border-primary);
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
    padding: 1rem 0;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* ==========================================
   MAIN CONTENT STYLES
   ========================================== */

.main-content {
    flex: 1;
    padding: 2rem 0;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.section {
    margin-bottom: 3rem;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    font-size: 14px;
}

.breadcrumb a {
    color: var(--accent-secondary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ==========================================
   CARD STYLES
   ========================================== */

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.card {
    background: var(--gradient-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-secondary);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.card-title a:hover {
    color: var(--accent-secondary);
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-secondary);
}

.card-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.card-sales {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.product-card {
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.5s ease;
}

.product-card:hover::before {
    left: 100%;
}

/* ==========================================
   CATEGORY STYLES
   ========================================== */

.category-card {
    text-align: center;
    padding: 2rem 1.5rem;
}

.category-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.category-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.subcategories {
    margin-top: 1rem;
}

.subcategory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.subcategory-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.subcategory-tag:hover {
    background: var(--accent-secondary);
    color: white;
}

/* ==========================================
   PRODUCT PAGE STYLES
   ========================================== */

.product-header {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    margin-bottom: 3rem;
}

.product-info h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.product-meta {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-secondary);
}

.meta-item:last-child {
    border-bottom: none;
}

.meta-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.meta-value {
    color: var(--text-primary);
    font-weight: 600;
}

.price-large {
    font-size: 1.5rem;
    color: var(--accent-primary);
}

/* ==========================================
   STATS STYLES
   ========================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ==========================================
   FOOTER STYLES
   ========================================== */

.main-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    margin-top: auto;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-section h3 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-secondary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-primary);
    color: var(--text-muted);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header-top {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-bar {
        order: 1;
        width: 100%;
        max-width: none;
    }
    
    .logo {
        order: 0;
    }
    
    .header-controls {
        order: 2;
    }
    
    .nav-list {
        gap: 1rem;
        overflow-x: auto;
        padding-bottom: 1rem;
    }
    
    .product-header {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .page-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-success { color: var(--accent-primary); }
.text-warning { color: var(--accent-warning); }
.text-danger { color: var(--accent-danger); }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.loading {
    position: relative;
    color: transparent !important;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--accent-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}