/**
 * mystartup24 - Desktop Styles
 *
 * Mobile-First Responsive Design with full-width layout.
 * Supports Dark Mode via .dark class on <html>.
 *
 * Layout System:
 * - Mobile (< 1024px): Single column, full width
 * - Desktop (1024-1279px): 2 columns (content + right sidebar)
 * - Large (1280px+): 3 columns (left sidebar + content + right sidebar)
 */

/* ============================================
   CSS Custom Properties
   ============================================ */

:root {
    /* Layout */
    --header-height: 56px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);

    /* Sidebar Widths */
    --sidebar-left-width: 0px;
    --sidebar-right-width: 0px;

    /* Content */
    --content-max-width: 100%;
    --page-padding-x: 1rem;
    --page-padding-y: 1.5rem;
    --content-gap: 1.5rem;
}

/* Tablet: 640px+ */
@media (min-width: 640px) {
    :root {
        --page-padding-x: 1.5rem;
    }
}

/* Desktop: 1024px+ - 2 columns */
@media (min-width: 1024px) {
    :root {
        --sidebar-right-width: 280px;
        --page-padding-x: 2rem;
        --page-padding-y: 2rem;
        --content-gap: 2rem;
    }
}

/* Large Desktop: 1280px+ - 3 columns */
@media (min-width: 1280px) {
    :root {
        --sidebar-left-width: 220px;
        --sidebar-right-width: 300px;
        --page-padding-x: 2.5rem;
    }
}

/* XL Desktop: 1536px+ */
@media (min-width: 1536px) {
    :root {
        --sidebar-left-width: 240px;
        --sidebar-right-width: 320px;
        --page-padding-x: 3rem;
    }
}

/* 2K+ Desktop: 1920px+ */
@media (min-width: 1920px) {
    :root {
        --content-max-width: 1800px;
        --sidebar-left-width: 260px;
        --sidebar-right-width: 340px;
        --page-padding-x: 3rem;
    }
}

/* Sticky-Offset Utility */
.sticky-below-header {
    position: sticky;
    top: var(--header-height);
    z-index: 30;
}

/* ============================================
   Base Styles
   ============================================ */

body {
    background-color: #f8fafc; /* gray-50 — matches content area */
    min-height: 100vh;
}

.dark body,
html.dark body {
    background-color: #030712; /* gray-950 */
}

/* ============================================
   App Wrapper (Responsive Centering)
   ============================================ */

.app-wrapper {
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 100%;
    background-color: #ffffff;
    margin: 0;
}

html.dark .app-container {
    background-color: #111827; /* gray-900 */
}

/* ============================================
   Large Screen Container Centering
   ============================================ */

@media (min-width: 1920px) {
    .app-container {
        max-width: var(--content-max-width);
        margin: 0 auto;
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.04);
    }

    html.dark .app-container {
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.3);
    }
}

/* ============================================
   Header Styles
   ============================================ */

.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

html.dark .app-header {
    background-color: #111827;
    border-bottom-color: #1f2937;
}

.app-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--page-padding-x);
    max-width: var(--content-max-width);
    margin: 0 auto;
}

/* ============================================
   Page Layout Grid System
   ============================================ */

.page-layout {
    display: flex;
    flex-direction: column;
    gap: var(--content-gap);
    padding: var(--page-padding-y) var(--page-padding-x);
    max-width: var(--content-max-width);
    margin: 0 auto;
}

/* Single column layout for text-heavy pages */
.page-layout-single {
    display: block;
    max-width: 48rem; /* 768px */
    margin: 0 auto;
    padding: var(--page-padding-y) var(--page-padding-x);
}

/* Desktop: 2 columns (content + right sidebar) */
@media (min-width: 1024px) {
    .page-layout {
        display: grid;
        grid-template-columns: 1fr var(--sidebar-right-width);
        grid-template-areas: "main sidebar-right";
    }

    .page-layout-single {
        display: block;
    }

    .page-layout > .main-content {
        grid-area: main;
        min-width: 0;
    }

    .page-layout > .sidebar-right {
        grid-area: sidebar-right;
    }
}

/* Tablet: center main-content for better readability (no sidebar visible) */
@media (min-width: 640px) and (max-width: 1023px) {
    .page-layout-3col > .main-content {
        max-width: 42rem; /* 672px */
        margin-left: auto;
        margin-right: auto;
    }
}

/* Large Desktop: 3 columns */
@media (min-width: 1280px) {
    .page-layout-3col {
        grid-template-columns: var(--sidebar-left-width) 1fr var(--sidebar-right-width);
        grid-template-areas: "sidebar-left main sidebar-right";
    }

    .page-layout-3col > .sidebar-left {
        grid-area: sidebar-left;
    }
}

