/* ============================================
   AKSESSUAR CRM - ASOSIY STILLAR
   Telegram uslubidagi yon menyu bilan
   ============================================ */

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

:root {
    /* Ranglar */
    --bg-dark: #0f0f0f;
    --bg-sidebar: #1a1a1a;
    --bg-card: #242424;
    --bg-input: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent: #6c5ce7;
    --accent-hover: #8075ff;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e74c3c;

    /* O'lchamlar */
    --sidebar-width: 220px;
    --sidebar-collapsed: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   YON MENYU (SIDEBAR)
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: width 0.3s ease;
}

/* Sidebar header - Logo */
.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #333;
}

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, #a29bfe 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Menyu */
.menu {
    list-style: none;
    padding: 10px 0;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(108, 92, 231, 0.1);
}

.menu-item.active {
    background: rgba(108, 92, 231, 0.15);
    border-left-color: var(--accent);
}

.menu-icon {
    font-size: 1.3rem;
    width: 28px;
    text-align: center;
}

.menu-text {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ============================================
   ASOSIY ISH MAYDONI
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 20px;
    overflow-y: auto;
}

/* Section */
.section {
    display: none;
}

.section.active {
    display: block;
}

.section-header {
    margin-bottom: 20px;
}

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

/* Coming soon */
.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    background: var(--bg-card);
    border-radius: 16px;
    color: var(--text-secondary);
}

.coming-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* ============================================
   SOTUV PANELI
   ============================================ */
.sale-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.panel-left,
.panel-right {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
}

/* Qidiruv */
.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    /* MUHIM: Zoomni oldini olish uchun */
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
}

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

/* Tavsiyalar */
.suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-input);
    border-radius: 12px;
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 50;
}

.suggestions.hidden {
    display: none;
}

.suggestion-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.2s ease;
}

.suggestion-item:hover {
    background: rgba(108, 92, 231, 0.2);
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Tanlangan mahsulot */
.selected-product {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--accent) 0%, #a29bfe 100%);
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

.selected-product.hidden {
    display: none;
}

.btn-clear {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s ease;
}

.btn-clear:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Option sections */
.option-section {
    margin-bottom: 16px;
}

.option-section.hidden {
    display: none;
}

.section-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option-btn {
    padding: 10px 16px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 16px;
    /* MUHIM: Zoomni oldini olish uchun */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
}

.option-btn:hover:not(.disabled) {
    border-color: var(--accent);
}

.option-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

.option-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.option-btn .stock {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.option-btn.active .stock {
    color: rgba(255, 255, 255, 0.8);
}

/* Stock card */
.stock-card {
    background: var(--bg-input);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.stock-card.hidden {
    display: none;
}

.stock-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

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

.stock-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

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

.price-row {
    display: flex;
    flex-wrap: wrap;
    /* Sig'masa pastga tushadi */
    gap: 15px;
}

.price-item {
    flex: 1;
    min-width: 100px;
}

.price-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.price-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.price-value.optom {
    color: var(--warning);
}

/* Sale controls */
.sale-controls {
    margin-bottom: 16px;
}

.sale-controls.hidden {
    display: none;
}

.control-group {
    margin-bottom: 16px;
}

.control-group.hidden {
    display: none;
}

.control-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toggle buttons */
.toggle-buttons {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 16px;
    /* MUHIM: Zoomni oldini olish uchun */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    border-color: var(--accent);
}

.toggle-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

/* Quantity control */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.qty-btn:hover {
    background: var(--accent-hover);
}

.quantity-control input {
    flex: 1;
    text-align: center;
    padding: 12px;
    font-size: 16px;
    /* MUHIM: Zoomni oldini olish uchun */
    font-weight: 700;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-primary);
}

.quantity-control input:focus {
    outline: none;
    border-color: var(--accent);
}

.error-text {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.15);
    border-radius: 8px;
}

.error-text.hidden {
    display: none;
}

/* Customer section */
#customerSection select {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 16px;
    /* MUHIM: Zoomni oldini olish uchun */
    margin-bottom: 8px;
    appearance: none;
    cursor: pointer;
}

