/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body {
    padding-bottom: 80px;
}

a {
    color: inherit;
    text-decoration: none;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
    background: none;
    color: inherit;
}

/* ==================== TOAST ==================== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    padding: 12px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.35);
    max-width: 90%;
    text-align: center;
}

.toast.hidden {
    transform: translateX(-50%) translateY(-100px);
    opacity: 0;
    pointer-events: none;
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.35);
}

.toast.success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.35);
}

/* ==================== LOADING ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #f97316;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== PAGES ==================== */
.page {
    display: none;
    padding: 16px;
    min-height: calc(100vh - 80px);
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

/* ==================== PAGE HEADER ==================== */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-top: 8px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* ==================== BACK BUTTON ==================== */
.back-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #f97316;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.back-btn:hover {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.3);
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    text-align: center;
    padding: 32px 16px;
}

.login-logo {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #f97316, #fb923c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: #888;
    font-size: 15px;
    margin-bottom: 40px;
}

.login-widget-container {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 32px 24px;
    display: inline-block;
}

.login-widget-container p {
    color: #aaa;
    margin-bottom: 20px;
    font-size: 14px;
}

/* ==================== HOME PAGE ==================== */
.home-hero {
    text-align: center;
    padding: 40px 16px 32px;
}

.home-hero-logo {
    font-size: 52px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #f97316, #fb923c, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-hero-city {
    color: #888;
    font-size: 14px;
    margin-top: 4px;
}

.home-hero-city span {
    color: #f97316;
    font-weight: 600;
}

.home-hero-desc {
    color: #666;
    font-size: 13px;
    margin-top: 12px;
    line-height: 1.7;
}

.home-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.menu-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-card:hover {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.2);
    transform: translateY(-2px);
}

.menu-card:active {
    transform: scale(0.98);
}

.menu-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 115, 22, 0.12);
    border-radius: 14px;
    font-size: 22px;
    flex-shrink: 0;
}

.menu-card-text {
    flex: 1;
}

.menu-card-title {
    font-size: 16px;
    font-weight: 600;
}

.menu-card-desc {
    font-size: 12px;
    color: #777;
    margin-top: 2px;
}

.menu-card-arrow {
    color: #555;
    font-size: 18px;
}

/* ==================== CITIES ==================== */
.cities-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.city-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: center;
}

.city-card:hover {
    background: rgba(249, 115, 22, 0.1);
    border-color: rgba(249, 115, 22, 0.25);
    transform: translateY(-2px);
}

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

.city-card-name {
    font-size: 17px;
    font-weight: 600;
}

.city-card-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

/* ==================== SEARCH ==================== */
.search-bar {
    margin-bottom: 20px;
}

.search-input-wrap {
    position: relative;
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 16px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 14px 14px 42px;
    color: #fff;
    font-size: 15px;
    transition: all 0.2s;
}

.search-input::placeholder {
    color: #555;
}

.search-input:focus {
    border-color: rgba(249, 115, 22, 0.4);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    color: #888;
    font-size: 14px;
}

.search-clear.visible {
    display: flex;
}

/* ==================== CATEGORIES / SUBCATEGORIES ==================== */
.catalog-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.catalog-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 18px 16px;
    cursor: pointer;
    transition: all 0.25s;
}

.catalog-card:hover {
    background: rgba(249, 115, 22, 0.08);
    border-color: rgba(249, 115, 22, 0.2);
    transform: translateY(-1px);
}

.catalog-card:active {
    transform: scale(0.98);
}

.catalog-card-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 12px;
    font-size: 20px;
    flex-shrink: 0;
}

.catalog-card-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
}

.catalog-card-arrow {
    color: #444;
    font-size: 16px;
}

/* ==================== PRODUCTS ==================== */
.products-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
}

.product-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 18px;
    transition: all 0.25s;
}

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

.product-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
    padding-right: 12px;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: #f97316;
    white-space: nowrap;
}

.product-stock {
    font-size: 12px;
    color: #22c55e;
    margin-bottom: 14px;
}

.product-stock.low {
    color: #eab308;
}

.product-stock.critical {
    color: #ef4444;
}

.product-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
}

.qty-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    color: #ccc;
    transition: all 0.15s;
    user-select: none;
}

