* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: #f5f7fa; color: #333; overflow-x: hidden; }

/* NAVBAR & HERO SEARCH BAR UI */
.navbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #ffffff; padding: 16px 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); position: sticky; top: 0; z-index: 100; flex-wrap: wrap; }
.nav-left { display: flex; align-items: center; gap: 16px; justify-content: flex-start; }

/* Dropdown Styles for Brand Group */
.brand-group { display: flex; flex-direction: column; justify-content: center; }
.nav-city-dropdown { appearance: none; background: transparent; border: none; font-size: 0.75rem; font-weight: 600; color: #6b7280; cursor: pointer; padding: 0; margin-bottom: -2px; outline: none; }
.nav-city-dropdown:hover { color: #3b82f6; }

.nav-center { flex: 1; display: flex; justify-content: center; padding: 0 20px; min-width: 300px; }
.nav-right { display: flex; gap: 8px; flex-wrap: wrap; }

.hamburger { background: none; border: none; font-size: 26px; cursor: pointer; color: #5f6368; display: flex; align-items: center; justify-content: center; padding: 4px 8px; border-radius: 8px; transition: background 0.2s; }
.hamburger:hover { background: #f1f3f4; color: #202124; }
h1 { color: #202124; font-size: 22px; font-weight: 600; letter-spacing: -0.5px; white-space: nowrap; margin: 0; line-height: 1; }

.search-container { width: 100%; max-width: 700px; position: relative; }
.search-container input { width: 100%; padding: 16px 24px 16px 48px; border: 2px solid #e1e4e8; border-radius: 40px; font-size: 16px; font-weight: 500; outline: none; transition: all 0.3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.05); background: #f8f9fa; }
.search-container input:focus { border-color: #1a73e8; box-shadow: 0 6px 16px rgba(26, 115, 232, 0.15); background: #ffffff; }
.search-container::before { content: '🔍'; position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 18px; color: #5f6368; pointer-events: none; }

/* NAV BUTTON STYLES */
.tab-btn { text-decoration: none; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 14px; transition: all 0.2s; }
.tab-btn.active { background: #1a73e8; color: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); pointer-events: none; border: 1px solid #1a73e8; }
.tab-btn.inactive { background: #f1f3f4; color: #202124; border: 1px solid #dadce0; }
.tab-btn.inactive:hover { background: #e8eaed; }

.sidebar { position: fixed; top: 0; left: -340px; width: 340px; height: 100%; background: #ffffff; box-shadow: 4px 0 16px rgba(0,0,0,0.1); transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1001; display: flex; flex-direction: column; overflow-y: auto; }
.sidebar.open { left: 0; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #f1f3f4; }
.sidebar-header h2 { font-size: 18px; font-weight: 600; color: #202124; }
.close-btn { background: none; border: none; font-size: 28px; cursor: pointer; color: #5f6368; line-height: 1; padding: 0 8px; }
.close-btn:hover { color: #202124; }
.sidebar-content { padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-group label { font-size: 13px; color: #5f6368; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
select, input[type=text]:not(#filter-product) { padding: 12px 14px; border: 1px solid #dadce0; border-radius: 8px; font-size: 14px; outline: none; background: #ffffff; width: 100%; transition: border-color 0.2s; }
select:focus, input[type=text]:focus { border-color: #1a73e8; }
.checkbox-panel { border: 1px solid #dadce0; border-radius: 8px; padding: 16px; background: #fafafa; max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #3c4043; cursor: pointer; }
.checkbox-label input { cursor: pointer; width: 18px; height: 18px; accent-color: #1a73e8; }
.slider-container { display: flex; align-items: center; gap: 12px; }
input[type=range] { flex: 1; accent-color: #1a73e8; cursor: pointer; }
#price-range-label { font-size: 14px; color: #1a73e8; font-weight: 700; min-width: 80px; text-align: right; }
.btn-reset { padding: 12px; background: #f1f3f4; color: #202124; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; margin-top: auto; }
.btn-reset:hover { background: #e8eaed; }

.main-wrapper { padding: 24px; max-width: 1600px; margin: 0 auto; }
.meta-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; font-size: 14px; color: #5f6368; }

/* RESPONSIVE GRID LAYOUT */
.deal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .deal-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1024px) { .deal-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; } }

/* OPTIMIZED MOBILE CARD PADDING & EQUAL HEIGHT */
.card { background: #ffffff; border-radius: 12px; padding: 10px; border: 1px solid #dadce0; box-shadow: 0 1px 3px rgba(0,0,0,0.05); display: flex; flex-direction: column; height: 100%; transition: transform 0.2s ease; position: relative; min-width: 0; }
.card-img-wrapper { height: 130px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; padding: 4px; border-radius: 8px; flex-shrink: 0; }
@media (min-width: 768px) { .card-img-wrapper { height: 180px; margin-bottom: 8px; } }
.card-img-wrapper img { max-height: 100%; max-width: 100%; object-fit: contain; cursor: pointer; transition: transform 0.2s; }
.card-img-wrapper img:hover { transform: scale(1.05); }

.card-title { font-size: 13px; font-weight: 600; color: #202124; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; transition: color 0.2s ease; flex-grow: 1; }
@media (min-width: 768px) { .card-title { font-size: 15px; } }

.card-price-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: auto; margin-bottom: 4px; }
.price-badge { color: #202124; display: inline-flex; align-items: center; font-weight: 800; }
.card-price { font-size: 16px; line-height: 1; }
@media (min-width: 768px) { .card-price { font-size: 20px; } }

/* UNICODE RIYAL SYMBOL (WINDOWS FIX) */
.currency-icon { font-size: 1.1em; font-weight: normal; margin-right: 4px; display: inline-block; font-family: "Tahoma", "Arial", sans-serif; }
.currency-icon-small { font-size: 0.9em; font-weight: normal; margin-right: 3px; display: inline-block; font-family: "Tahoma", "Arial", sans-serif; }

.card-old-price { color: #888888; text-decoration: line-through; font-size: 11px; font-weight: 600; }
.badge-offer { background: #00a859; color: #ffffff; padding: 3px 5px; border-radius: 4px; font-size: 10px; font-weight: 800; white-space: nowrap; display: inline-block; letter-spacing: 0.3px; }
@media (min-width: 768px) { .badge-offer { padding: 4px 8px; font-size: 12px; margin-left: auto; } }

.card-store { font-size: 11px; color: #1a73e8; background: #e8f0fe; padding: 4px 8px; border-radius: 20px; font-weight: 700; display: inline-block; width: fit-content; max-width: 100%; box-sizing: border-box; white-space: normal; word-wrap: break-word; line-height: 1.4; letter-spacing: 0.3px; border: 1px solid #d2e3fc; }
@media (min-width: 768px) { .card-store { font-size: 12px; padding: 4px 12px; } }
.card-date { font-size: 11px; color: #80868b; font-weight: 400; margin-top: 2px; }
@media (min-width: 768px) { .card-date { font-size: 12px; } }
 
.loading-indicator { text-align: center; padding: 20px; color: #5f6368; font-size: 14px; font-weight: 500; grid-column: 1 / -1; }

/* THEATER MODE POPUP */
#popup-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 2000; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(5px); flex-direction: column; }
#popup-overlay.active { display: flex; }
#popup-box { background: white; border-radius: 16px; padding: 0; width: 90vw; max-width: 500px; aspect-ratio: 1 / 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
#popup-img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1); }
#popup-img.zoomed { transform: scale(1.8); cursor: zoom-out; }
#popup-title { display: none; }
#popup-close { position: absolute; top: 12px; right: 12px; background: #ef4444; color: white; width: 36px; height: 36px; border-radius: 50%; font-size: 20px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 2002; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
#popup-close:hover { background: #dc2626; transform: scale(1.1); }

@media (max-width: 768px) {
  .navbar { flex-direction: column; gap: 12px; padding: 12px; align-items: stretch; }
  .nav-left { width: 100%; justify-content: flex-start; gap: 12px; }
  .nav-center { width: 100%; padding: 0; min-width: auto; }
  .nav-right { width: 100%; justify-content: center; }
}