#customerSection select:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-add-customer {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 2px dashed var(--text-secondary);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-customer:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* New customer form */
.new-customer {
    background: var(--bg-input);
    padding: 12px;
    border-radius: 10px;
    margin-top: 8px;
}

.new-customer.hidden {
    display: none;
}

.new-customer input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid #444;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    /* MUHIM: Zoomni oldini olish uchun */
    margin-bottom: 8px;
}

.new-customer input:focus {
    outline: none;
    border-color: var(--accent);
}

.new-customer-buttons {
    display: flex;
    gap: 8px;
}

.btn-save,
.btn-cancel {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.btn-save {
    background: var(--success);
    color: white;
}

.btn-cancel {
    background: var(--bg-card);
    color: var(--text-secondary);
}

/* Total card */
.total-card {
    background: linear-gradient(135deg, var(--success) 0%, #00cec9 100%);
    border-radius: 14px;
    padding: 15px;
    text-align: center;
    margin-bottom: 16px;
}

.total-card.hidden {
    display: none;
}

.total-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 4px;
}

.total-amount {
    font-size: 1.8rem;
    font-weight: 700;
    word-break: break-word;
    /* Sig'masa so'zni sindiradi */
}

/* SOTISH tugmasi */
.btn-sell {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--success) 0%, #00cec9 100%);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-sell:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 184, 148, 0.5);
}

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

.btn-sell.hidden {
    display: none;
}

.btn-sell:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   BUGUNGI SOTUVLAR
   ============================================ */
.today-sales {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
}

.sales-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-input);
    font-weight: 600;
}

.sales-count {
    background: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.sales-list {
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.empty-sales {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
}

.sale-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--bg-input);
    border-radius: 12px;
    margin-bottom: 10px;
    border-left: 4px solid var(--success);
}

.sale-item:last-child {
    margin-bottom: 0;
}

.sale-item.nasiya {
    border-left-color: var(--warning);
}

.sale-info {
    flex: 1;
}

.sale-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.sale-details {
    font-weight: 500;
}

.sale-customer {
    font-size: 0.85rem;
    color: var(--warning);
    margin-top: 4px;
}

.sale-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--success);
}

.sale-item.nasiya .sale-amount {
    color: var(--warning);
}

/* ============================================
   XABAR PANELI
   ============================================ */
.message {
    padding: 14px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.3s ease;
}

.message.success {
    background: linear-gradient(135deg, var(--success) 0%, #00cec9 100%);
}

.message.error {
    background: linear-gradient(135deg, var(--danger) 0%, #c0392b 100%);
}

.message.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MOBIL MENYU TUGMASI VA OVERLAY
   ============================================ */
.menu-toggle,
.sidebar-overlay {
    display: none;
}

/* ============================================
   MOBIL MOSLASHUV (768px va undan kichik)
   ============================================ */
@media (max-width: 900px) {
    .sale-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    /* Overflow oldini olish */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .app-container {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Menyu tugmasi */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 12px;
        z-index: 1100;
        background: var(--accent);
        border: none;
        color: white;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 1.4rem;
        cursor: pointer;
        box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    }

    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 995;
        backdrop-filter: blur(3px);
    }

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

    /* Sidebar yashirish */
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        min-width: 260px;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .logo-text,
    .menu-text {
        display: block;
    }

    /* Main content to'liq kenglik */
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        padding: 70px 12px 30px 12px;
        overflow-x: hidden;
    }

    /* Panel va kartalar to'g'ri joylashishi */
    .sale-panel,
    .panel-left,
    .panel-right,
    .stock-card,
    .total-card,
    .today-sales {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .panel-left,
    .panel-right {
        padding: 16px;
    }

    /* Jami summa kichikroq */
    .total-amount {
        font-size: 1.5rem;
    }

    .stock-value {
        font-size: 1.3rem;
    }

    .price-value {
        font-size: 1rem;
    }

    /* Sotuvlar ro'yxati */
    .sale-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sale-amount {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 65px 8px 20px 8px;
    }

    .panel-left,
    .panel-right {
        padding: 12px;
    }

    .option-btn {
        padding: 8px 10px;
        min-width: 55px;
        font-size: 14px;
    }

    .total-card {
        padding: 12px;
    }

    .total-amount {
        font-size: 1.3rem;
    }

    .btn-sell {
        padding: 14px;
        font-size: 1rem;
        letter-spacing: 1px;
    }

    .qty-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* ============================================
   MAHSULOTLAR BO'LIMI STILLARI
   ============================================ */

/* Product List Table */
.product-list-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    overflow-x: auto;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.product-table th,
.product-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.product-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.product-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

.product-table tr:last-child td {
    border-bottom: none;
}

.stock-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    background: rgba(0, 184, 148, 0.1);
    color: var(--success);
}

.stock-badge.low {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    padding: 24px;
    animation: slideDown 0.3s;
}

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

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid #333;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Detail View Layout */


.detail-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.btn-back {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

.detail-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .detail-content {
        grid-template-columns: 1fr;
    }
}

.colors-panel,
.stock-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    height: fit-content;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.btn-small {
    background: rgba(108, 92, 231, 0.2);
    color: var(--accent);
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

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

.color-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
}

.color-item:hover {
    border-color: #444;
}

.color-item.active {
    border-color: var(--accent);
    background: rgba(108, 92, 231, 0.1);
}

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

/* Mini form for adding color */
.mini-form {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-input);
    border-radius: 8px;
}

