:root {
    --body-bg: #f6f7fb;
    --text-color: #232323;
    --card-bg: #ffffff;
    --card-border-color: rgba(0, 0, 0, 0.125);
    --input-bg: #ffffff;
    --input-border-color: #ced4da;
    --logo-filter: none;
    --navbar-bg: rgba(255,255,255,0.98);
    --link-color: #998fc6;
    --link-hover-color: #7a6bb3;
    --badge-bg: #f3f0fa;
    --badge-color: #998fc6;
    --card-shadow: 0 4px 32px 0 rgba(153,143,198,0.09), 0 1.5px 4px 0 rgba(153,143,198,0.04);
    --card-hover-shadow: 0 8px 40px 0 rgba(153,143,198,0.17), 0 2px 8px 0 rgba(153,143,198,0.08);
}

[data-theme="dark"] {
    --body-bg: #1a1a2e;
    --text-color: #e0e1dd;
    --card-bg: #242539;
    --card-border-color: rgba(255, 255, 255, 0.05);
    --input-bg: #1e1f31;
    --input-border-color: #404258;
    --logo-filter: brightness(0) invert(1);
    --navbar-bg: rgba(30, 31, 49, 0.9);
    --link-color: #a79fd7;
    --link-hover-color: #c4bde9;
    --badge-bg: #3a3b53;
    --badge-color: #c4bde9;
    --card-shadow: 0 4px 20px 0 rgba(0,0,0,0.2);
    --card-hover-shadow: 0 8px 30px 0 rgba(0,0,0,0.3);
}

@font-face {
    font-family: 'Tilda Sans';
    src: url('../fonts/tilda-sans_light.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
body {
    font-family: 'Tilda Sans', Arial, sans-serif;
    background: var(--body-bg);
    color: var(--text-color);
    font-size: 1.08rem;
    transition: background-color 0.3s, color 0.3s;
}

.navbar, .card, .btn, .nav-link, .badge, h1, h2, h3, h4, h5, h6, .card-title, .card-text, .lead, .display-4, .form-control, .modal-content {
    font-family: 'Tilda Sans', Arial, sans-serif !important;
}

.navbar {
    background: var(--navbar-bg) !important;
    box-shadow: 0 2px 16px 0 rgba(153,143,198,0.10), 0 1.5px 4px 0 rgba(153,143,198,0.04);
    transition: box-shadow 0.2s, background 0.2s;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.navbar .navbar-brand img {
    height: 44px;
    transition: filter 0.2s;
    filter: var(--logo-filter);
}

.navbar .navbar-brand span {
    letter-spacing: 1px;
}

.navbar .nav-link.active, .navbar .nav-link:focus, .navbar .nav-link:hover {
    color: var(--link-hover-color) !important;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    transition: background 0.2s;
}
.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    color: #fff;
}

.container {
    max-width: 1200px;
}

.card {
    border: 1px solid var(--card-border-color);
    border-radius: 1.5rem;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.22s, transform 0.18s, background-color 0.3s;
    padding-bottom: 0.5rem;
}
.card:hover {
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-4px) scale(1.015);
}
.card-img-top {
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
    background: #f3f0fa;
    object-fit: cover;
    min-height: 300px;
    max-height: 320px;
    transition: filter 0.2s;
}
.card-title {
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-bottom: 0.5rem;
}
.card-text {
    font-size: 1.01rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 1.1rem;
}
.badge {
    background: var(--badge-bg);
    color: var(--badge-color);
    font-weight: 600;
    font-size: 1.01em;
    border-radius: 1rem;
    padding: 0.45em 1.1em;
    letter-spacing: 0.5px;
}

.btn {
    font-size: 1.08rem;
    border-radius: 2rem;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}

h1, .display-4 {
    color: var(--text-color);
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 0.7em;
}

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

.product-card {
    min-height: 550px;
    padding-bottom: 0.5rem;
}
.product-image {
    height: 200px;
    min-height: unset;
    max-height: unset;
    margin-bottom: unset;
}
.price-original {
    text-decoration: line-through;
    color: #9ca3af;
}
.price-discounted {
    color: #ef4444;
    font-weight: bold;
}
.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.filter-button {
    transition: background-color 0.2s ease, color 0.2s ease;
}
.filter-button.active {
    background-color: #3b82f6;
    color: white;
}
.content-wrapper {
    padding: 1.25rem;
}
.notes, .product-additional-info {
    font-size: 0.875rem;
    color: #4b5563;
}
.product-title {
    min-height: 3em;
}
.product-description {
    min-height: 4.5em;
}
.product-features {
    font-size: 0.82rem;
    margin-bottom: 0.2rem;
    padding: 0.1rem 0 0.1rem 0;
}
.action-button {
    background-color: #22c55e;
    color: white;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    text-align: center;
    transition: background-color 0.2s ease;
}
.action-button:hover {
    background-color: #16a34a;
}

@media (max-width: 991px) {
    .container {
        max-width: 98vw;
    }
    .navbar .navbar-brand img {
        height: 36px;
    }
    .card-img-top {
        min-height: 200px;
        max-height: 220px;
    }
    /* Делаем модалку шире на мобильных */
    .modal-xxl {
        max-width: 98vw !important;
    }
    #productModal .col-md-6:first-child {
        min-width: 0;
        max-width: 100%;
        flex: 0 0 100%;
    }
}

