:root {
    --bg-main: #1b1b29;
    --bg-card: #232336;
    --primary: #7239ea;
    --primary-hover: #5d2bc5;
    --text-main: #ffffff;
    --text-muted: #8b8b99;
    --border: #32324b;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { background-color: var(--bg-main); color: var(--text-main); display: flex; height: 100vh; overflow: hidden; }

/* YON MENYU */
.sidebar { width: 260px; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px; z-index: 100; transition: 0.3s; }
.logo-area { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; margin-bottom: 40px; }
.nav-links { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.nav-links li { padding: 14px 15px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; gap: 15px; font-weight: 500; color: var(--text-muted); transition: 0.3s; }
.nav-links li:hover, .nav-links li.active { background: var(--primary); color: #fff; }
.nav-links li#menu-logout:hover { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }

/* ASOSIY QISM */
.main-content { flex: 1; overflow-y: auto; padding: 25px 30px; }

/* HEADER */
.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.mobile-toggle { display: none; background: transparent; border: none; color: var(--text-main); font-size: 24px; cursor: pointer; }
.user-profile { display: flex; align-items: center; gap: 15px; background: var(--bg-card); padding: 8px 20px 8px 8px; border-radius: 30px; border: 1px solid var(--border); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
.user-info { display: flex; flex-direction: column; }
.username { font-weight: 600; font-size: 14px; }
.user-balance { font-size: 12px; color: #2ecc71; font-weight: 700; }

/* STATISTIKA KARTOCHKALARI */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--bg-card); padding: 20px; border-radius: 16px; border: 1px solid var(--border); display: flex; align-items: center; gap: 20px; }
.stat-icon { width: 60px; height: 60px; border-radius: 16px; display: flex; justify-content: center; align-items: center; font-size: 24px; }
.stat-details h3 { font-size: 20px; font-weight: 700; margin-bottom: 5px; }
.stat-details p { color: var(--text-muted); font-size: 13px; font-weight: 500; }

/* BUYURTMA QISMI GRID */
.order-section { display: grid; grid-template-columns: 1.5fr 1fr; gap: 25px; align-items: start; }
.order-form-card, .service-info-card { background: var(--bg-card); padding: 25px; border-radius: 16px; border: 1px solid var(--border); }

/* KATEGORIYA KNOPKALARI */
.category-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; }
.cat-btn { background: var(--bg-main); border: 1px solid var(--border); color: var(--text-muted); padding: 10px 15px; border-radius: 10px; font-size: 13px; font-weight: 500; cursor: pointer; transition: 0.3s; display: flex; align-items: center; gap: 8px; }
.cat-btn:hover, .cat-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* FORM VA INPUTLAR */
.input-group { margin-bottom: 20px; position: relative; }
.input-group label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--text-muted); font-weight: 500; }
.form-control { width: 100%; background: var(--bg-main); border: 1px solid var(--border); color: var(--text-main); padding: 15px; border-radius: 12px; font-size: 14px; outline: none; transition: 0.3s; }
.form-control:focus { border-color: var(--primary); }

/* CUSTOM SELECT */
.custom-select { position: relative; width: 100%; user-select: none; }
.select-btn { display: flex; justify-content: space-between; align-items: center; background: var(--bg-main); border: 1px solid var(--border); color: var(--text-main); padding: 15px; border-radius: 12px; font-size: 14px; cursor: pointer; transition: 0.3s; }
.select-btn i.arrow { color: var(--text-muted); transition: 0.3s; }
.custom-select.active .select-btn { border-color: var(--primary); }
.custom-select.active .select-btn i.arrow { transform: rotate(-180deg); }

.select-dropdown { position: absolute; top: calc(100% + 5px); left: 0; width: 100%; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); overflow: hidden; display: none; z-index: 20; max-height: 300px; overflow-y: auto; }
.custom-select.active .select-dropdown { display: block; }
.select-item { padding: 14px 15px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: 0.2s; }
.select-item:hover { background: rgba(114, 57, 234, 0.1); color: var(--primary); }

