:root {
    --primary: #3b82f6;
    --secondary: #1e40af;
    --accent: #10b981;
    --bg-dark: #050816;
    --bg-panel: #0a1124;
    --bg-card: #111b34;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --radius: 18px;
    font-family: 'Inter', system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(30, 64, 175, 0.25), var(--bg-dark));
    color: var(--text);
}

/* Стилизация выпадающих списков */
select {
    color: white !important;
}

select option {
    background-color: white !important;
    color: black !important;
}

select option:checked,
select option:hover {
    background-color: #e0e0e0 !important;
    color: black !important;
}

.hidden {
    display: none !important;
}

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

.bg-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.icon-btn {
    border: none;
    border-radius: 12px;
    padding: 10px;
    background: var(--bg-card);
    color: var(--muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--text);
}

.chip {
    border-radius: 999px;
    border: 1px solid var(--border);
    padding: 6px 12px;
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
}

.chip-active {
    background: var(--primary);
    color: white;
}

.app-wrapper {
    width: min(1400px, 95%);
    margin: 0 auto;
    padding: 32px 0 60px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    gap: 24px;
}

.logo-cluster h1 {
    margin: 6px 0;
    font-size: clamp(24px, 4vw, 36px);
}

.logo-cluster p {
    margin: 0;
    color: var(--muted);
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    letter-spacing: 0.2em;
    font-size: 0.7rem;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    text-transform: uppercase;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.role-pill {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.app-main {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.auth-screen {
    min-height: 100vh;
    padding: 60px clamp(20px, 5vw, 120px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-grid {
    width: min(1200px, 100%);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
}

.auth-hero {
    padding: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgba(30, 64, 175, 0.15), rgba(15, 23, 42, 0.9));
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.4);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: var(--primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-highlights {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hero-highlights li {
    display: flex;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--muted);
}

.hero-highlights span {
    color: var(--text);
    font-weight: 600;
}

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

.hero-stat {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.7);
}

.stat-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.stat-value {
    margin: 6px 0 2px;
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-meta {
    font-size: 0.8rem;
    color: rgba(226, 232, 240, 0.65);
}

.hero-assurance {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.auth-panel {
    padding: 32px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(5, 8, 22, 0.9);
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.logo-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.logo-meta {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.panel-header h2 {
    margin: 12px 0 6px;
    font-size: 1.75rem;
}

.panel-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    color: var(--primary);
}

.form-caption {
    font-size: 0.85rem;
    color: var(--muted);
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 12px;
}

.form-caption code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--text);
    background: rgba(15, 23, 42, 0.8);
    padding: 2px 6px;
    border-radius: 6px;
}

.input-field span {
    font-size: 0.9rem;
    color: var(--muted);
}

.input-wrapper {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 12px;
    padding: 0 14px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.7);
}

.input-wrapper i {
    color: var(--muted);
}

.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    padding: 12px 0;
    font-size: 1rem;
}

.input-wrapper input:focus {
    outline: none;
}

.contact-card {
    margin-top: 4px;
    padding: 16px;
    border-radius: 14px;
    border: 1px dashed rgba(59, 130, 246, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(15, 23, 42, 0.6);
}

.contact-title {
    margin: 0;
    font-weight: 600;
}

.contact-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.tabs {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
}

.tab.active {
    background: var(--primary);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
}

input,
select,
textarea {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text);
}

textarea {
    resize: vertical;
}

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

.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.btn.primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(59, 130, 246, 0.3);
}

.btn.primary:active {
    transform: translateY(0);
}

.btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn.danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 8px 12px rgba(239, 68, 68, 0.3);
}

.btn.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.ghost:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.dashboard {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    min-height: 600px;
}

.sidebar {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.profile-card h2 {
    margin: 4px 0;
}

.rank {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--muted);
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.nav-item.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.12);
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.hero-card {
    background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.2)), var(--bg-panel);
    border-radius: var(--radius);
    padding: 28px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-size: 0.7rem;
    color: var(--muted);
}

.balance-group {
    display: flex;
    gap: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.grid.two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.product-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 18px;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.8), rgba(15, 23, 42, 0.9));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-card footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.sidebar-mobile {
    position: relative;
    height: 100%;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

body.menu-open {
    overflow: hidden;
}

.mobile-menu-btn {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.35);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1002;
}

.table-container {
    overflow-x: auto;
}

.table-responsive {
    min-width: 600px;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.timeline-item {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(15, 23, 42, 0.8);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th,
td {
    text-align: left;
    padding: 10px 6px;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.badge.success {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.badge.warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.badge.danger {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.activity-feed {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-feed li {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(15, 23, 42, 0.7);
}

.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 25px 65px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-8px);
}

.toast.error {
    border-color: rgba(248, 113, 113, 0.4);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* Стили для боковой панели и навигации */
.sidebar-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    color: var(--muted);
}

.sidebar-item:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--text);
    transform: translateX(4px);
}

.sidebar-item.active {
    background: rgba(59, 130, 246, 0.25);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Стили для мобильной панели */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-mobile.active {
    transform: translateX(0) !important;
}

/* Стили для других элементов */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

@media (max-width: 960px) {
    .mobile-only {
        display: flex;
    }

    .desktop-only {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .sidebar-mobile {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar-mobile.active {
        transform: translateX(0);
    }

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

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .hero-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .balance-group {
        width: 100%;
        justify-content: space-between;
    }

    .table-responsive {
        min-width: 480px;
    }

    .auth-screen {
        padding: 32px 16px;
    }

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

/* ============ СТИЛИ ДЛЯ ЧАТОВ ============ */
#admin-chats-section {
    display: grid !important;
    height: 600px;
}

#chats-list {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

#chats-list .active {
    background: var(--primary);
    color: white;
}

#chat-messages {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
}

#chat-messages > div {
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#chat-data-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 1rem;
}

#user-purchases,
#user-transactions {
    max-height: 150px;
    overflow-y: auto;
}

#chat-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    transition: border-color 0.2s ease;
}

#chat-input:focus {
    border-color: var(--primary);
    outline: none;
}

.btn-sm {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Product Gallery Styles */
.product-gallery {
    width: 100%;
}

.product-gallery__main {
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
}

.product-gallery__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.product-gallery__thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.product-gallery__thumbs::-webkit-scrollbar {
    height: 6px;
}

.product-gallery__thumbs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.product-thumb {
    width: 80px;
    height: 80px;
    min-width: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.product-thumb:hover {
    opacity: 1;
    border-color: rgba(59, 130, 246, 0.5);
    transform: scale(1.05);
}

.product-thumb--active {
    opacity: 1;
    border-color: rgb(59, 130, 246);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

@media (max-width: 768px) {
    .product-gallery {
        width: 100%;
        margin: 0 -1.5rem;
        padding: 0 1.5rem;
    }
    
    .product-thumb {
        width: 56px;
        height: 56px;
        min-width: 56px;
    }
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Image Zoom Overlay */
.image-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.image-zoom-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-zoom-img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.image-zoom-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.image-zoom-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* КРИТИЧНО: Фикс цвета текста в select элементах */
select.bg-gray-800 {
    background-color: rgb(31 41 55) !important;
    color: white !important;
}

select.bg-gray-800 option {
    background-color: white !important;
    color: black !important;
}

@media (max-width: 768px) {
    .image-zoom-close {
        top: 10px;
        right: 10px;
    }
}

