/* ==========================================
   IMPORT FONTS
========================================== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ==========================================
   CSS VARIABLES
========================================== */
:root {
    --primary:       #FF6B35;
    --primary-light: #FFF0EB;
    --primary-dark:  #E0521C;
    --bg:            #F7F8FA;
    --surface:       #FFFFFF;
    --text:          #1A1A2E;
    --text-muted:    #8E8EA0;
    --border:        #EBEBF0;
    --success:       #22C55E;
    --danger:        #EF4444;
    --warning:       #F59E0B;
    --info:          #3B82F6;
    --radius-sm:     8px;
    --radius-md:     12px;
    --radius-lg:     18px;
    --radius-xl:     24px;
    --shadow-sm:     0 1px 4px rgba(0,0,0,0.06);
    --shadow-md:     0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:     0 8px 32px rgba(0,0,0,0.12);
}

/* ==========================================
   BASE
========================================== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   CLIENT: HEADER
========================================== */
.glass-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 10px;
}

.store-title {
    font-family: 'Nunito', sans-serif;
    font-size: 22px;
    font-weight: 900;
    color: var(--text);
    letter-spacing: -0.5px;
}

.store-title span { color: var(--primary); }

/* ==========================================
   CLIENT: CATEGORY TABS
========================================== */
.category-wrapper {
    overflow-x: auto;
    white-space: nowrap;
    padding: 8px 14px 14px;
    scrollbar-width: none;
}
.category-wrapper::-webkit-scrollbar { display: none; }

.tab {
    display: inline-block;
    padding: 7px 16px;
    margin-right: 6px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(255,107,53,0.3);
}

/* ==========================================
   CLIENT: PRODUCT GRID
========================================== */
.grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 14px 14px 120px;
}

.product-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.product-card:active { transform: scale(0.97); }

.product-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
    background: var(--bg);
}

.p-info { padding: 10px 11px 12px; }

.p-info h4 {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    height: 35px;
    overflow: hidden;
    color: var(--text);
    margin-bottom: 6px;
}

.price {
    color: var(--primary);
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 9px;
    font-family: 'Nunito', sans-serif;
}

.add-btn {
    width: 100%;
    padding: 7px;
    background: var(--primary-light);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: background 0.15s;
}

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

/* ==========================================
   CLIENT: FLOATING CART
========================================== */
.floating-cart {
    position: fixed;
    bottom: 18px;
    left: 14px; right: 14px;
    background: var(--text);
    color: white;
    padding: 13px 14px 13px 18px;
    border-radius: 50px;
    display: none;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 12px 32px rgba(26,26,46,0.3);
    z-index: 200;
    cursor: pointer;
}

.cart-info { font-size: 14px; font-weight: 600; }
.cart-info b { color: var(--primary); }

.view-cart-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ==========================================
   CLIENT: CART MODAL
========================================== */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: flex-end;
    z-index: 300;
}

.modal-content {
    background: var(--surface);
    width: 100%;
    max-height: 88%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 22px 18px 30px;
    overflow-y: auto;
}

.modal-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 18px;
}

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

.modal-header h3 {
    font-family: 'Nunito', sans-serif;
    font-size: 20px;
    font-weight: 900;
}

.modal-close {
    width: 32px; height: 32px;
    background: var(--bg);
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}

/* Cart items */
.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.summary-info { flex: 1; }
.summary-info .item-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.summary-info .item-price { font-size: 13px; color: var(--primary); font-weight: 700; }

.qty-controls {
    display: flex;
    align-items: center;
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 8px;
}

.qty-btn {
    width: 30px; height: 30px;
    background: var(--surface);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm);
}

.qty-num { font-weight: 800; min-width: 20px; text-align: center; font-size: 15px; }

/* Payment info */
.payment-card-box {
    background: var(--primary-light);
    border: 1.5px dashed var(--primary);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin: 16px 0;
}

.payment-card-box p { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.payment-card-box h4 { font-size: 16px; font-weight: 800; color: var(--primary); letter-spacing: 1px; }

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    font-size: 17px;
    font-weight: 700;
}

.order-total b { color: var(--primary); font-family: 'Nunito', sans-serif; font-size: 20px; }

/* File upload */
.file-label {
    display: block;
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-label:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ==========================================
   SHARED: BUTTONS
========================================== */
.tg-button {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: background 0.2s, transform 0.1s;
}

.tg-button:active { transform: scale(0.98); background: var(--primary-dark); }
.tg-button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================
   SHARED: LOADER
========================================== */
.loader-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-size: 14px;
}

.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================
   ADMIN: LOGIN
========================================== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #fff8f5 0%, #f7f8fa 100%);
}

.login-box {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 40px 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.login-logo {
    width: 56px; height: 56px;
    background: var(--primary-light);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.login-box h2 {
    font-family: 'Nunito', sans-serif;
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 5px;
}

.login-box p { font-size: 14px; color: var(--text-muted); margin-bottom: 26px; }

/* ==========================================
   ADMIN: HEADER
========================================== */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}

.admin-header h1 {
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.3px;
}

.logout-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.2s;
}