/* NARX VA TUGMA */
.charge-box { background: rgba(46, 204, 113, 0.1); border: 1px dashed #2ecc71; padding: 15px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.charge-box span { color: #2ecc71; font-weight: 500; font-size: 14px; }
.charge-box h2 { color: #2ecc71; font-size: 22px; }

.submit-btn { width: 100%; background: var(--primary); color: #fff; border: none; padding: 16px; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: 0.3s; display: flex; justify-content: center; align-items: center; gap: 10px; }
.submit-btn:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-2px); }
.submit-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* O'NG TOMON: MA'LUMOT */
.info-header { background: rgba(114, 57, 234, 0.1); color: var(--primary); padding: 15px; border-radius: 12px; font-weight: 600; margin-bottom: 15px; display: flex; align-items: center; gap: 10px; }
.info-body { color: var(--text-muted); font-size: 14px; line-height: 1.6; padding: 10px; }

/* MOBIL MOSLASHUV */
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 99; backdrop-filter: blur(3px); }
.sidebar-overlay.active { display: block; }

@media (max-width: 992px) {
    .order-section { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -280px; height: 100%; }
    .sidebar.active { left: 0; }
    .main-content { padding: 15px; }
    .mobile-toggle { display: block; }
}

/* ==========================================
   LOGIN (AUTH) EKRANI DIZAYNI (MINI APP + CHROME/SAFARI)
========================================== */
#auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-main); z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    padding: 20px;
    overflow-y: auto;
}
.auth-card {
    background: var(--bg-card); padding: 36px 28px; border-radius: 18px;
    width: 100%; max-width: 400px; border: 1px solid var(--border);
    text-align: center; box-shadow: 0 15px 35px rgba(0,0,0,0.35);
    animation: popIn 0.25s ease;
}
.auth-card h2 { margin-bottom: 20px; color: var(--text-main); font-size: 22px; }
.auth-switch {
    margin-top: 20px; color: var(--primary); cursor: pointer;
    font-size: 14px; font-weight: 500; transition: 0.3s;
}
.auth-switch:hover { color: var(--primary-hover); text-decoration: underline; }

.auth-logo-badge {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: rgba(114, 57, 234, 0.14);
    border: 1px solid rgba(114, 57, 234, 0.35);
    color: var(--primary);
    font-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px auto;
}

.tg-login-btn {
    width: 100%;
    background: linear-gradient(135deg, #27a7e7, #1c88c7);
    color: #fff;
    border: none;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: 0.25s;
    box-shadow: 0 8px 20px rgba(39, 167, 231, 0.25);
}
.tg-login-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
}
.tg-login-btn:active {
    transform: scale(0.98);
}

.auth-pending-box {
    background: rgba(52, 152, 219, 0.08);
    border: 1px dashed rgba(52, 152, 219, 0.45);
    border-radius: 14px;
    padding: 18px 15px;
    margin-top: 8px;
}

.auth-cancel-btn {
    width: 100%;
    background: rgba(231, 76, 60, 0.12);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.2s;
}
.auth-cancel-btn:hover {
    background: rgba(231, 76, 60, 0.22);
}

/* ==========================================
   TO'LOV MODAL OYNASI DIZAYNI (STARS + AVTO-TO'LOV + ADMIN)
========================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.65); z-index: 1000;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(4px);
    padding: 16px;
    overflow-y: auto;
}
.modal-card {
    background: var(--bg-card); width: 92%; max-width: 390px;
    border-radius: 16px; border: 1px solid var(--border);
    padding: 24px; box-shadow: 0 15px 35px rgba(0,0,0,0.35);
    animation: popIn 0.3s ease; text-align: center;
}
.payment-modal-card {
    max-width: 430px;
    max-height: 92vh;
    overflow-y: auto;
}
@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; color: var(--text-main); margin: 0; display: flex; align-items: center; gap: 8px; }
.close-btn {
    background: transparent; border: none; color: var(--text-muted);
    font-size: 20px; cursor: pointer; transition: 0.3s;
}
.close-btn:hover { color: #e74c3c; transform: scale(1.1); }

/* Tashqi brauzer to'lov tablari */
.pay-method-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: var(--bg-main);
    padding: 5px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.pay-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 8px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.pay-tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(114, 57, 234, 0.35);
}