.mini-form input {
    width: 100%;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid #444;
    border-radius: 6px;
    color: white;
    margin-bottom: 10px;
}

.mini-form-buttons {
    display: flex;
    gap: 8px;
}

.btn-save-small {
    flex: 1;
    background: var(--success);
    border: none;
    color: white;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-cancel-small {
    width: 30px;
    background: var(--bg-card);
    border: 1px solid #444;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
}

/* Stock Matrix Table */
.stock-table {
    width: 100%;
    border-collapse: collapse;
}

.stock-table th {
    text-align: left;
    color: var(--text-secondary);
    padding: 10px;
    font-size: 14px;
}

.stock-table td {
    padding: 10px;
    border-top: 1px solid #333;
    vertical-align: middle;
}

.stock-input {
    width: 80px;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid #444;
    border-radius: 6px;
    color: white;
    text-align: center;
}

.mini-prices {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.price-input {
    width: 70px;
    padding: 4px;
    background: var(--bg-input);
    border: 1px solid #444;
    /* Added border */
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
    margin-left: 5px;
}


/* ============================================
   HIDDEN CLASS
   ============================================ */
.hidden {
    display: none !important;
}

/* ============================================
   MAHSULOTLAR MOBIL MOSLASHUV
   ============================================ */
@media (max-width: 768px) {

    /* Jadvalni karta ko'rinishiga o'tkazish */
    .product-list-container {
        padding: 10px;
        background: transparent;
    }

    .product-table,
    .product-table tbody,
    .product-table tr,
    .product-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .product-table thead {
        display: none;
        /* Sarlavhalarni yashirish */
    }

    .product-table tr {
        background: var(--bg-card);
        margin-bottom: 15px;
        border-radius: 12px;
        padding: 15px;
        border: 1px solid #333;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .product-table td {
        padding: 8px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }

    .product-table td:last-child {
        border-bottom: none;
    }

    /* Har bir katak oldiga sarlavha qo'shish (CSS attr orqali bo'lmasa qo'lda yozamiz) */
    .product-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        text-align: left;
    }

    /* Modal to'liq ekran */
    .modal-overlay {
        align-items: flex-end;
        /* Pastdan chiqishi uchun yoki to'liq */
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        padding: 20px;
        margin: 0;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
    }

    .modal-footer {
        padding-top: 15px;
        border-top: 1px solid #333;
    }

    /* Inputlar kattaroq mobilda */
    .form-group input,
    .form-group select {
        padding: 15px;
        font-size: 16px;
        /* iOS zoom oldini olish uchun */
    }
}

/* ============================================
   WIZARD & SUCCESS MESSAGE STYLES
   ============================================ */

/* Success Message */
.success-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #00b894;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 10px 30px rgba(0, 184, 148, 0.4);
    z-index: 2000;
    opacity: 0;
    animation: slideDownFade 0.5s forwards;
}