.qty-btn:hover {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.qty-btn:active {
    transform: scale(0.9);
}

.qty-value {
    width: 40px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 0;
}

.btn-add-cart {
    flex: 1;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-cart:hover {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    transform: translateY(-1px);
}

.btn-add-cart:active {
    transform: scale(0.97);
}

.btn-add-cart:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ==================== CART ==================== */
.cart-content {
    max-width: 500px;
    margin: 0 auto;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.cart-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.cart-empty-text {
    font-size: 16px;
    margin-bottom: 4px;
    color: #888;
}

.cart-empty-desc {
    font-size: 13px;
    color: #555;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 10px;
    transition: all 0.2s;
}

.cart-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 13px;
    color: #f97316;
    font-weight: 600;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cart-item-subtotal {
    font-size: 14px;
    font-weight: 700;
    color: #f97316;
    min-width: 70px;
    text-align: right;
}

.cart-item-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    cursor: pointer;
    color: #ef4444;
    font-size: 16px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.cart-item-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ==================== CART FOOTER ==================== */
.cart-footer {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    background: linear-gradient(to top, #0a0a0a 60%, transparent);
    padding: 20px 16px 12px;
    z-index: 50;
}

.cart-footer-inner {
    max-width: 500px;
    margin: 0 auto;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.cart-total-label {
    font-size: 16px;
    color: #aaa;
}

.cart-total-amount {
    font-size: 24px;
    font-weight: 800;
    color: #f97316;
}

.btn-checkout {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.25);
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(249, 115, 22, 0.35);
}

.btn-checkout:active {
    transform: scale(0.97);
}

/* ==================== CHECKOUT ==================== */
.checkout-section {
    max-width: 500px;
    margin: 0 auto;
}

.checkout-items {
    margin-bottom: 24px;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.checkout-item-name {
    font-size: 14px;
    color: #ccc;
}

.checkout-item-qty {
    font-size: 12px;
    color: #888;
}

.checkout-item-price {
    font-size: 14px;
    font-weight: 600;
    color: #f97316;
}

.checkout-total {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 24px;
    border-top: 2px solid rgba(249, 115, 22, 0.3);
}

.checkout-total-label {
    font-size: 17px;
    font-weight: 600;
}

.checkout-total-amount {
    font-size: 22px;
    font-weight: 800;
    color: #f97316;
}

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

.form-label {
    display: block;
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
    color: #fff;
    font-size: 15px;
    resize: vertical;
    min-height: 80px;
    transition: all 0.2s;
}

.form-textarea::placeholder {
    color: #555;
}

.form-textarea:focus {
    border-color: rgba(249, 115, 22, 0.4);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.btn-confirm-order {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.25);
}

.btn-confirm-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(34, 197, 94, 0.35);
}

.btn-confirm-order:active {
    transform: scale(0.97);
}

.btn-confirm-order:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ==================== ORDERS ==================== */
.orders-list {
    max-width: 500px;
    margin: 0 auto;
}

.orders-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.orders-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.order-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}

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

.order-id {
    font-size: 15px;
    font-weight: 700;
}

.order-date {
    font-size: 12px;
    color: #666;
}

.order-status {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.order-status.pending {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.order-status.success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.order-status.fail {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.order-items {
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.order-item-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #aaa;
    padding: 4px 0;
}

.order-item-total {
    color: #f97316;
    font-weight: 600;
}

/* ==================== PROFILE ==================== */
.profile-content {
    max-width: 400px;
    margin: 0 auto;
}

.profile-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-username {
    font-size: 14px;
    color: #888;
    margin-bottom: 16px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 14px 8px;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #f97316;
}

.stat-label {
    font-size: 11px;
    color: #777;
    margin-top: 2px;
}

.profile-city-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-city-row:hover {
    border-color: rgba(249, 115, 22, 0.2);
}

.profile-city-label {
    font-size: 14px;
    color: #888;
}

.profile-city-value {
    font-size: 14px;
    font-weight: 600;
    color: #f97316;
}

/* ==================== BOTTOM NAV ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #111;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: none;
    justify-content: space-around;
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.bottom-nav.visible {
    display: flex;
}

.nav-btn {
    background: none;
    border: none;
    color: #555;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    cursor: pointer;
    padding: 6px 12px;
    transition: all 0.2s;
    position: relative;
}

.nav-btn.active {
    color: #f97316;
}

.nav-btn-icon {
    font-size: 22px;
    line-height: 1;
}

.nav-btn-label {
    font-weight: 500;
}

.nav-badge {
    position: absolute;
    top: 0;
    right: 2px;
    background: #f97316;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.nav-badge.visible {
    display: flex;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #555;
}

.empty-state-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 17px;
    font-weight: 600;
    color: #888;
    margin-bottom: 6px;
}

.empty-state-desc {
    font-size: 13px;
    color: #555;
}

/* ==================== ORDER SUCCESS ==================== */
.order-success {
    text-align: center;
    padding: 48px 20px;
}

.order-success-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.order-success-title {
    font-size: 22px;
    font-weight: 700;
    color: #22c55e;
    margin-bottom: 8px;
}

.order-success-desc {
    font-size: 14px;
    color: #888;
    margin-bottom: 6px;
    line-height: 1.6;
}

.order-success-ids {
    font-size: 13px;
    color: #f97316;
    font-weight: 600;
    margin-top: 16px;
}

.btn-back-home {
    margin-top: 32px;
    padding: 14px 40px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back-home:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== RESPONSIVE ==================== */
@media (min-width: 768px) {
    body {
        max-width: 500px;
        margin: 0 auto;
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
    }

    .bottom-nav {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
    }
}