/* Зум-оверлей для модалки товара */
.img-zoom-overlay {
  display: none;
  position: fixed;
  z-index: 3000;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(30,30,40,0.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.img-zoom-overlay[style*="display: flex"] {
  display: flex !important;
}
.img-zoom-target {
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 8px 40px 0 rgba(0,0,0,0.25);
  border-radius: 1.2rem;
}
.img-zoom-close {
  position: absolute;
  top: 32px;
  right: 48px;
  font-size: 2.2rem;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  padding: 0 0.5em;
}
body.zoomed {
  overflow: hidden;
}

#productModal .carousel-control-prev,
#productModal .carousel-control-next {
    width: 38px;
    height: 38px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #998fc6 60%, #7a6bb3 100%);
    border-radius: 50%;
    box-shadow: 0 4px 16px 0 rgba(153,143,198,0.18);
    opacity: 0.95;
    transition: background 0.2s, box-shadow 0.2s, opacity 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
#productModal .carousel-control-prev:hover,
#productModal .carousel-control-next:hover {
    background: linear-gradient(135deg, #7a6bb3 60%, #998fc6 100%);
    box-shadow: 0 8px 32px 0 rgba(153,143,198,0.28);
    opacity: 1;
}
#productModal .carousel-control-prev-icon,
#productModal .carousel-control-next-icon {
    filter: invert(1) drop-shadow(0 2px 4px rgba(0,0,0,0.12));
    width: 1.3rem;
    height: 1.3rem;
}
#productModal .carousel-inner img {
    max-height: 270px;
    object-fit: contain;
    margin: 0 auto;
}

/* Футтер */
footer {
    background: #fff;
    border-top: 1px solid #ececec;
    margin-top: 3rem;
}
footer .btn-outline-primary {
    border: 2px solid #998fc6;
    color: #998fc6;
    font-weight: 600;
    border-radius: 2rem;
    padding: 0.6rem 2.5rem;
    font-size: 1.08rem;
    min-width: 200px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px 0 rgba(153,143,198,0.10);
}
footer .btn-outline-primary:hover, footer .btn-outline-primary:focus {
    background: #998fc6;
    color: #fff;
    box-shadow: 0 4px 16px 0 rgba(153,143,198,0.18);
} 

/* Стили для блока с картинками в модалке редактирования */
#editCurrentImages {
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 8px;
    white-space: nowrap;
}
#editCurrentImages .position-relative {
    display: inline-block;
    margin-right: 8px;
}
#editCurrentImages img {
    height: 100px;
    width: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
