:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #10b981;
  --bg-color: #f3f4f6;
  --surface-color: #ffffff;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --border-color: #e5e7eb;
  --error-color: #ef4444;
  --success-color: #10b981;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  --bg-color: #111827;
  --surface-color: #1f2937;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --border-color: #374151;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s, color 0.3s;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-hover);
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.grid {
  display: grid;
}

/* Navbar */
.navbar {
  background-color: var(--surface-color);
  box-shadow: var(--shadow);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

#dropdown {
  display: none !important;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  transition: all 0.2s;
  border: none;
}

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

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

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--text-secondary);
}

/* Cards */
.card {
  background-color: var(--surface-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-4px);
}

.show {
  display: block !important;
}

#dropdown,
#pdp-dropdown {
  display: none;
}

#dropdown.show,
#pdp-dropdown.show {
  display: block !important;
  z-index: 2000;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background-color: var(--surface-color);
  color: var(--text-primary);
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 9999px;
  background-color: var(--primary-color);
  color: white;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 4rem 2rem;
  text-align: center;
  border-radius: var(--radius);
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Product Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.product-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.product-info {
  padding: 1rem;
}

.product-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.product-price {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--primary-color);
}

.original-price {
  text-decoration: line-through;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (max-width: 992px) {
  .toast-container {
    bottom: 5.5rem;
    right: 1rem;
    left: 1rem;
    max-width: calc(100% - 2rem);
  }
}

.toast {
  background-color: var(--surface-color);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary-color);
  animation: slideIn 0.3s ease-out;
}

.toast.error {
  border-left-color: var(--error-color);
}

.toast.success {
  border-left-color: var(--success-color);
}

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

/* Order Status Timeline */
.timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin: 2rem 0;
  padding: 0 1rem;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 3rem;
  right: 3rem;
  height: 2px;
  background-color: var(--border-color);
  transform: translateY(-50%);
  z-index: 1;
}

.timeline-step {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.timeline-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--surface-color);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.125rem;
  transition: all 0.3s;
}

.timeline-step.completed .timeline-icon {
  background-color: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.timeline-step.active .timeline-icon {
  border-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}

.timeline-step.cancelled .timeline-icon {
  background-color: var(--error-color);
  border-color: var(--error-color);
  color: white;
}

.timeline-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-color);
  padding: 0 0.5rem;
}

.timeline-step.completed .timeline-label,
.timeline-step.active .timeline-label {
  color: var(--text-primary);
}

/* Print Styles for Invoice */
.print-show {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  
  .printable-invoice, .printable-invoice * {
    visibility: visible;
  }
  
  .printable-invoice {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 20px;
    background: white;
    color: black;
  }
  
  .print-hide {
    display: none !important;
  }
  
  .print-show {
    display: block !important;
  }
  
  .status-badge {
    border: 1px solid #000;
    color: #000 !important;
    background: transparent !important;
  }
}

/* Footer Styles */
.footer {
  background-color: #1f2937;
  color: #f3f4f6;
  padding-top: 4rem;
  margin-top: 5rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-section h3 {
  color: white;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-section h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 50px;
  height: 2px;
  background-color: var(--primary-color);
}

.footer-section p {
  color: #9ca3af;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 0.75rem;
}

.footer-section ul li a {
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.3s ease;
  display: inline-block;
}

.footer-section ul li a:hover {
  color: var(--primary-color);
  transform: translateX(5px);
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-links a:hover {
  background-color: var(--primary-color);
  transform: translateY(-3px);
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.newsletter-form input {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius);
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  outline: none;
}

.newsletter-form input:focus {
  background-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.5);
}

.footer-bottom {
  background-color: #111827;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
  color: #9ca3af;
  margin: 0;
}

.payment-methods {
  display: flex;
  gap: 1rem;
  font-size: 1.5rem;
  color: #9ca3af;
}

/* =============================================
   HEADER SEARCH BAR
   ============================================= */
.nav-search-wrapper {
    position: relative;
    flex: 1;
    max-width: 440px;
    margin: 0 1.5rem;
}

.nav-search-form {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border: 1.5px solid var(--border-color);
    border-radius: 50px;
    overflow: visible;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.nav-search-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.nav-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.55rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}

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

.nav-search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: 0 50px 50px 0;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

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

/* Autocomplete Dropdown */
.search-suggestions-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
}

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

.search-suggestion-item:hover,
.search-suggestion-item.active {
    background: rgba(79, 70, 229, 0.06);
}

.suggestion-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--bg-color);
}

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

.suggestion-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.suggestion-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    flex-shrink: 0;
}

.suggestion-view-all {
    display: block;
    text-align: center;
    padding: 0.65rem 1rem;
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-top: 1px solid var(--border-color);
    text-decoration: none;
    transition: background 0.15s;
}

.suggestion-view-all:hover {
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary-color);
}

.suggestion-no-results {
    padding: 1.25rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.suggestion-loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.suggestion-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* =============================================
   SEARCH RESULTS PAGE (search.html)
   ============================================= */
.search-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    padding: 2.5rem 0;
    margin-bottom: 2rem;
}

.search-hero-inner {
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
    padding: 0 1rem;
}

