/**
 * Тёмная тема: активируется через <html data-theme="dark">
 * Сохранение выбора: localStorage key site-theme
 */

html[data-theme="dark"] {
    color-scheme: dark;
    --gold: #d4b46a;
    --gold-dark: #c9a962;
    --gold-light: #e4c97a;
    --gold-bg: rgba(201, 169, 98, 0.2);
    --black: #0c0b0a;
    --black-bg: #0e0d0b;
    --charcoal: #f2efe9;
    --cream: #161411;
    --cream-dark: #c6c0b6;
    --ivory: #141210;
    --white: #12100e;
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.55);
    --shadow-card: 0 8px 36px rgba(0, 0, 0, 0.55);
    --border-gold: 1px solid rgba(201, 169, 98, 0.45);
    --border-light: 1px solid rgba(255, 255, 255, 0.08);
    --red: var(--gold);
    --red-dark: var(--gold-dark);
    --beige: var(--cream);
    --beige-dark: var(--cream-dark);
}

html[data-theme="dark"] body {
    color: var(--charcoal);
    background-color: var(--white);
    background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(201, 169, 98, 0.07) 0%, transparent 50%);
}

/* Шапка */
html[data-theme="dark"] .header {
    background: linear-gradient(180deg, #1f1c18 0%, #171512 55%, #12100e 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .header .nav,
html[data-theme="dark"] .header .nav a,
html[data-theme="dark"] .header .nav span {
    color: #e8e4df;
}

html[data-theme="dark"] .nav__link {
    color: #e8e4df;
}

html[data-theme="dark"] .nav__link:hover {
    color: #f5edd4;
    background: rgba(201, 169, 98, 0.22);
}

html[data-theme="dark"] .nav__link.nav__link--active {
    color: #f0e6c8;
    background: rgba(201, 169, 98, 0.28);
    box-shadow: 0 0 0 1px rgba(166, 139, 74, 0.45);
}

html[data-theme="dark"] .nav__balance {
    color: #e8e4df;
    border-left-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .nav__user {
    color: #ebe8e3;
}

html[data-theme="dark"] .nav__link--admin {
    color: #e8d4a0;
}

html[data-theme="dark"] .nav-search__input {
    background: #1a1816;
    color: #e8e4df;
    border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .nav-search__input:focus {
    background: #1f1d1a;
    border-color: var(--gold);
}

html[data-theme="dark"] .nav-search__input::placeholder {
    color: #b0aaa2;
}

html[data-theme="dark"] .nav-search__btn {
    color: #f5f0e6;
    border-color: #a68b4a;
    background: rgba(201, 169, 98, 0.18);
}

html[data-theme="dark"] .nav-search__btn:hover {
    background: rgba(201, 169, 98, 0.32);
    border-color: #c9a962;
    color: #fff;
}

/* Каталог: шапка с !important и оверлей фона */
html[data-theme="dark"] .page-catalog .header .nav__link,
html[data-theme="dark"] .page-catalog .header .nav__balance,
html[data-theme="dark"] .page-catalog .header .nav__user {
    color: #e8e4df !important;
}

html[data-theme="dark"] .page-catalog .header .nav-search__input {
    background: #1a1816;
    color: #e8e4df;
    border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .page-catalog .header .nav-search__input::placeholder {
    color: #b0aaa2;
}

html[data-theme="dark"] .page-catalog .header .nav-search__btn {
    color: #f5f0e6;
    border-color: #a68b4a;
    background: rgba(201, 169, 98, 0.15);
}

html[data-theme="dark"] .catalog-main__bg::after {
    background: rgba(14, 12, 10, 0.88);
}

html[data-theme="dark"] .catalog-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .nav__balance {
    font-size: 0.9rem;
    color: #e8e4df;
}

/* Подвал */
html[data-theme="dark"] .footer {
    background: #0e0d0b;
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* Карточки */
html[data-theme="dark"] .paper-card:hover {
    border-color: rgba(201, 169, 98, 0.45);
    box-shadow: 0 12px 44px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .paper-card--photo {
    background: #181614;
}

html[data-theme="dark"] .paper-card--photo.no-img {
    color: #b0aaa2;
}

html[data-theme="dark"] .btn--outline {
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--charcoal);
}

html[data-theme="dark"] .btn--outline:hover {
    border-color: var(--gold);
    color: var(--gold-light);
}

html[data-theme="dark"] .catalog-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

/* Текстовые цвета без var (жёстко заданные в css) */
html[data-theme="dark"] .catalog-title,
html[data-theme="dark"] .catalog-banner__title,
html[data-theme="dark"] .catalog-banner__title-card,
html[data-theme="dark"] .blog-title,
html[data-theme="dark"] .blog-single__title,
html[data-theme="dark"] .product-detail__title,
html[data-theme="dark"] .product-detail__gallery-title,
html[data-theme="dark"] .product-breadcrumb,
html[data-theme="dark"] .product-related__title,
html[data-theme="dark"] .cart-total,
html[data-theme="dark"] .cart-empty,
html[data-theme="dark"] .profile-form__section-title,
html[data-theme="dark"] .checkout-form__title {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .catalog-desc,
html[data-theme="dark"] .catalog-summary,
html[data-theme="dark"] .blog-lead,
html[data-theme="dark"] .product-detail__description,
html[data-theme="dark"] .cart-desc,
html[data-theme="dark"] .checkout-desc,
html[data-theme="dark"] .my-orders-desc,
html[data-theme="dark"] .profile-desc {
    color: var(--cream-dark) !important;
}

/* Каталог: карточки и плейсхолдеры */
html[data-theme="dark"] .catalog-card__title,
html[data-theme="dark"] .catalog-card__stock,
html[data-theme="dark"] .catalog-card__price {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .catalog-card__placeholder,
html[data-theme="dark"] .catalog-banner__placeholder {
    color: #b0aaa2 !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

/* Каталог: кнопки категорий (в catalog.css жёсткий #2a2520 — на тёмном фоне нечитаемо) */
html[data-theme="dark"] .catalog-cats__link:not(.catalog-cats__link--active),
html[data-theme="dark"] .catalog-cats .paper-card--link:not(.catalog-cats__link--active) {
    color: #f2efe9 !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(201, 169, 98, 0.35) !important;
}

html[data-theme="dark"] .catalog-cats__link:not(.catalog-cats__link--active) i,
html[data-theme="dark"] .catalog-cats .paper-card--link:not(.catalog-cats__link--active) i {
    color: inherit !important;
    opacity: 0.95 !important;
}

html[data-theme="dark"] .catalog-cats__link:not(.catalog-cats__link--active):hover,
html[data-theme="dark"] .catalog-cats .paper-card--link:not(.catalog-cats__link--active):hover {
    color: #fff8ec !important;
    background: rgba(201, 169, 98, 0.2) !important;
    border-color: rgba(212, 180, 106, 0.55) !important;
}

html[data-theme="dark"] .catalog-cats__link--active,
html[data-theme="dark"] .catalog-cats__link.catalog-cats__link--active {
    color: #1a1816 !important;
    background: var(--gold) !important;
    border-color: var(--gold-dark) !important;
}

html[data-theme="dark"] .catalog-cats__link--active i {
    color: #1a1816 !important;
}

/* Каталог: пагинация (общее правило давало светлый текст на светлых кнопках) */
html[data-theme="dark"] .catalog-pagination__link:not(.catalog-pagination__link--current) {
    color: #f2efe9 !important;
    background: rgba(32, 29, 26, 0.92) !important;
    border: 1px solid rgba(201, 169, 98, 0.38) !important;
    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

html[data-theme="dark"] .catalog-pagination__link:not(.catalog-pagination__link--current):hover {
    color: #fff !important;
    background: rgba(201, 169, 98, 0.22) !important;
    border-color: rgba(212, 180, 106, 0.55) !important;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .catalog-pagination__link:not(.catalog-pagination__link--current) i {
    color: inherit !important;
    opacity: 0.95 !important;
}

html[data-theme="dark"] .catalog-pagination__link--current {
    color: #1a1816 !important;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%) !important;
    border-color: var(--gold-dark) !important;
    box-shadow:
        0 2px 14px rgba(201, 169, 98, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
}

html[data-theme="dark"] .catalog-pagination__link--current:hover {
    color: #1a1816 !important;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%) !important;
}

/* Баннер новинок — градиенты */
html[data-theme="dark"] .catalog-banner__card {
    background: linear-gradient(145deg, #1e1b17 0%, #141210 100%) !important;
    border-color: rgba(201, 169, 98, 0.25) !important;
}

/* Товар */
html[data-theme="dark"] .product-detail__poster-img,
html[data-theme="dark"] .product-detail__gallery-thumb,
html[data-theme="dark"] .product-detail__gallery-thumb video {
    background: #1a1816 !important;
}

html[data-theme="dark"] .product-detail__gallery-hint,
html[data-theme="dark"] .product-detail__zoom-hint {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .product-detail__price {
    color: var(--gold-light) !important;
}

html[data-theme="dark"] .product-notify__input,
html[data-theme="dark"] .checkout-form__input,
html[data-theme="dark"] .profile-form__input,
html[data-theme="dark"] .search-form__input {
    background: #1a1816 !important;
    color: var(--charcoal) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .product-notify__input::placeholder,
html[data-theme="dark"] .checkout-form__input::placeholder {
    color: #b0aaa2 !important;
}

/* Корзина / оформление */
html[data-theme="dark"] .cart-item,
html[data-theme="dark"] .checkout-form,
html[data-theme="dark"] .paper-card.legal-content {
    background: var(--white);
}

html[data-theme="dark"] .cart-added-msg {
    background: rgba(46, 125, 50, 0.2) !important;
    border-color: rgba(165, 214, 167, 0.45) !important;
    color: #c8e6c9 !important;
}

/* Блог */
html[data-theme="dark"] .blog-single__body {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .blog-pagination__link:not(.blog-pagination__link--current) {
    color: #f2efe9 !important;
    background: rgba(32, 29, 26, 0.92) !important;
    border-color: rgba(201, 169, 98, 0.38) !important;
}

html[data-theme="dark"] .blog-pagination__link:not(.blog-pagination__link--current):hover {
    color: #fff !important;
    background: rgba(201, 169, 98, 0.22) !important;
    border-color: rgba(212, 180, 106, 0.55) !important;
}

html[data-theme="dark"] .blog-pagination__link--current {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%) !important;
    border-color: var(--gold-dark) !important;
    color: #1a1816 !important;
    box-shadow: 0 2px 12px rgba(201, 169, 98, 0.4) !important;
}

html[data-theme="dark"] .blog-pagination__link--current:hover {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%) !important;
    border-color: var(--gold-dark) !important;
    color: #1a1816 !important;
}

/* Лайтбокс — уже тёмный фон */
html[data-theme="dark"] .dle-lightbox__bar {
    background: rgba(0, 0, 0, 0.75);
}

/* Юридические таблицы */
html[data-theme="dark"] .legal-content .refund-policy__table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .legal-content .refund-policy__table td {
    border-color: rgba(255, 255, 255, 0.08);
}

/* Страница «сайт отключён» */
html[data-theme="dark"] body.site-off .site-off__title {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] body.site-off .site-off__p {
    color: var(--cream-dark) !important;
}

/* Страницы входа / регистрации */
html[data-theme="dark"] .auth-box__title,
html[data-theme="dark"] .auth-form__label {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .auth-form__input {
    background: #1a1816 !important;
    color: var(--charcoal) !important;
    border-color: rgba(201, 169, 98, 0.35) !important;
}

html[data-theme="dark"] .auth-logo__text {
    color: var(--gold-light) !important;
}

html[data-theme="dark"] .payment-redirect,
html[data-theme="dark"] .payment-redirect a {
    color: var(--charcoal);
}

html[data-theme="dark"] .payment-redirect a:hover {
    color: var(--gold-light);
}

/* --- Читаемость: переопределение «жёстких» серых из product/cart/blog --- */
html[data-theme="dark"] .product-detail__info,
html[data-theme="dark"] .product-detail__title,
html[data-theme="dark"] .product-detail__gallery-title,
html[data-theme="dark"] .product-notify__input {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .product-detail__zoom-hint {
    color: #2a2620 !important;
    background: rgba(248, 246, 242, 0.92) !important;
}

html[data-theme="dark"] .product-detail__gallery-hint,
html[data-theme="dark"] .product-detail__placeholder {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .product-notify__lead {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .product-detail__gallery-block {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .product-detail__actions {
    border-top-color: rgba(201, 169, 98, 0.35) !important;
}

html[data-theme="dark"] .product-detail__stock--yes {
    color: #9ccc9c !important;
}

html[data-theme="dark"] .cart-item__title,
html[data-theme="dark"] .cart-total,
html[data-theme="dark"] .checkout-summary__total,
html[data-theme="dark"] .checkout-summary__row strong {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .cart-item__meta {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .cart-item__qty-label,
html[data-theme="dark"] .checkout-summary__row,
html[data-theme="dark"] .checkout-form__optional {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .cart-item__qty {
    background: #1a1816 !important;
    color: var(--charcoal) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
}

/* blog.php — список: карточки со светлым фоном (#fff в blog.css), не наследовать светлый --charcoal */
html[data-theme="dark"] .page-blog .blog-item.blog-item {
    background: #faf8f5 !important;
    color: #2a2520 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .page-blog .blog-item .blog-item__title,
html[data-theme="dark"] .page-blog .blog-item .blog-item__title a {
    color: #1a1816 !important;
}

html[data-theme="dark"] .page-blog .blog-item .blog-item__title a:hover {
    color: #8b6914 !important;
}

html[data-theme="dark"] .page-blog .blog-item .blog-item__meta,
html[data-theme="dark"] .page-blog .blog-item .blog-item__date,
html[data-theme="dark"] .page-blog .blog-item .blog-item__views {
    color: #5a534c !important;
}

html[data-theme="dark"] .page-blog .blog-item .blog-item__meta i {
    color: #6e665c !important;
    opacity: 1 !important;
}

html[data-theme="dark"] .page-blog .blog-item .blog-item__excerpt {
    color: #3d3835 !important;
}

html[data-theme="dark"] .page-blog .blog-empty.paper-card {
    background: #faf8f5 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] .page-blog .blog-empty__text {
    color: #2a2520 !important;
}

html[data-theme="dark"] .page-blog .blog-empty__icon {
    color: #8b7355 !important;
}

html[data-theme="dark"] .page-blog #blog-list-wrap.blog-list-wrap--loading::after {
    background: rgba(250, 248, 245, 0.96) !important;
    color: #2a2520 !important;
}

html[data-theme="dark"] .blog-single__gallery-title {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .blog-single__gallery-hint {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .blog-single__gallery-block {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .blog-single__body blockquote {
    color: var(--cream-dark) !important;
    background: rgba(201, 169, 98, 0.12) !important;
    border-left-color: var(--gold) !important;
}

html[data-theme="dark"] .footer,
html[data-theme="dark"] .footer__link {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .footer__link:hover {
    color: var(--gold-light) !important;
}

html[data-theme="dark"] .legal-content .legal-text p,
html[data-theme="dark"] .legal-content .legal-text li {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .legal-content .legal-text h2,
html[data-theme="dark"] .legal-content .legal-text h3 {
    color: var(--charcoal) !important;
}

/* Оформление заказа, заказы, профиль */
html[data-theme="dark"] .checkout-option {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .checkout-option__balance,
html[data-theme="dark"] .checkout-form__hint {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .checkout-form__captcha {
    border-top-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .checkout-form__actions {
    background: rgba(255, 255, 255, 0.04) !important;
}

html[data-theme="dark"] .my-orders-empty__text,
html[data-theme="dark"] .my-orders-item__id {
    color: var(--charcoal) !important;
}

html[data-theme="dark"] .my-orders-item__date,
html[data-theme="dark"] .my-orders-item__address {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .my-orders-item__head {
    background: linear-gradient(135deg, #252220 0%, #1a1816 100%) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .my-orders-item__meta {
    background: #161411 !important;
}

html[data-theme="dark"] .profile-form__hint {
    color: var(--cream-dark) !important;
}

html[data-theme="dark"] .profile-form__section {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .blog-single__body a:hover {
    color: var(--gold-light) !important;
}