.success-message.hidden {
    display: none;
}

@keyframes slideDownFade {
    0% {
        transform: translate(-50%, -20px);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Wizard Modal */
.wizard-step {
    animation: fadeIn 0.3s ease;
}

.wizard-step.hidden {
    display: none;
}

/* Step Hint */
.step-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 10px;
    text-align: center;
}

/* Stock Grid List (Step 3) */
.stock-grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}

.stock-input-group {
    background: var(--bg-input);
    padding: 10px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #333;
}

.stock-input-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 600;
}

.stock-input-group input {
    width: 100%;
    padding: 8px;
    text-align: center;
    border: 1px solid #444;
    border-radius: 6px;
    background: var(--bg-card);
    color: white;
}

.highlight-text {
    color: var(--accent);
    font-weight: bold;
}

.stock-instruction {
    margin-bottom: 15px;
    font-size: 1rem;
    text-align: center;
}

/* Quick Colors Grid */
.quick-colors-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.color-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-btn-wrapper:hover {
    transform: scale(1.1);
}

.color-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.color-btn-wrapper.active .color-circle {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.4);
    transform: scale(1.1);
}

.color-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.color-btn-wrapper.active .color-label {
    color: var(--accent);
    font-weight: 600;
}

/* ============================================
   KIRIM & O'TKAZISH UTILITIES
   ============================================ */
.stock-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.stock-input-group {
    background: var(--bg-input);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stock-input-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.kirim-input {
    width: 100%;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid #444;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

/* O'tkazish jadvali */
.product-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9rem;
}

.product-table th,
.product-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.product-table th {
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-small {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid #444;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
}

/* Clear search button */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.clear-search-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.clear-search-btn:hover {
    color: var(--text-primary);
}

.clear-search-btn.hidden {
    display: none;
}

/* Checkbox group for sizes */
.checkbox-group {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-primary);
}

/* ============================================
   📊 HISOBOT BO'LIMI
   ============================================ */
.report-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.report-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
}

.report-section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-card {
    background: var(--bg-input);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Card Types */
.stat-card.total {
    border-left: 4px solid var(--accent);
}

.stat-card.cash {
    border-left: 4px solid var(--success);
}

.stat-card.credit {
    border-left: 4px solid var(--warning);
}

.stat-card.items {
    border-left: 4px solid #3498db;
}

.stat-card.receipts {
    border-left: 4px solid #9b59b6;
}

/* Product Ranking */
.product-ranking {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ranking-item {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 12px 15px;
    gap: 15px;
}

.ranking-position {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9rem;
}

.ranking-item:nth-child(1) .ranking-position {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
}

.ranking-item:nth-child(2) .ranking-position {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
    color: #000;
}

.ranking-item:nth-child(3) .ranking-position {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    color: #fff;
}

.ranking-item:nth-child(n+4) .ranking-position {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.ranking-name {
    flex: 1;
    font-weight: 500;
}

.ranking-count {
    font-weight: bold;
    color: var(--accent);
}

.empty-report {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Warehouse Stats */
.warehouse-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.warehouse-card {
    background: var(--bg-input);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
}

.warehouse-card.magazin {
    border: 2px solid var(--success);
}

.warehouse-card.sklad {
    border: 2px solid var(--accent);
}

.warehouse-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.warehouse-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

.warehouse-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .warehouse-value {
        font-size: 2rem;
    }
}

/* Inventory Modal */
.inventory-modal {
    max-width: 700px;
    max-height: 80vh;
}

.inventory-list {
    max-height: 60vh;
    overflow-y: auto;
}

.inventory-item {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-item-info {
    flex: 1;
}

.inventory-item-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 5px;
}

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

.inventory-item-qty {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--accent);
    min-width: 80px;
    text-align: right;
}

.inventory-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.warehouse-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}