:root {
    --bg-color: #05070a;
    --card-bg: rgba(17, 25, 40, 0.75);
    --card-border: rgba(255, 255, 255, 0.125);
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #22c55e;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.4), rgba(99, 102, 241, 0.2));
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 5px rgba(99, 102, 241, 0.2);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.6), rgba(99, 102, 241, 0.4));
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) rgba(255, 255, 255, 0.02);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.container {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    padding: 20px;
}

/* Sidebar Styling */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
    height: 100%;
    overflow-y: auto;
}

/* Tabs Styling */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
}

.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    color: var(--text-secondary);
}

.tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.sidebar h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.invoice-item {
    padding: 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.invoice-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.invoice-item.active {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.invoice-item .title {
    font-weight: 600;
    margin-bottom: 4px;
}

.invoice-item .date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Main Content Styling */
.main-content {
    display: flex;
    flex-direction: column;
    padding: 32px;
    overflow-y: auto;
}

.admin-table-container {
    max-height: 500px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-products-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-products-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-products-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    vertical-align: middle;
}

.admin-products-table .p-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
}

.admin-products-table .p-guid {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
    opacity: 0.5;
}

.admin-products-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 10px 15px -3px var(--accent-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.table-container {
    width: 100%;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 12px;
}

th {
    text-align: left;
    padding: 0 16px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

td {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
}

td:first-child {
    border-left: 1px solid var(--card-border);
    border-radius: 16px 0 0 16px;
}

td:last-child {
    border-right: 1px solid var(--card-border);
    border-radius: 0 16px 16px 0;
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 16px;
}

.product-img-mini {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.product-img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
}

.price-tag {
    font-weight: 700;
    color: #f59e0b; /* Amber/Gold for retail price */
    font-size: 0.95rem;
}

.price-wholesale {
    font-weight: 700;
    color: #10b981; /* Keep Emerald/Green for wholesale */
    font-size: 1rem;
}

.quantity {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 60px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        gap: 15px;
        padding: 10px;
    }

    /* Hide main content on mobile, show only as popup */
    .main-content {
        position: fixed;
        inset: 0;
        z-index: 500;
        border-radius: 0;
        display: none; /* Controlled by JS */
        height: 100vh;
        width: 100vw;
        padding: 20px 16px;
        background: var(--bg-color); /* Ensure opaque background on mobile popup */
    }

    .main-content.active-mobile {
        display: flex !important;
        animation: slideUp 0.3s ease-out;
    }

    .sidebar {
        height: calc(100vh - 20px);
        padding: 16px;
    }

    .header {
        margin-top: 50px; /* Space for close button */
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 24px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    /* Stack Table on Mobile */
    table, thead, tbody, th, td, tr { 
        display: block; 
    }

    thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        background: rgba(255, 255, 255, 0.03);
        margin-bottom: 16px !important;
        border: 1px solid var(--card-border);
        border-radius: 20px !important;
        padding: 12px;
    }

    td { 
        border: none !important;
        padding: 8px 4px !important;
        padding-left: 50% !important;
        background: transparent !important;
        position: relative;
        text-align: right !important;
    }

    td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 8px;
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--text-secondary);
        text-align: left;
        text-transform: uppercase;
    }

    td[data-label="Товар"] {
        padding-left: 4px !important;
        text-align: left !important;
    }

    td[data-label="Товар"]::before {
        display: none;
    }

    td:last-child {
        border-radius: 0 !important;
        text-align: center !important;
        padding-left: 4px !important;
    }

    td:last-child::before {
        display: none;
    }

    .product-cell {
        gap: 12px;
    }

    .product-img {
        width: 50px;
        height: 50px;
    }

    .price-tag, .price-wholesale {
        display: inline-block;
        margin-right: 12px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.close-mobile {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

/* Login Overlay */
#login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: white;
    outline: none;
    transition: var(--transition);
}

.admin-grid {
    display: grid;
    gap: 40px; /* Было 24, сделал 40 */
    margin-top: 32px;
}

.glass-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 32px; /* Увеличил внутренний отступ */
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.form-group {
    margin-bottom: 24px; /* Увеличил отступ между полями */
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.admin-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 18px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}