#editCurrentImages .btn-danger {
    width: 28px;
    height: 28px;
    font-size: 18px;
    padding: 0;
    border-radius: 50%;
    position: absolute;
    top: 6px !important;
    right: 6px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    z-index: 2;
}

/* Крестик закрытия модалки товара */
#productModal .btn-close {
    position: absolute;
    right: 18px;
    top: 18px;
    z-index: 10;
    background: none;
    border-radius: 0;
    box-shadow: none;
    width: 32px;
    height: 32px;
    opacity: 1;
    color: #333;
    filter: none;
}
#productModal .btn-close:focus {
    outline: 2px solid #998fc6;
}
#productModal .modal-header {
    min-height: 48px;
    padding-bottom: 0;
}
#productModal .col-md-6 {
    min-width: 340px;
}
@media (max-width: 991px) {
    #productModal .row.flex-nowrap {
        flex-wrap: wrap !important;
    }
    #productModal .col-md-6 {
        min-width: 0;
    }
}

.btn-close::after {
    content: '×';
    font-size: 2rem;
    color: #333;
    line-height: 1;
    position: absolute;
    top: 0; right: 0; left: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#productDetails .col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}
#productDetails .border {
    width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    margin-bottom: 0.7em;
}
#productDetails .fw-bold {
    margin-right: 0.2em;
    min-width: unset;
    white-space: nowrap;
}
#productDetails .border span:last-child {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* --- Мобильная адаптация характеристик товара в модалке --- */
@media (max-width: 767.98px) {
  #productDetails .col-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  #productDetails .bg-light {
    font-size: 0.95em;
    padding: 8px 8px;
    word-break: break-word;
    overflow-x: auto;
  }
}

/* Для десктопа оставляем как есть */ 

.product-detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  display: inline-block;
  vertical-align: baseline;
}

.nowrap-value {
  white-space: nowrap;
  overflow-x: auto;
}

@media (max-width: 767.98px) {
  .product-detail-value,
  .nowrap-value {
    font-size: 1em !important;
    padding-bottom: 2px !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
    display: inline-block !important;
    width: auto !important;
    text-align: left !important;
  }
} 

.form-control, .form-select {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-color: var(--input-border-color);
}

.form-control:focus, .form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-color);
    border-color: var(--link-color);
    box-shadow: 0 0 0 0.25rem rgba(var(--link-color), 0.25);
}

[data-theme="dark"] .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.modal-content {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: var(--card-border-color);
}

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

.alert-success {
    background-color: #28a745;
    color: white;
}
.alert-danger {
    background-color: #dc3545;
    color: white;
}

[data-theme="dark"] .table {
    color: var(--text-color);
    border-color: var(--card-border-color);
}
[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: var(--card-bg);
    border-color: var(--card-border-color);
}

.theme-switcher {
    position: fixed;
    top: 1.3rem;
    right: 1.5rem;
    z-index: 1051;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f39c12' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='12' cy='12' r='5'%3e%3c/circle%3e%3cline x1='12' y1='1' x2='12' y2='3'%3e%3c/line%3e%3cline x1='12' y1='21' x2='12' y2='23'%3e%3c/line%3e%3cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'%3e%3c/line%3e%3cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'%3e%3c/line%3e%3cline x1='1' y1='12' x2='3' y2='12'%3e%3c/line%3e%3cline x1='21' y1='12' x2='23' y2='12'%3e%3c/line%3e%3cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'%3e%3c/line%3e%3cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'%3e%3c/line%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
}

input:checked + .slider {
  background-color: #30314d;
}

input:focus + .slider {
  box-shadow: 0 0 1px #30314d;
}

input:checked + .slider:before {
  transform: translateX(26px);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a79fd7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'%3e%3c/path%3e%3c/svg%3e");
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

[data-theme="dark"] #productDetails .bg-light {
    background: #23243a !important;
    color: #e0e1dd !important;
} 