/* ============================================
   TPLESHOP - Base Template Stylesheet
   E-shop template for Joomla 6 + Phoca Cart 6
   ============================================ */

/* ----- 1. Fonts (self-hosted) ----- */

/* Inter - latin-ext (Slovak, Czech, Polish...) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Inter - latin */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Playfair Display - latin-ext */
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/playfair-display-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Playfair Display - latin */
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/playfair-display-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ----- 2. Custom Properties ----- */

:root {
    /* Colors - Base (neutral, theme-agnostic) */
    --color-primary: #1A1A1A;
    --color-primary-hover: #333333;
    --color-accent: #2563EB;
    --color-accent-hover: #1D4ED8;

    --color-white: #FFFFFF;
    --color-black: #000000;
    --color-gray-50: #F9FAFB;
    --color-gray-100: #F3F4F6;
    --color-gray-200: #E5E7EB;
    --color-gray-300: #D1D5DB;
    --color-gray-400: #9CA3AF;
    --color-gray-500: #6B7280;
    --color-gray-600: #4B5563;
    --color-gray-700: #374151;
    --color-gray-800: #1F2937;
    --color-gray-900: #111827;

    --color-success: #059669;
    --color-warning: #D97706;
    --color-danger: #DC2626;
    --color-info: #2563EB;

    /* Semantic colors */
    --color-body-bg: var(--color-white);
    --color-surface: var(--color-white);
    --color-surface-alt: var(--color-gray-50);
    --color-text: var(--color-gray-800);
    --color-text-muted: var(--color-gray-500);
    --color-heading: var(--color-gray-900);
    --color-border: var(--color-gray-200);
    --color-link: var(--color-primary);
    --color-link-hover: var(--color-primary-hover);

    /* Typography */
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;

    --line-height-tight: 1.2;
    --line-height-base: 1.6;
    --line-height-relaxed: 1.75;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Layout */
    --container-max: 1640px;
    --container-padding: 1.5rem;
    --header-height: 4.5rem;
    --sidebar-width: 300px;
    --product-columns: 3;

    /* Cards */
    --card-radius: 0.5rem;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --card-gap: 1.5rem;
    --card-image-ratio: 4 / 3;

    /* Borders */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-offcanvas-backdrop: 300;
    --z-offcanvas: 310;
    --z-modal: 400;
    --z-tooltip: 500;
    --z-back-to-top: 50;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;

    /* Color scheme */
    color-scheme: light;
}

/* ----- Dark Mode ----- */

[data-theme="dark"] {
    --color-body-bg: #0f0f0f;
    --color-surface: #1a1a1a;
    --color-surface-alt: #242424;
    --color-text: #d4d4d4;
    --color-text-muted: #8b8b8b;
    --color-heading: #f0f0f0;
    --color-border: #2e2e2e;
    --color-link: #d4d4d4;
    --color-link-hover: #ffffff;

    --color-gray-50: #1a1a1a;
    --color-gray-100: #242424;
    --color-gray-200: #2e2e2e;
    --color-gray-300: #404040;
    --color-gray-400: #6b6b6b;
    --color-gray-500: #8b8b8b;
    --color-gray-600: #a3a3a3;
    --color-gray-700: #d4d4d4;
    --color-gray-800: #e5e5e5;
    --color-gray-900: #f5f5f5;

    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);

    color-scheme: dark;
}

/* Dark mode - logo swap */
[data-theme="dark"] .es-logo--light {
    display: none;
}

[data-theme="dark"] .es-logo--dark {
    display: block;
}

/* Dark mode - bottom/footer (already dark, keep lighter in dark mode) */
[data-theme="dark"] .es-bottom {
    background: #111111;
}

[data-theme="dark"] .es-footer {
    background: #111111;
    border-top-color: #2e2e2e;
}

/* Dark mode - topbar */
[data-theme="dark"] .es-topbar {
    background: #111111;
}

/* Dark mode - forms & inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .inputbox {
    background-color: var(--color-surface-alt);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--color-text-muted);
}

/* Dark mode - Bootstrap components */
[data-theme="dark"] .btn-secondary {
    background-color: var(--color-surface-alt);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .btn-success {
    background-color: var(--color-success);
}

[data-theme="dark"] .btn-danger {
    background-color: var(--color-danger);
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--color-surface);
    border-color: var(--color-border);
}

[data-theme="dark"] .dropdown-item {
    color: var(--color-text);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--color-surface-alt);
    color: var(--color-heading);
}

[data-theme="dark"] .modal-content {
    background-color: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .modal-footer {
    border-top-color: var(--color-border);
}

[data-theme="dark"] .offcanvas {
    background-color: var(--color-surface);
    color: var(--color-text);
}

[data-theme="dark"] .offcanvas-header {
    border-bottom-color: var(--color-border);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Dark mode - tables */
[data-theme="dark"] table,
[data-theme="dark"] .table {
    color: var(--color-text);
    border-color: var(--color-border);
}

[data-theme="dark"] th,
[data-theme="dark"] td {
    border-color: var(--color-border);
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--color-surface-alt);
}

/* Dark mode - alerts */
[data-theme="dark"] .alert {
    border-color: var(--color-border);
}

/* Dark mode - Phoca Cart specific */
[data-theme="dark"] .ph-item-image-full-box,
[data-theme="dark"] .es-product-card__image,
[data-theme="dark"] .es-subcategory-card__image {
    background: var(--color-surface-alt);
}

[data-theme="dark"] .ph-stars {
    background: var(--color-gray-300);
}

/* Dark mode - Phoca Cart search box */
[data-theme="dark"] .phSearchBox input {
    background-color: var(--color-surface-alt);
    border-color: var(--color-border);
    color: var(--color-text);
}

/* Dark mode - scrollbar */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--color-surface);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 5px;
}

/* Dark mode - selection */
[data-theme="dark"] ::selection {
    background: var(--color-accent);
    color: var(--color-white);
}

/* Dark mode - images brightness (subtle) */
[data-theme="dark"] img {
    opacity: 0.92;
}

[data-theme="dark"] img:hover {
    opacity: 1;
}

/* ----- 3. Reset & Base ----- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text);
    background-color: var(--color-body-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}

ul,
ol {
    list-style: none;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-heading);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

/* ----- 4. Layout & Container ----- */

.es-container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-padding);
}

/* ----- 5. Header ----- */

.es-topbar {
    background: var(--color-gray-900);
    color: var(--color-gray-300);
    font-size: var(--font-size-sm);
    padding: var(--space-sm) 0;
}

.es-topbar a {
    color: var(--color-gray-300);
}

.es-topbar a:hover {
    color: var(--color-white);
}

.es-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    height: var(--header-height);
    position: relative;
    z-index: var(--z-sticky);
}

.es-header--sticky {
    position: sticky;
    top: 0;
}

.es-header__inner {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    height: var(--header-height);
}

.es-header__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--color-heading);
}

.es-hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 22px;
}

.es-hamburger span {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.es-header__logo {
    flex-shrink: 0;
}

.es-header__logo a {
    display: flex;
    align-items: center;
    color: var(--color-heading);
}

.es-header__logo img {
    height: 2.5rem;
    width: auto;
}

.es-logo--dark {
    display: none;
}

.es-header__site-name {
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    white-space: nowrap;
}

.es-header__nav {
    display: none;
    flex: 1;
    min-width: 0;
}

.es-header__nav ul {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    list-style: none;
    margin: 0;
    padding: 0;
}

.es-header__nav > ul > li {
    display: flex;
    align-items: center;
    position: relative;
}

.es-header__nav a {
    display: flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.es-header__nav a:hover,
.es-header__nav .active > a {
    background: var(--color-surface-alt);
    color: var(--color-heading);
}

/* Visually hidden (Joomla accessibility helper) */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Dropdown submenu (Bootstrap 5 based) */

.es-header__nav .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: var(--space-xs) 0;
    margin: 0;
    list-style: none;
    flex-direction: column;
}

.es-header__nav .dropdown-item {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.es-header__nav .dropdown-item:hover {
    background: var(--color-surface-alt);
    color: var(--color-heading);
}

/* Hover dropdown on desktop */
.es-header__nav .dropdown:hover > .dropdown-menu {
    display: block;
}

/* Dropdown toggle arrow */
.es-header__nav .dropdown-toggle::after {
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
    content: '';
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

/* Third-level submenu */
.es-header__nav .dropend > .dropdown-menu {
    top: 0;
    left: 100%;
}

.es-header__nav .dropend .dropdown-toggle::after {
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 4px solid;
    border-right: 0;
}

.es-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
}

/* Cart button in header */
.es-cart-btn-wrap {
    position: relative;
}

.es-cart-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: var(--space-xs) var(--space-sm);
    cursor: pointer;
    color: var(--color-text);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
    position: relative;
}

.es-cart-btn:hover {
    background: var(--color-surface-alt);
    color: var(--color-heading);
}

.es-cart-count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background: var(--color-primary, #c0392b);
    border-radius: 9px;
}

.es-cart-count:empty,
.es-cart-count:contains("0") {
    display: none;
}

/* Theme toggle button */
.es-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-text);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.es-theme-toggle:hover {
    background: var(--color-surface-alt);
    color: var(--color-heading);
}

/* Show/hide sun/moon icons */
.es-theme-toggle .es-icon-moon {
    display: block;
}

.es-theme-toggle .es-icon-sun {
    display: none;
}

[data-theme="dark"] .es-theme-toggle .es-icon-moon {
    display: none;
}

[data-theme="dark"] .es-theme-toggle .es-icon-sun {
    display: block;
}

/* Cart offcanvas styling */
#esCartOffcanvas {
    width: 380px;
    max-width: 90vw;
}

#esCartOffcanvas .offcanvas-header {
    border-bottom: 1px solid var(--color-border);
}

#esCartOffcanvas .offcanvas-body {
    padding: var(--space-md);
}

/* Sticky header shadow on scroll */
.es-header--sticky.is-scrolled {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ----- 6. Navbar Below ----- */

.es-navbar-below {
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-sm) 0;
}

/* ----- 7. Hero ----- */

.es-hero {
    overflow: hidden;
}

.es-hero--fullwidth {
    width: 100%;
}

.es-hero--contained {
    padding: var(--space-lg) 0;
}

.es-hero img {
    width: 100%;
    height: auto;
    display: block;
}

/* ----- 8. Breadcrumbs ----- */

.es-breadcrumbs {
    padding: var(--space-md) 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}

.es-breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
}

.es-breadcrumbs a {
    color: var(--color-text-muted);
}

.es-breadcrumbs a:hover {
    color: var(--color-heading);
}

/* ----- 9. Main Content Area ----- */

.es-main {
    padding: var(--space-2xl) 0;
    min-height: 50vh;
}

.es-content {
    display: grid;
    gap: var(--space-2xl);
}

.es-content--has-sidebar-left {
    grid-template-columns: var(--sidebar-width) 1fr;
}

.es-content--has-sidebar-right {
    grid-template-columns: 1fr var(--sidebar-width);
}

.es-content--has-sidebar-left.es-content--has-sidebar-right {
    grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
}

.es-content__main {
    min-width: 0;
}

.es-content-top,
.es-content-bottom {
    margin-bottom: var(--space-2xl);
}

.es-content-bottom {
    margin-bottom: 0;
    margin-top: var(--space-2xl);
}

.es-component-top {
    margin-bottom: var(--space-lg);
}

.es-component-bottom {
    margin-top: var(--space-lg);
}

/* ----- 10. Sidebar ----- */

.es-sidebar {
    min-width: 0;
}

.es-sidebar > * + * {
    margin-top: var(--space-lg);
}

/* ----- 11. Showcase Sections ----- */

.es-showcase {
    padding: var(--space-3xl) 0;
}

.es-showcase--1 {
    background: var(--color-surface-alt);
}

.es-showcase--2 {
    background: var(--color-surface);
}

.es-showcase--3 {
    background: var(--color-surface-alt);
}

/* ----- 12. Bottom ----- */

.es-bottom {
    background: var(--color-gray-900);
    color: var(--color-gray-300);
    padding: var(--space-3xl) 0;
}

.es-bottom a {
    color: var(--color-gray-300);
}

.es-bottom a:hover {
    color: var(--color-white);
}

.es-bottom h3,
.es-bottom h4,
.es-bottom h5 {
    color: var(--color-white);
}

.es-bottom__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
}

/* ----- 13. Footer ----- */

.es-footer {
    background: var(--color-gray-900);
    color: var(--color-gray-400);
    padding: var(--space-lg) 0;
    border-top: 1px solid var(--color-gray-800);
    font-size: var(--font-size-sm);
}

.es-footer a {
    color: var(--color-gray-400);
}

.es-footer a:hover {
    color: var(--color-white);
}

/* ----- 14. Module Chromes ----- */

/* wpmodule - Standard module with header */
.es-module {
    margin-bottom: var(--space-lg);
}

.es-module__header {
    margin-bottom: var(--space-md);
}

.es-module__title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
}

/* wpcard - Card style module */
.es-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.es-card__header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.es-card__title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.es-card__body {
    padding: var(--space-lg);
}

/* wpraw - No wrapper */

/* ----- 15. Buttons ----- */

.es-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

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

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

.es-btn--accent {
    background: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
}

.es-btn--accent:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: var(--color-white);
}

.es-btn--outline {
    background: transparent;
    color: var(--color-primary);
    border-color: var(--color-border);
}

.es-btn--outline:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.es-btn--sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-xs);
}

.es-btn--lg {
    padding: 1rem 2rem;
    font-size: var(--font-size-base);
}

.es-btn--block {
    display: flex;
    width: 100%;
}

/* ----- 16. Product Grid Base ----- */

.es-products {
    display: grid;
    grid-template-columns: repeat(var(--product-columns), 1fr);
    gap: var(--card-gap);
}

.es-product-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--card-radius);
    overflow: hidden;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.es-product-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.es-product-card__image {
    position: relative;
    aspect-ratio: var(--card-image-ratio);
    overflow: hidden;
    background: var(--color-gray-100);
}

.es-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.es-product-card:hover .es-product-card__image img {
    transform: scale(1.03);
}

.es-product-card__body {
    padding: var(--space-md);
}

.es-product-card__title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.es-product-card__title a {
    color: var(--color-heading);
}

.es-product-card__title a:hover {
    color: var(--color-primary);
}

.es-product-card__price {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-heading);
}

.es-product-card__price-old {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-decoration: line-through;
    font-weight: var(--font-weight-normal);
    margin-left: var(--space-sm);
}

.es-product-card__actions {
    margin-top: var(--space-md);
}

/* ----- 17. Badges & Labels ----- */

.es-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2em 0.6em;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-sm);
    line-height: 1;
}

.es-badge--sale {
    background: var(--color-danger);
    color: var(--color-white);
}

.es-badge--new {
    background: var(--color-success);
    color: var(--color-white);
}

/* ----- 18. Error & Offline Pages ----- */

.es-error,
.es-offline {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-2xl);
    text-align: center;
}

.es-error__inner,
.es-offline__inner {
    max-width: 480px;
}

.es-error__code {
    font-size: 8rem;
    font-weight: var(--font-weight-bold);
    line-height: 1;
    color: var(--color-gray-200);
    margin-bottom: var(--space-md);
}