.search-hero-title {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.search-hero-form {
    display: flex;
    background: white;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.search-hero-input {
    flex: 1;
    border: none;
    padding: 0.85rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}

.search-hero-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.85rem 1.75rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0 50px 50px 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

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

.search-results-count {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

/* Search page layout */
.search-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    padding-bottom: 4rem;
}

.search-filters-panel {
    background: var(--surface-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 80px;
}

.search-filter-title {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.search-filter-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.search-filter-list li {
    margin-bottom: 0.4rem;
}

.search-filter-list label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.15s;
}

.search-filter-list label:hover {
    color: var(--text-primary);
}

.search-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.search-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-active-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    border-radius: 50px;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(79,70,229,0.2);
    transition: background 0.15s;
}

.search-active-tag:hover {
    background: rgba(79,70,229,0.18);
}

.search-active-tag .remove-tag {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 900px) {
    .nav-search-wrapper {
        display: none;
    }
}

@media (max-width: 768px) {
    .search-layout {
        grid-template-columns: 1fr;
    }
    .search-filters-panel {
        position: static;
    }
}

/* Admin Responsive Design */
@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr !important;
    }
    .admin-sidebar {
        padding: 1rem 0 !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    .admin-sidebar > div {
        margin-bottom: 1rem !important;
    }
    .admin-sidebar h2 {
        text-align: center;
    }
    .admin-nav {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
    }
    .admin-main {
        padding: 1rem !important;
    }
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    .admin-main header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start !important;
    }
    .admin-main header .flex {
        align-self: flex-start;
    }
}

/* --- Mobile Menu Styles --- */
@media (min-width: 993px) {
    .mobile-menu-btn, .mobile-close-btn, .mobile-overlay {
        display: none !important;
    }
    .mobile-sidebar {
        display: flex;
        flex: 1;
        justify-content: space-between;
        align-items: center;
        background: transparent;
        position: static;
        height: auto;
        width: auto;
        padding: 0;
        box-shadow: none;
        flex-direction: row;
        margin-left: 1.5rem;
    }
}

@media (max-width: 992px) {
    .mobile-menu-btn {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--primary-color);
        cursor: pointer;
        padding: 0.5rem;
    }
    .mobile-close-btn {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-primary);
        cursor: pointer;
        align-self: flex-end;
        padding: 0.5rem;
        margin-bottom: 1rem;
    }
    .mobile-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--surface-color);
        box-shadow: 5px 0 15px rgba(0,0,0,0.1);
        z-index: 1050;
        display: flex;
        flex-direction: column;
        padding: 1.5rem;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    .mobile-sidebar.open {
        left: 0;
    }
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }
    .mobile-overlay.open {
        display: block;
    }
    
    /* Ensure the main navbar container stays clean but wraps search on mobile */
    .navbar .container {
        flex-wrap: wrap;
    }
    .nav-brand {
        order: 0;
    }
    .mobile-menu-btn {
        order: 1;
    }
    .nav-search-wrapper {
        order: 3;
        width: 100%;
        margin-top: 1rem;
    }
    .nav-search-form {
        width: 100%;
    }
    
    /* Inside Sidebar Styles */
    .mobile-sidebar .nav-links,
    .mobile-sidebar .nav-actions {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .mobile-sidebar .nav-actions {
        border-top: 1px solid var(--border-color);
        padding-top: 1.5rem;
    }

    .mobile-sidebar #auth-links {
        flex-direction: column;
        align-items: flex-start !important;
        width: 100%;
    }
    .mobile-sidebar #auth-links .btn {
        width: 100%;
        justify-content: center;
    }
    
    .mobile-sidebar #user-menu {
        flex-direction: column;
        align-items: flex-start !important;
        width: 100%;
    }
    
    .mobile-sidebar #user-menu > div {
        width: 100%;
        position: static !important;
    }
    
    .mobile-sidebar #user-name {
        font-size: 1.1rem;
        color: var(--primary-color);
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--border-color);
        display: block;
        margin-bottom: 1rem;
        pointer-events: none;
    }
    
    .mobile-sidebar #user-menu > div > .card {
        display: flex !important;
        position: static !important;
        box-shadow: none !important;
        background: transparent !important;
        flex-direction: column;
        padding: 0 !important;
        margin: 0 !important;
        gap: 1rem;
    }
    
    .mobile-sidebar #user-menu .nav-link {
        padding: 0 !important;
    }
    
    /* Hide unwanted links from Sidebar on mobile */
    .mobile-sidebar .nav-links a:not([href="categories.html"]) {
        display: none !important;
    }
    .mobile-sidebar .nav-actions > a {
        display: none !important;
    }

    /* --- Mobile Bottom Nav --- */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: var(--surface-color);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        justify-content: space-around;
        padding: 0.5rem 0;
        border-top: 1px solid var(--border-color);
    }
    .mobile-bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-secondary);
        font-size: 0.75rem;
        text-decoration: none;
        gap: 0.25rem;
    }
    .mobile-bottom-nav .nav-item i {
        font-size: 1.25rem;
    }
    .mobile-bottom-nav .nav-item.active {
        color: var(--primary-color);
    }
    body {
        padding-bottom: 70px;
    }
}
/* Hide Bottom Nav on Desktop */
@media (min-width: 993px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}