/* Tezkor summa tugmalari */
.quick-amount-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.quick-amt-btn {
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 9px 4px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.quick-amt-btn:hover {
    border-color: #2ecc71;
    color: #2ecc71;
    background: rgba(46, 204, 113, 0.08);
}

/* Avto-to'lov chek oynasi */
.invoice-timer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(241, 196, 15, 0.08);
    border: 1px solid rgba(241, 196, 15, 0.3);
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-main);
}

.invoice-warning-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #ff9f95;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 14px;
}
.invoice-warning-box i {
    color: #e74c3c;
    margin-top: 2px;
    font-size: 14px;
}

.invoice-field {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.invoice-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.invoice-value-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.mini-copy-btn {
    background: rgba(114, 57, 234, 0.16);
    color: #b794ff;
    border: 1px solid rgba(114, 57, 234, 0.4);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: 0.2s;
}
.mini-copy-btn:hover {
    background: var(--primary);
    color: #fff;
}

.invoice-status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(52, 152, 219, 0.08);
    border: 1px solid rgba(52, 152, 219, 0.28);
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 12px;
    color: #a9d6f5;
    line-height: 1.45;
}

/* ==========================================
   PROFIL VA AVATAR DIZAYNI
========================================== */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 45px; /* Rasmning eni */
    height: 45px; /* Rasmning bo'yi */
    border-radius: 50%; /* Dumaloq qilish */
    object-fit: cover; /* Rasm qisilib qolmasligi uchun */
    border: 2px solid var(--primary); /* Atrofiga chiroyli hoshiya */
    background-color: #fff;
}

.user-info {
    display: flex;
    flex-direction: column;
}

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

.user-balance {
    font-size: 12px;
    color: #2ecc71;
    font-weight: 600;
}

@media (max-width: 768px) {
    .charge-box h2 { font-size: 18px; }
    .form-control, .select-btn { padding: 12px; font-size: 13px; }
    .stat-details h3 { font-size: 16px; }
    .cat-btn { padding: 8px 12px; font-size: 12px; }
    td, th { font-size: 12px !important; padding: 10px !important; }
    .modal-card { width: 100%; padding: 20px 16px; }
    .quick-amount-grid { grid-template-columns: repeat(2, 1fr); }
    .invoice-value-row strong { font-size: 14px !important; }
}

/* ==========================================
   MIJOZLAR BUYURTMALARI (CARDS) DIZAYNI
========================================== */
.orders-cards-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.order-card {
    background: #232336;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #32324b;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: 0.3s;
}

.order-card:hover {
    border-color: #4a4a65;
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #8b8b99;
    font-size: 14px;
    font-weight: 500;
}

.order-card-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
}

.order-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.stat-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 11px;
    color: #8b8b99;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 14px;
    color: #ffffff;
    font-weight: 600;
}

.order-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    padding-top: 15px;
    border-top: 1px solid #32324b;
}

.order-link {
    color: #26a69a; /* Rasmdagi daryo rangi */
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.order-link:hover {
    text-decoration: underline;
}

.copy-btn {
    color: #26a69a;
    cursor: pointer;
    font-size: 18px;
    transition: 0.3s;
}

.copy-btn:hover {
    opacity: 0.7;
}

.refill-btn {
    background: rgba(114, 57, 234, 0.15);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.refill-btn:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

.refill-btn:disabled {
    background: rgba(139, 139, 153, 0.1);
    color: #8b8b99;
    border-color: #32324b;
    cursor: not-allowed;
}

/* ==========================================
   TOAST NOTIFICATION VA TEZKOR TUGMA DIZAYNI
========================================== */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
    width: calc(100% - 40px);
}

.toast-item {
    background: #232336;
    color: #fff;
    padding: 14px 18px;
    border-radius: 12px;
    border-left: 4px solid #2ecc71;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    animation: slideInRight 0.3s ease forwards;
    transition: 0.3s;
}

.toast-item.toast-error { border-left-color: #e74c3c; }
.toast-item.toast-error i { color: #e74c3c; font-size: 18px; }
.toast-item.toast-warning { border-left-color: #f1c40f; }
.toast-item.toast-warning i { color: #f1c40f; font-size: 18px; }
.toast-item.toast-success i { color: #2ecc71; font-size: 18px; }

.toast-hide {
    opacity: 0;
    transform: translateX(100%);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.quick-add-btn {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid #2ecc71;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.quick-add-btn:hover {
    background: #2ecc71;
    color: #fff;
}
