:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #64748b;
  --color-border: #e5e5e5;
  --color-surface: #ffffff;
  --color-surface-alt: #f5f5f5;
  --color-accent: #000000; /* arated.com primary: black */
  --color-accent-hover: #333333;
  --color-accent-contrast: #ffffff; /* text on black */
  --color-footer-bg: #000000;
  --color-footer-text: #cbd5e1;
  --color-footer-heading: #ffffff;
  --color-footer-link: #ffffff;
}

/* Dark theme variables */
:root.theme-dark {
  --color-bg: #0b0b0c;
  --color-text: #e5e7eb;
  --color-muted: #9aa3b2;
  --color-border: #26272b;
  --color-surface: #141417;
  --color-surface-alt: #1a1b1f;
  --color-accent: #ffffff;
  --color-accent-hover: #e5e5e5;
  --color-accent-contrast: #000000;
  --color-footer-bg: #0b0b0c;
  --color-footer-text: #9aa3b2;
  --color-footer-heading: #ffffff;
  --color-footer-link: #ffffff;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation - Arated.com style */
.navbar {
    background: var(--color-surface);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-bottom: 1px solid var(--color-border);
}

.navbar.navbar-scrolled {
  background: var(--color-surface);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    width: 100%;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    min-width: 120px;
}

.nav-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    min-height: 40px; /* Ensure minimum height */
    gap: 10px;
}

.nav-logo img {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease;
    max-width: 100%; /* Ensure image doesn't overflow */
}

.nav-logo img:hover {
    transform: scale(1.05);
}

/* SVG logo styling */
.nav-logo svg {
    transition: transform 0.3s ease;
}

.nav-logo svg:hover {
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Header search like Amazon */
.nav-search {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 20px;
}

.nav-search .search-bar {
    display: flex;
    width: 100%;
    max-width: 700px;
    gap: 0; /* ensure no gap between input and select */
    border: 2px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden; /* unify rounded corners */
    background: var(--color-surface);
    align-items: stretch;
    position: relative; /* for custom dropdown arrow */
}

.nav-search input[type="text"] {
    flex: 1;
    padding: 10px 12px;
    border: 0;
    border-right: 0; /* no divider */
    border-radius: 0;
    background: transparent;
    color: var(--color-text);
    margin: 0;
    height: 40px;
    line-height: 40px;
    -webkit-appearance: none;
    appearance: none;
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.nav-search .category-select select {
    padding: 10px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: transparent; /* hide native value to avoid ghosting with overlay */
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 40px;
    line-height: 40px;
    -webkit-border-radius: 0;
    -moz-border-radius: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    min-width: 160px; /* ensure placeholder text is visible */
    padding-right: 32px; /* space for dropdown chevron */
    flex: 0 0 160px; /* keep visible width even in flex shrink */
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Ensure options in the OS popup remain readable */
.nav-search .category-select select option { color: var(--color-text); }

/* Keep overlay visible even when the select is focused */
.nav-search .category-select select:focus { color: transparent; }

.nav-search .category-select select option[disabled] {
    color: var(--color-muted);
}

.nav-search .search-bar input,
.nav-search .category-select select {
    border-radius: 0 !important; /* enforce no inner rounding */
}

.nav-search .search-bar > * {
    margin: 0;
}

.nav-search input[type="text"]:focus,
.nav-search select:focus {
    outline: none;
    box-shadow: none;
}

/* Custom dropdown chevron */
.nav-search .category-select::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--color-muted);
  pointer-events: none; /* allow clicks to pass to select */
}

/* Visible text overlay for selected category to ensure cross-browser rendering */
.nav-search .category-select {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-search .category-display {
  position: absolute;
  left: 12px; /* align text to the left inside the select area */
  top: 50%;
  transform: translateY(-50%);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
  pointer-events: none; /* clicks go to the select */
  font-size: 0.95rem;
}

.nav-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    padding: 1rem 0;
    transition: color 0.3s ease;
    position: relative;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.admin-link {
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.admin-link:hover {
    background: var(--color-accent-hover);
    color: var(--color-accent-contrast);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--color-text);
    margin: 3px 0;
    transition: 0.3s;
}

/* Hero Section - Arated.com style */
.hero {
    background: linear-gradient(135deg, var(--color-surface-alt) 0%, var(--color-surface) 100%);
    padding: 4rem 0;
    color: var(--color-text);
}

.hero.hidden {
  display: none;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: var(--color-text);
}

.hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--color-muted);
    line-height: 1.6;
}

.cta-button {
    display: inline-block;
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.cta-button:hover {
    background: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image-placeholder {
    width: 300px;
    height: 300px;
    background:
        radial-gradient(120% 120% at 80% 20%, rgba(0,0,0,0.08), rgba(0,0,0,0) 60%),
        repeating-linear-gradient(135deg, rgba(0,0,0,0.04) 0, rgba(0,0,0,0.04) 8px, rgba(0,0,0,0) 8px, rgba(0,0,0,0) 16px),
        var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
    font-size: 4rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

/* Products Section - Arated.com style */
.products-section {
    padding: 4rem 0;
    background: var(--color-surface-alt);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.section-header p {
    font-size: 1.1rem;
    color: var(--color-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Products controls (search + market filter) */
.products-controls {
    display: flex;
    justify-content: center;
    margin: 1rem 0 0.5rem;
}

.search-bar {
    display: flex;
    gap: 0.75rem;
}

.search-bar input[type="text"],
.search-bar select {
    background: var(--color-surface);
    border: 2px solid #e2e8f0;
    color: var(--color-text);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.search-bar input[type="text"]:focus,
.search-bar select:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* Filters - Arated.com style */
.filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}


/* Products Grid - Arated.com style */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Force 4 columns on large screens when space allows */
@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.product-card {
    background: var(--color-surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    border: 1px solid var(--color-border);
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
    border-color: var(--color-accent);
}

.product-image {
    height: 250px;
    background: var(--color-surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    font-size: 3rem;
    position: relative;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 1.5rem;
}

.product-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-description {
    color: var(--color-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #059669;
    margin-bottom: 1rem;
}

.buy-now-btn {
    width: 100%;
    background: var(--color-accent);
    color: var(--color-accent-contrast);
    border: none;
    padding: 0.875rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.buy-now-btn:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}

/* About Section - Arated.com style */
.about-section {
    padding: 4rem 0;
    background: var(--color-surface);
}

.about-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.about-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1.5rem;
}

.about-content > p {
    font-size: 1.1rem;
    color: var(--color-muted);
    margin-bottom: 3rem;
    line-height: 1.6;
}

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

.feature {
    text-align: center;
    padding: 2rem;
    background: var(--color-surface-alt);
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.feature i {
    font-size: 2.5rem;
    color: var(--color-accent);
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.feature p {
    color: var(--color-muted);
    line-height: 1.5;
}

/* Footer - Arated.com style */
.footer {
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

.footer-section h3 {
    color: var(--color-footer-heading);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-section h4 {
    color: var(--color-footer-heading);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section a {
    color: var(--color-footer-text);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--color-footer-link);
}

.footer-bottom {
    border-top: 0;
    padding-top: 1rem;
    text-align: center;
    color: var(--color-footer-text);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.footer-branding {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 0;
    text-align: center;
}

.footer-branding p {
    color: var(--color-footer-text);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-branding a {
    color: var(--color-footer-link);
    text-decoration: none;
    font-weight: 600;
}

.footer-branding a:hover {
    text-decoration: underline;
}

/* Footer theme toggle */
.footer-theme-row {
  border-top: 0;
  padding: 1rem 0;
  margin-top: 0.5rem;
}

.footer-theme-row .container {
  display: flex;
  justify-content: center;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--color-accent);
}

.theme-toggle i {
  width: 1rem;
  text-align: center;
}

/* Modal - Arated.com style */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--color-surface);
    margin: 5% auto;
    padding: 1.25rem;
    padding-top: 3rem; /* leave room for close button */
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-alt);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close:hover {
    background: var(--color-border);
    color: var(--color-text);
}

/* Loading and Error States */
.loading, .error-message, .no-products {
    text-align: center;
    grid-column: 1 / -1;
    padding: 3rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-surface-alt);
    border-top: 4px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px; /* height of navbar */
        flex-direction: column;
        background-color: var(--color-surface);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0,0,0,0.05);
        padding: 2rem 0;
        z-index: 1500; /* above category bar */
        border-bottom: 1px solid var(--color-border);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-search { display: none; }
    .nav-search.mobile-search {
        display: block; /* show mobile search container */
        padding: 10px 20px;
        border-top: 1px solid var(--color-border);
        border-bottom: 1px solid var(--color-border);
        background: var(--color-surface);
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-image-placeholder {
        width: 250px;
        height: 250px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .features {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .brand-word { font-size: 0.95rem; }
}


/* Ensure page content doesn't hide under sticky navbar */
.hero { 
    margin-top: 0; 
    display: none; /* Hide hero container */
}
body { scroll-padding-top: 80px; /* navbar only */ }

.modal-product-info .modal-links { display: flex; flex-direction: column; gap: 0.5rem; }
.modal-product-info .modal-buy-btn { width: 100%; }

.brand-word {
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--color-text);
}

/* Utility: visually hidden (for accessible labels) */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap; /* added line */
}