/* ============================================
   Settings Layout (sidebar + content)
   ============================================ */

.settings-layout {
    display: flex;
    flex-direction: column;
    padding: var(--page-padding-y) var(--page-padding-x);
    max-width: var(--content-max-width);
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .settings-layout {
        display: grid;
        grid-template-columns: 220px 1fr;
        gap: 2.5rem;
        max-width: 56rem; /* 896px - comfortable for settings */
    }
}

.settings-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .settings-sidebar {
        display: block;
        position: sticky;
        top: calc(var(--header-height) + 1rem);
        height: fit-content;
    }
}

.settings-sidebar-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
}

html.dark .settings-sidebar-title {
    color: #6b7280;
}

/* Tablet: constrain form width for better readability */
@media (min-width: 768px) and (max-width: 1023px) {
    .settings-content-tablet {
        max-width: 36rem; /* 576px */
        margin-left: auto;
        margin-right: auto;
    }
}

/* ============================================
   Content Wrapper (for full-width sections)
   ============================================ */

.content-wrapper {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding-inline: var(--page-padding-x);
}

/* ============================================
   Footer Styles
   ============================================ */

.app-footer {
    width: 100%;
}

/* ============================================
   Sidebar Styles
   ============================================ */

.sidebar {
    display: none;
}

.sidebar-left,
.sidebar-right {
    display: none;
}

@media (min-width: 1024px) {
    .sidebar-right {
        display: block;
        position: sticky;
        top: calc(var(--header-height) + 1rem);
        height: fit-content;
        max-height: calc(100vh - var(--header-height) - 2rem);
        overflow-y: auto;
        overflow-x: hidden;
        min-width: 0;
        scrollbar-width: thin;
    }
}

@media (min-width: 1280px) {
    .sidebar-left {
        display: block;
        position: sticky;
        top: calc(var(--header-height) + 1rem);
        height: fit-content;
    }
}

/* Sidebar Cards */
.sidebar-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

html.dark .sidebar-card {
    background-color: #1f2937;
    border-color: #374151;
}

.sidebar-card:last-child {
    margin-bottom: 0;
}

.sidebar-card-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

html.dark .sidebar-card-title {
    color: #9ca3af;
}

/* Sidebar Flat Sections (no card background) */
.sidebar-section {
    padding: 0;
}

.sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
    padding: 0 0.5rem;
}

html.dark .sidebar-section-title {
    color: #6b7280;
}

.sidebar-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0.75rem 0.5rem;
    flex-shrink: 0;
}

html.dark .sidebar-divider {
    background-color: #374151;
}

/* "Show more/less" toggle button */
.sidebar-toggle-btn {
    color: #6b7280;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
}

.sidebar-toggle-btn:hover {
    color: #2563eb;
    background-color: #f3f4f6;
}

html.dark .sidebar-toggle-btn {
    color: #9ca3af;
}

html.dark .sidebar-toggle-btn:hover {
    color: #93c5fd;
    background-color: #374151;
}

/* Sidebar Navigation Links */
.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    margin: 0 -0.75rem;
    font-size: 0.875rem;
    color: #374151;
    border-radius: 0.5rem;
    transition: background-color 0.15s, color 0.15s;
}

/* Compact variant for flat sidebar */
.sidebar-nav-link-compact {
    padding: 0.375rem 0.5rem;
    margin: 0;
    font-size: 0.8125rem;
    gap: 0.5rem;
    border-radius: 0.375rem;
}

.sidebar-nav-link:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.sidebar-nav-link.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

html.dark .sidebar-nav-link {
    color: #d1d5db;
}

html.dark .sidebar-nav-link:hover {
    background-color: #374151;
    color: #f9fafb;
}

html.dark .sidebar-nav-link.active {
    background-color: #1e3a8a;
    color: #93c5fd;
}

/* Sidebar Mini Product Card */
.sidebar-product {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.sidebar-product:not(:last-child) {
    border-bottom: 1px solid #f3f4f6;
}

html.dark .sidebar-product:not(:last-child) {
    border-bottom-color: #374151;
}

.sidebar-product-logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-product-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html.dark .sidebar-product-name {
    color: #f9fafb;
}

.sidebar-product-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

html.dark .sidebar-product-meta {
    color: #9ca3af;
}

/* ============================================
   Form Input Styles (Touch-optimized)
   ============================================ */

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    min-height: 48px;
    font-size: 1rem;
    line-height: 1.5;
    color: #111827;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-input::placeholder {
    color: #9ca3af;
}

html.dark .form-input {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #f9fafb;
}