.logout-btn:hover { border-color: var(--danger); color: var(--danger); background: #fff5f5; }

/* ==========================================
   ADMIN: TABS
========================================== */
.tab-bar {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-bar-btn, .tab-btn {
    flex: 1;
    padding: 13px 10px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    white-space: nowrap;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.2s;
}

.tab-bar-btn.active, .tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ==========================================
   ADMIN: INPUTS
========================================== */
.input, .admin-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 10px;
    outline: none;
    background: var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: border-color 0.2s, background 0.2s;
}

.input:focus, .admin-input:focus {
    border-color: var(--primary);
    background: var(--surface);
}

select.input, select.admin-input { cursor: pointer; }

/* ==========================================
   ADMIN: CARDS
========================================== */
.card, .glass-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.card h3, .glass-card h3 {
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 14px;
    color: var(--text);
}

/* ==========================================
   ADMIN: IMAGE UPLOAD
========================================== */
.image-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s;
    position: relative;
    background: var(--bg);
}

.image-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }

.image-upload-area input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

.image-upload-area p { font-size: 13px; color: var(--text-muted); font-weight: 600; }

#image-preview {
    width: 100%; max-height: 160px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    display: none;
    border: 1px solid var(--border);
}

/* ==========================================
   ADMIN: BUTTONS
========================================== */
.btn {
    padding: 11px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: opacity 0.2s, transform 0.1s;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger   { background: var(--danger); color: white; }
.btn-success  { background: var(--success); color: white; }

.btn-sm {
    padding: 6px 11px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 32px; height: 32px; padding: 0;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.btn-ghost { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* Row layout */
.row { display: flex; gap: 8px; align-items: stretch; }
.row .input, .row .admin-input { margin-bottom: 0; }
.row .btn { white-space: nowrap; }

/* ==========================================
   ADMIN: PRODUCT ITEM
========================================== */
.product-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px;
    background: var(--bg);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.product-item img {
    width: 50px; height: 50px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--border);
    flex-shrink: 0;
}

.product-item .info { flex: 1; min-width: 0; }
.product-item .info b { font-size: 13px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-item .info span { font-size: 12px; color: var(--text-muted); }
.product-item .actions { display: flex; gap: 5px; flex-shrink: 0; }

/* ==========================================
   ADMIN: ORDERS
========================================== */
.order-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    transition: box-shadow 0.15s;
}

.order-card.pending { border-left-color: var(--warning); }
.order-card.done    { border-left-color: var(--success); }

.order-card p { font-size: 13px; margin-bottom: 5px; color: #444; line-height: 1.5; }
.order-card p b { color: var(--text); }
.order-card a { font-size: 13px; color: var(--primary); font-weight: 600; text-decoration: none; }

.order-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}
.status-pending  { background: #FEF3C7; color: #92400E; }
.status-accepted { background: #DCFCE7; color: #166534; }

/* ==========================================
   ADMIN: STAT CARD
========================================== */
.stat-box {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    color: white;
}

.stat-box p { font-size: 14px; opacity: 0.85; margin-bottom: 10px; font-weight: 600; }
.stat-box h2 {
    font-family: 'Nunito', sans-serif;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: -1px;
}

/* ==========================================
   ADMIN: PAGE LAYOUT
========================================== */
.page { padding: 14px; max-width: 580px; margin: 0 auto; }

/* ==========================================
   SUPERADMIN: BIZ CARD
========================================== */
.biz-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
}

.biz-icon {
    width: 46px; height: 46px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.biz-card .info { flex: 1; min-width: 0; }
.biz-card .info h4 { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.biz-card .info p  { font-size: 12px; color: var(--text-muted); font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================
   MISC
========================================== */
.loading-text { text-align: center; color: var(--text-muted); padding: 30px; font-size: 14px; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 14px; }
.empty-icon { font-size: 40px; margin-bottom: 10px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* Section label */
.section-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 16px 0 8px;
}

/* Login container (superadmin eski class uchun) */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #fff8f5 0%, #f7f8fa 100%);
}

/* ==========================================
   BO'LIM ITEM (edit/delete)
========================================== */
.cat-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin-bottom: 8px;
}

.cat-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* ==========================================
   BUYURTMA MODAL — YETKAZIB BERISH TANLOVI
========================================== */
.delivery-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
}

.delivery-btn {
    flex: 1;
    padding: 11px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.2s;
    text-align: center;
}

.delivery-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* Textarea */
.order-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    resize: none;
    outline: none;
    margin-bottom: 10px;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.order-textarea:focus {
    border-color: var(--primary);
    background: var(--surface);
}

/* ==========================================
   ADMIN SOZLAMALAR
========================================== */
.field-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 5px;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    margin-top: 10px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }
