:root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --ink: #222222;
    --muted: #777777;
    --line: #eeeeee;
    --accent: #ff4747;
    --accent-dark: #e43232;
    --accent-2: #ff6a00;
    --soft: #fff3ed;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto minmax(260px, 680px) auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px clamp(16px, 4vw, 52px);
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(12px);
}

.admin-header {
    grid-template-columns: auto 1fr;
}

.brand {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    color: var(--accent);
    font-size: 24px;
    font-weight: 900;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    border-radius: 7px;
    box-shadow: 0 8px 18px rgba(255, 71, 71, 0.25);
}

.search {
    display: grid;
    grid-template-columns: 1fr auto;
    overflow: hidden;
    background: var(--surface);
    border: 2px solid var(--accent);
    border-radius: 999px;
}

.search input,
.search button,
.cart-button,
.categories button,
.toolbar select,
.product-card button,
.checkout {
    min-height: 42px;
    border: 0;
    font: inherit;
}

.search input {
    width: 100%;
    padding: 0 18px;
    background: transparent;
    color: var(--ink);
    outline: none;
}

.search button,
.cart-button,
.product-card button,
.checkout,
.auth-card button,
.settings-form > button {
    padding: 0 18px;
    color: #fff;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}

.search button {
    min-width: 112px;
    border-radius: 0;
}

.search button:hover,
.cart-button:hover,
.product-card button:hover,
.checkout:hover,
.auth-card button:hover,
.settings-form > button:hover {
    background: linear-gradient(90deg, #ff7a1a, var(--accent-dark));
}

.cart-button {
    justify-self: end;
    min-height: 38px;
}

.cart-button span {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    margin-left: 6px;
    color: var(--accent);
    background: #fff;
    border-radius: 999px;
    font-weight: 800;
}

.account-nav {
    display: inline-flex;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.account-nav a {
    color: #444;
    font-weight: 700;
    text-decoration: none;
}

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

.language-form {
    margin: 0;
}

.language-form label {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.language-form select,
.settings-section select {
    min-height: 34px;
    padding: 0 8px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}

main {
    width: min(1240px, calc(100% - 28px));
    margin: 0 auto;
    padding: 18px 0 70px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 18px;
    align-items: end;
    min-height: 300px;
    padding: clamp(24px, 5vw, 54px);
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.35), transparent 24%),
        linear-gradient(115deg, #ff2d2d 0%, #ff6a00 52%, #ffb000 100%);
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(255, 71, 71, 0.2);
}

.eyebrow {
    margin: 0 0 10px;
    color: #fff8db;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 720px;
    margin: 0;
    font-size: clamp(34px, 5vw, 60px);
    line-height: 1;
    letter-spacing: 0;
}

.hero-copy {
    max-width: 600px;
    margin: 18px 0 0;
    color: #fff9ef;
    font-size: 18px;
    line-height: 1.5;
}

.hero-panel {
    padding: 18px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--ink);
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(130, 43, 0, 0.16);
}

.hero-panel span,
.hero-panel small {
    display: block;
    color: var(--muted);
}

.hero-panel strong {
    display: block;
    margin: 8px 0;
    color: var(--accent);
    font-size: 44px;
}

.categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 16px 0;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.categories button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 13px;
    color: #555;
    background: #f8f8f8;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
}

.categories button.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 5px 14px rgba(255, 71, 71, 0.2);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: end;
    margin: 18px 0 14px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.toolbar h2 {
    margin: 0 0 4px;
    font-size: 22px;
}

.toolbar p {
    margin: 0;
    color: var(--muted);
}

.toolbar select {
    padding: 0 12px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.product-card {
    display: grid;
    grid-template-rows: 190px 1fr;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: 10px;
    transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.product-card:hover {
    border-color: #ffd3c1;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.10);
    transform: translateY(-2px);
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #f7f7f7;
}

.product-info {
    display: grid;
    gap: 9px;
    padding: 11px;
}

.product-info h3 {
    min-height: 40px;
    margin: 0;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
}

.meta,
.price-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.meta,
.price-row span {
    color: var(--muted);
    font-size: 12px;
}

.price-row strong {
    color: var(--accent);
    font-size: 24px;
    font-weight: 900;
}

.product-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 7px;
}

.product-card button {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
}

.product-actions a {
    display: grid;
    place-items: center;
    min-height: 38px;
    padding: 0 11px;
    color: var(--accent-dark);
    background: #fff2ed;
    border: 1px solid #ffd2c1;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
}

.cart,
.scrim {
    position: fixed;
    inset: 0 0 0 auto;
    transform: translateX(110%);
    transition: transform 0.2s ease;
}

.cart {
    z-index: 30;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    width: min(420px, 100%);
    padding: 20px;
    background: var(--surface);
    box-shadow: -18px 0 40px rgba(0, 0, 0, 0.18);
}

.scrim {
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.34);
    opacity: 0;
    pointer-events: none;
}

body.cart-open .cart,
body.cart-open .scrim {
    transform: translateX(0);
}

body.cart-open .scrim {
    opacity: 1;
    pointer-events: auto;
}

.cart-head,
.cart-item,
.cart-total {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.cart-head h2 {
    margin: 0;
}

.cart-head button {
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
}

.cart-items {
    display: grid;
    align-content: start;
    gap: 12px;
    overflow: auto;
    padding: 20px 0;
}

.cart-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.cart-item strong {
    display: block;
    max-width: 230px;
}

.cart-item span {
    color: var(--muted);
}

.cart-item button {
    color: var(--accent-dark);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.cart-total {
    padding: 16px 0;
    border-top: 1px solid var(--line);
    font-size: 20px;
}

.checkout {
    display: grid;
    place-items: center;
    min-height: 44px;
}

.empty,
.error {
    grid-column: 1 / -1;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.error {
    color: #8a2d20;
}

.auth-page,
.admin-page {
    width: min(1040px, calc(100% - 32px));
}

.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 28px 0;
}

.auth-card,
.settings-section {
    width: min(460px, 100%);
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.auth-card {
    display: grid;
    gap: 16px;
}

.auth-card h1,
.settings-section h2,
.admin-title h1 {
    margin: 0;
}

.auth-card label,
.settings-section label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.auth-card input,
.settings-section input,
.settings-section select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}

.auth-card button,
.settings-form > button {
    min-height: 44px;
}

.auth-card p,
.auth-card a {
    margin: 0;
}

.form-error,
.form-success {
    padding: 12px 14px;
    border-radius: 8px;
}

.form-error {
    color: #8a2d20;
    background: #fff1ed;
    border: 1px solid #fecaca;
}

.form-success {
    color: #14532d;
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
}

.admin-page {
    padding-top: 28px;
}

.admin-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 18px;
    align-items: end;
    margin-bottom: 22px;
}

.admin-title .eyebrow {
    color: var(--accent);
}

.admin-title h1 {
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
    margin: 18px 0;
}

.settings-section {
    display: grid;
    gap: 14px;
    width: auto;
}

.check-row {
    display: flex !important;
    grid-column: 1 / -1;
    flex-direction: row;
    gap: 10px !important;
    align-items: center;
    color: var(--ink) !important;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.settings-form > button {
    grid-column: 1 / -1;
    justify-self: start;
}

.users-section {
    width: 100%;
    overflow-x: auto;
}

.users-section table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.users-section th,
.users-section td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
}

.users-section th {
    color: var(--muted);
    font-size: 13px;
}

[dir="rtl"] .hero {
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.35), transparent 24%),
        linear-gradient(245deg, #ff2d2d 0%, #ff6a00 52%, #ffb000 100%);
}

[dir="rtl"] .cart {
    inset: 0 auto 0 0;
    transform: translateX(-110%);
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.18);
}

[dir="rtl"] .search {
    direction: rtl;
}

[dir="rtl"] .cart-button span {
    margin-right: 6px;
    margin-left: 0;
}

@media (max-width: 1120px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .site-header {
        grid-template-columns: 1fr auto;
    }

    .search {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .account-nav {
        grid-column: 1 / -1;
        justify-content: flex-start;
        grid-row: 3;
        flex-wrap: wrap;
    }

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

    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .settings-form,
    .admin-title {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    main {
        width: min(100% - 20px, 1180px);
        padding-top: 14px;
    }

    .site-header {
        padding: 10px;
    }

    .brand {
        font-size: 20px;
    }

    .hero {
        min-height: 380px;
        padding: 24px 18px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .toolbar {
        display: grid;
        align-items: stretch;
    }

    .product-card {
        grid-template-rows: 170px 1fr;
    }
}