html.dark .form-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

html.dark .form-input::placeholder {
    color: #6b7280;
}

/* Textarea */
.form-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

html.dark .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
    width: 1.25rem;
    height: 1.25rem;
    color: #2563eb;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    cursor: pointer;
    flex-shrink: 0;
}

.form-radio {
    border-radius: 50%;
}

html.dark .form-checkbox,
html.dark .form-radio {
    border-color: #4b5563;
    background-color: #1f2937;
}

/* Button */
.form-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1.5rem;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.form-button:active {
    transform: scale(0.98);
}

.form-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.form-button-primary {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
}

.form-button-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

html.dark .form-button-primary {
    background-color: #3b82f6;
}

html.dark .form-button-primary:hover:not(:disabled) {
    background-color: #60a5fa;
}

.form-button-secondary {
    background-color: transparent;
    color: #374151;
    border: 1px solid #d1d5db;
}

.form-button-secondary:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

html.dark .form-button-secondary {
    color: #d1d5db;
    border-color: #4b5563;
}

html.dark .form-button-secondary:hover:not(:disabled) {
    background-color: #374151;
}

/* ============================================
   Utility: Hide Scrollbar
   ============================================ */

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ============================================
   Auth Pages Override
   ============================================ */

body.bg-gradient-to-br {
    background: linear-gradient(to bottom right, #2563eb, #1e40af) !important;
}

html.dark body.bg-gradient-to-br {
    background: linear-gradient(to bottom right, #1e3a8a, #0f172a) !important;
}

body.bg-gradient-to-br .app-wrapper {
    background: transparent;
}

body.bg-gradient-to-br .app-container {
    background: transparent;
    box-shadow: none;
}

html.dark body.bg-gradient-to-br .app-container {
    background: transparent;
}

/* ============================================
   Utility: browser-only / app-only
   ============================================ */

.app-only {
    display: none !important;
}

/* ============================================
   Bottom Navigation Bar (hidden by default)
   ============================================ */

.app-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    align-items: center;
    justify-content: space-around;
    z-index: 50;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

html.dark .app-bottom-nav {
    background: #111827;
    border-top-color: #1f2937;
}

/* ============================================
   PWA Standalone Mode (CSS Media Query)
   ============================================ */

@media (display-mode: standalone), (display-mode: fullscreen) {
    :root {
        --header-height: calc(56px + env(safe-area-inset-top, 0px));
        --bottom-nav-height: 60px;
        /* Reset sidebars for PWA mode */
        --sidebar-left-width: 0px;
        --sidebar-right-width: 0px;
        --content-max-width: 100%;
        --page-padding-x: 1rem;
    }

    /* Full-width, no container effect */
    .app-container {
        max-width: 100% !important;
        box-shadow: none !important;
        margin: 0 !important;
    }

    body {
        padding: 0 !important;
        overscroll-behavior-y: contain;
    }

    /* Reserve space for bottom nav */
    .app-main-content {
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    }

    /* Hide sidebars in PWA mode */
    .sidebar-left,
    .sidebar-right {
        display: none !important;
    }

    /* Page layout becomes single column */
    .page-layout {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: unset !important;
    }

    /* Show bottom nav */
    .app-bottom-nav {
        display: flex !important;
    }

    /* Hide browser-only elements */
    .browser-only {
        display: none !important;
    }

    /* Show app-only elements */
    .app-only {
        display: flex !important;
    }

    /* Hide footer in PWA */
    .app-footer {
        display: none !important;
    }

    /* Status bar blur overlay (iOS notch) */
    header::before {
        content: '';
        position: absolute;
        top: calc(-1 * env(safe-area-inset-top, 0px));
        left: 0;
        right: 0;
        height: env(safe-area-inset-top, 0px);
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        z-index: 1;
    }

    html.dark header::before {
        background: rgba(17, 24, 39, 0.85);
    }

    /* Touch targets */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    input[type="number"],
    input[type="tel"],
    textarea,
    select {
        min-height: 48px;
        font-size: 16px; /* Prevent auto-zoom on iOS */
    }

    button,
    [role="button"],
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================
   PWA Standalone: Landscape Mode
   ============================================ */

@media (display-mode: standalone) and (orientation: landscape) {
    .app-container {
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    .app-bottom-nav {
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }
}

/* ============================================
   PWA Standalone: JS-Class Fallback
   (Enables Playwright testing)
   ============================================ */

html.pwa-standalone .app-container {
    max-width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
}

html.pwa-standalone body {
    padding: 0 !important;
    overscroll-behavior-y: contain;
}

html.pwa-standalone .app-main-content {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
}

/* Hide sidebars in PWA mode */
html.pwa-standalone .sidebar-left,
html.pwa-standalone .sidebar-right {
    display: none !important;
}

/* Page layout becomes single column */
html.pwa-standalone .page-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
}

html.pwa-standalone .app-bottom-nav {
    display: flex !important;
}

html.pwa-standalone .browser-only {
    display: none !important;
}

html.pwa-standalone .app-only {
    display: flex !important;
}

/* Hide footer in PWA */
html.pwa-standalone .app-footer {
    display: none !important;
}

html.pwa-standalone header::before {
    content: '';
    position: absolute;
    top: calc(-1 * env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1;
}

html.pwa-standalone.dark header::before {
    background: rgba(17, 24, 39, 0.85);
}

html.pwa-standalone input[type="text"],
html.pwa-standalone input[type="email"],
html.pwa-standalone input[type="password"],
html.pwa-standalone input[type="search"],
html.pwa-standalone input[type="url"],
html.pwa-standalone input[type="number"],
html.pwa-standalone input[type="tel"],
html.pwa-standalone textarea,
html.pwa-standalone select {
    min-height: 48px;
    font-size: 16px;
}

html.pwa-standalone button,
html.pwa-standalone [role="button"],
html.pwa-standalone .btn {
    min-height: 44px;
    min-width: 44px;
}

/* Landscape fallback */
html.pwa-standalone .app-container {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* ============================================
   Keyboard Open: Hide Bottom Nav
   ============================================ */

html.keyboard-open .app-bottom-nav {
    display: none !important;
}

html.keyboard-open .app-main-content {
    padding-bottom: 0;
}

/* ============================================
   Pull-to-Refresh Indicator
   ============================================ */

.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    width: 40px;
    height: 40px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease-out;
    z-index: 9999;
}

html.dark .ptr-indicator {
    background: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.ptr-icon {
    width: 20px;
    height: 20px;
    color: #3b82f6;
    transition: transform 0.15s;
}

.ptr-indicator.ptr-ready .ptr-icon {
    color: #10b981;
}

.ptr-indicator.ptr-refreshing .ptr-icon {
    animation: ptr-spin 0.8s linear infinite;
}

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

/* ============================================
   Micro-Interactions (Phase 5)
   ============================================ */

/* Product card hover lift */
[data-testid="product-card"] {
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

[data-testid="product-card"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

html.dark [data-testid="product-card"]:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Upvote button pop animation */
[data-testid="upvote-button"] {
    transition: transform 0.12s ease-out, background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

[data-testid="upvote-button"]:active {
    transform: scale(0.92);
}

[data-testid="upvote-button"].upvote-pop {
    animation: upvote-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes upvote-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.15); }
    70%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Staggered card entrance */
[data-testid="product-card"] {
    animation: fade-in-up 0.3s ease-out both;
}

[data-testid="product-card"]:nth-child(1) { animation-delay: 0ms; }
[data-testid="product-card"]:nth-child(2) { animation-delay: 50ms; }
[data-testid="product-card"]:nth-child(3) { animation-delay: 100ms; }
[data-testid="product-card"]:nth-child(4) { animation-delay: 150ms; }
[data-testid="product-card"]:nth-child(5) { animation-delay: 200ms; }
[data-testid="product-card"]:nth-child(n+6) { animation-delay: 250ms; }

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Filter tab active indicator transition */
.filter-tab {
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Category pill hover scale */
a[href*="category="] {
    transition: transform 0.12s ease-out, border-color 0.15s, background-color 0.15s;
}

a[href*="category="]:hover {
    transform: scale(1.02);
}

/* Top categories card hover */
.grid a[href*="category="] {
    transition: transform 0.15s ease-out, border-color 0.15s, box-shadow 0.15s;
}

.grid a[href*="category="]:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

html.dark .grid a[href*="category="]:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Smooth section entrance with IntersectionObserver */
.section-animate {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.section-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Dark Mode Toggle Button
   ============================================ */

[data-testid="dark-mode-toggle"] {
    min-width: 44px;
    min-height: 44px;
}

[data-testid="dark-mode-toggle"]:active {
    transform: scale(0.95);
}

/* Smooth dark mode transitions */
html.transitioning *,
html.transitioning *::before,
html.transitioning *::after {
    transition: background-color 0.2s ease,
                color 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.2s ease !important;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    [data-testid="product-card"],
    [data-testid="upvote-button"],
    a[href*="category="],
    .grid a[href*="category="],
    .section-animate {
        animation: none !important;
        transition: none !important;
    }

    [data-testid="product-card"]:hover,
    .grid a[href*="category="]:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}