.es-error__message {
    font-size: var(--font-size-xl);
    color: var(--color-text-muted);
    margin-bottom: var(--space-2xl);
}

.es-offline__form {
    text-align: left;
    margin-top: var(--space-2xl);
}

.es-offline__form label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-xs);
    margin-top: var(--space-md);
}

.es-offline__form input[type="text"],
.es-offline__form input[type="password"] {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-size: var(--font-size-base);
    transition: border-color var(--transition-fast);
}

.es-offline__form input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.es-offline__form .es-btn {
    margin-top: var(--space-lg);
    width: 100%;
}

/* ----- 19. Offcanvas ----- */

.es-offcanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 85vw);
    height: 100%;
    background: var(--color-surface);
    z-index: var(--z-offcanvas);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.es-offcanvas.is-open {
    transform: translateX(0);
}

.es-offcanvas__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    min-height: var(--header-height);
    flex-shrink: 0;
}

.es-offcanvas__title {
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-heading);
}

.es-offcanvas__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.es-offcanvas__close:hover {
    background: var(--color-surface-alt);
    color: var(--color-heading);
}

.es-offcanvas__body {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    overflow-y: auto;
}

.es-offcanvas__body ul {
    display: flex;
    flex-direction: column;
}

.es-offcanvas__body a {
    display: block;
    padding: var(--space-md) 0;
    color: var(--color-text);
    font-weight: var(--font-weight-medium);
    border-bottom: 1px solid var(--color-border);
}

.es-offcanvas__body a:hover,
.es-offcanvas__body .active > a {
    color: var(--color-primary);
}

.es-offcanvas-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-offcanvas-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.es-offcanvas-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ----- 20. Back to Top ----- */

.es-back-to-top {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    color: var(--color-heading);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    box-shadow: var(--card-shadow);
    z-index: var(--z-back-to-top);
    opacity: 0;
    visibility: hidden;
    transform: translateY(1rem);
    transition: opacity var(--transition-base), visibility var(--transition-base), transform var(--transition-base), background var(--transition-fast);
}

.es-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.es-back-to-top:hover {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

/* ----- 21. System Messages ----- */

.es-main #system-message-container {
    margin-bottom: var(--space-lg);
}

/* ----- 22. Responsive ----- */

/* Tablet */
@media (min-width: 768px) {
    .es-bottom__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .es-products {
        grid-template-columns: repeat(min(var(--product-columns), 2), 1fr);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    :root {
        --container-padding: 2rem;
    }

    .es-header__toggle {
        display: none;
    }

    .es-header__nav {
        display: flex;
    }

    .es-bottom__grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .es-products {
        grid-template-columns: repeat(var(--product-columns), 1fr);
    }

    /* Sidebar: on mobile stack vertically */
    .es-content--has-sidebar-left,
    .es-content--has-sidebar-right,
    .es-content--has-sidebar-left.es-content--has-sidebar-right {
        grid-template-columns: var(--sidebar-width) 1fr;
    }

    .es-content--has-sidebar-right:not(.es-content--has-sidebar-left) {
        grid-template-columns: 1fr var(--sidebar-width);
    }

    .es-content--has-sidebar-left.es-content--has-sidebar-right {
        grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
    }
}

/* Mobile - stack sidebars */
@media (max-width: 1023px) {
    .es-content--has-sidebar-left,
    .es-content--has-sidebar-right,
    .es-content--has-sidebar-left.es-content--has-sidebar-right {
        grid-template-columns: 1fr;
    }

    .es-sidebar--left {
        order: 2;
    }

    .es-content__main {
        order: 1;
    }

    .es-sidebar--right {
        order: 3;
    }
}

/* Large screens */
@media (min-width: 1280px) {
    h1 { font-size: var(--font-size-5xl); }
    h2 { font-size: var(--font-size-4xl); }
    h3 { font-size: var(--font-size-3xl); }
}
