/* ==========================================================================
   ArzanMix — единый файл стилей (магазин + админ-панель)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Переменные и база
   -------------------------------------------------------------------------- */
:root {
    --primary-color: #4361ee;
    --secondary-color: #6c757d;
    --success-color: #4cc9f0;
    --danger-color: #f72585;
    --warning-color: #f8961e;
    --info-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --background-light: #ffffff;
    --background-soft: #f8f9ff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e9ecef;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-soft);
    color: var(--text-primary);
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Утилиты для замены inline-стилей (общие)
   -------------------------------------------------------------------------- */
.img-product-card {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.img-product-placeholder {
    width: 100%;
    height: 100%;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-color);
}
.img-thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
}
.img-thumb-placeholder {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-color);
    border-radius: 0.25rem;
}
.cart-qty-input {
    max-width: 120px;
}
.step-circle {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0.25rem;
}
.step-circle-sm {
    width: 25px;
    height: 25px;
    font-size: 0.6rem;
}
.table-center-cell {
    text-align: center;
}
.d-none-until-show {
    display: none;
}

/* --------------------------------------------------------------------------
   Шапка и навигация (магазин)
   -------------------------------------------------------------------------- */
.navbar-brand {
    font-size: 1.8rem;
    font-weight: 700;
}
.navbar {
    background-color: var(--background-light) !important;
    box-shadow: 0 2px 20px rgba(0,0,0,0.05);
    padding: 1rem 0;
}
.navbar .nav-link {
    color: var(--text-primary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color) !important;
}

/* --------------------------------------------------------------------------
   Hero и категории
   -------------------------------------------------------------------------- */
/* Hero-блок на главной — обновлённый дизайн */
.hero-block {
    margin-left: 2rem;
    margin-right: 2rem;
    padding: 2.25rem 2rem;
    background: linear-gradient(135deg, #4361ee 0%, #5f7cff 50%, #4895ef 100%);
    color: #fff;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 8px 32px rgba(67, 97, 238, 0.25);
}
.hero-block__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}
.hero-block__content {
    flex: 1;
    max-width: 640px;
}
.hero-block__title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}
.hero-block__subtitle {
    font-size: 1rem;
    opacity: 0.92;
    margin: 0 0 1.25rem 0;
    line-height: 1.5;
}
.hero-block__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    background: #fff;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hero-block__cta:hover {
    color: #2d4dd4;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.hero-block__icon {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 24px;
}
.hero-block__icon i {
    font-size: 2.5rem;
    opacity: 0.95;
}
@media (min-width: 992px) {
    .hero-block__icon {
        display: flex;
    }
}

.hero-section {
    background: linear-gradient(135deg, #4361ee 0%, #4895ef 100%);
    padding: 4rem 0;
    border-radius: 0 0 30px 30px;
    margin-bottom: 2rem;
}
.hero-section h1 {
    font-weight: 800;
    letter-spacing: -0.5px;
}
.hero-section .lead {
    font-size: 1.25rem;
    opacity: 0.9;
}
.hero-section .btn {
    padding: 0.75rem 2rem;
    font-weight: 600;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
    transition: all 0.3s ease;
}
.hero-section .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.categories-section {
    background-color: var(--background-light);
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.03);
    padding: 2rem;
    margin-bottom: 2rem;
}
.categories-section h2 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* Блок категорий на главной — обновлённый дизайн */
.categories-block {
    margin-left: 4rem;
    margin-right: 4rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(67, 97, 238, 0.08);
}
.categories-block__title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
}
.categories-block__title i {
    color: var(--primary-color);
    font-size: 1.1em;
}
.categories-block__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
    background: #fff;
    border: 1px solid rgba(67, 97, 238, 0.25);
    border-radius: 999px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.category-chip:hover {
    background: rgba(67, 97, 238, 0.08);
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.category-chip--active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.category-chip--active:hover {
    background: #3550c9;
    color: #fff;
    border-color: #3550c9;
}

/* Совместимость со старым классом (если используется где-то ещё) */
.category-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
    background: #fff;
    border: 1px solid rgba(67, 97, 238, 0.25);
    border-radius: 999px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    margin-bottom: 0.5rem;
}
.category-btn:hover {
    background: rgba(67, 97, 238, 0.08);
    border-color: var(--primary-color);
}
.category-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* --------------------------------------------------------------------------
   Карточки товаров
   -------------------------------------------------------------------------- */
/* Карточка товара — компактная рамка */
.card.product-card {
    background-color: var(--background-light);
    border-radius: 10px !important;
    overflow: hidden;
    border: 1px solid #e9ecef !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06) !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    height: 100%;
}
.card.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.1) !important;
}
/* Блок изображения — фиксированный размер у всех карточек, пропорции сохраняются */
.product-card-img-box {
    height: 160px !important;
    width: 100% !important;
    overflow: hidden;
    background-color: #f8f9fa;
    flex-shrink: 0;
}
.product-card-img-box .img-product-card {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
}
.product-card-img-box .img-product-placeholder {
    height: 160px !important;
    width: 100% !important;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}
.product-image {
    height: 160px;
    object-fit: cover;
    background: linear-gradient(45deg, #f0f4ff, #e6f0ff);
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-image img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}
.card.product-card .card-body {
    padding: 1rem !important;
}
.card-body {
    padding: 1.5rem;
}
.card.product-card .card-title {
    font-size: 1rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
}
.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}
.card.product-card .card-text {
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.5rem !important;
}
.card-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}
.h5.text-primary {
    font-weight: 800;
    font-size: 1.5rem;
}

/* Цена и уведомления на карточке */
.card.product-card .price-input {
    border: 1px solid var(--primary-color) !important;
    border-radius: 6px !important;
    text-align: center;
    font-weight: bold;
    font-size: 1rem !important;
    color: var(--text-primary);
    width: 100px !important;
    margin: 0 auto;
    padding: 6px 8px !important;
}
.card.product-card .price-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}
.card.product-card .price-input-readonly,
.card.product-card .price-input[readonly] {
    background-color: #f0f2f5 !important;
    cursor: default;
}
.original-price {
    text-decoration: line-through;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transform: translateX(200%);
    transition: transform 0.3s ease;
}
.notification.show {
    transform: translateX(0);
}
.notification-success {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}
.notification-error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* --------------------------------------------------------------------------
   Кнопки
   -------------------------------------------------------------------------- */
.btn {
    font-weight: 500;
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: none;
}
.btn-primary {
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    border: none;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #3a0ca3 0%, #4361ee 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}
.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}
.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}
.btn-success {
    background: linear-gradient(135deg, #4cc9f0 0%, #4895ef 100%);
    border: none;
}
.btn-success:hover {
    background: linear-gradient(135deg, #4895ef 0%, #4cc9f0 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 201, 240, 0.3);
}

/* --------------------------------------------------------------------------
   Формы
   -------------------------------------------------------------------------- */
.form-control,
.form-select {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    background-color: var(--background-light);
    transition: all 0.3s ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
    background-color: var(--background-light);
}
.input-group {
    border-radius: 12px;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Бейджи и алерты
   -------------------------------------------------------------------------- */
.badge {
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 50px;
}
.badge.bg-primary {
    background: linear-gradient(135deg, #4361ee 0%, #4895ef 100%) !important;
}
.badge.bg-secondary {
    background-color: #6c757d !important;
}
.alert {
    border-radius: 16px;
    border: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}
.alert-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1a237e;
}
.alert-info .alert-heading {
    color: #1a237e;
}

/* --------------------------------------------------------------------------
   Подвал
   -------------------------------------------------------------------------- */
footer {
    background: linear-gradient(135deg, #2b2d42 0%, #1d1e2c 100%);
    color: rgba(255,255,255,0.8);
    border-radius: 30px 30px 0 0;
    margin-top: 3rem;
}
footer h5 {
    color: white;
    font-weight: 700;
    margin-bottom: 1.5rem;
}
footer .text-muted {
    color: rgba(255,255,255,0.6) !important;
}
footer a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s ease;
}
footer a:hover {
    color: white;
}

/* Страница корзины: футер всегда внизу экрана при пустой/короткой высоте контента */
html { height: 100%; }
body.page-cart {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
    height: 100%;
}
body.page-cart > header { flex-shrink: 0; }
body.page-cart > .cart-page-main { flex: 1 0 auto; }
body.page-cart > footer { flex-shrink: 0; margin-top: auto; }

/* --------------------------------------------------------------------------
   Поиск
   -------------------------------------------------------------------------- */
.search-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%);
    border-radius: 25px;
    padding: 3rem 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}
.search-form .form-control {
    border-radius: 50px 0 0 50px;
    border: 2px solid rgba(67, 97, 238, 0.2);
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
}
.search-form .btn {
    border-radius: 0 50px 50px 0;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}
.search-input {
    border: 2px solid var(--primary-color);
    border-radius: 50px 0 0 50px;
    padding: 15px 20px;
    font-size: 1.1rem;
}
.search-btn {
    border-radius: 0 50px 50px 0;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Таблицы (магазин и общие)
   -------------------------------------------------------------------------- */
.table {
    background-color: var(--background-light);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}
.table th {
    background: linear-gradient(135deg, #4361ee 0%, #4895ef 100%);
    color: white;
    font-weight: 600;
    border: none;
}
.table-hover tbody tr:hover {
    background-color: rgba(67, 97, 238, 0.03);
}

/* --------------------------------------------------------------------------
   Карточки статистики
   -------------------------------------------------------------------------- */
.stat-card {
    background: linear-gradient(135deg, var(--background-light) 0%, #ffffff 100%);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
    padding: 2rem;
    transition: all 0.4s ease;
    border: none;
    height: 100%;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}
.stat-card .number {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-card h3 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --------------------------------------------------------------------------
   Печать (магазин: order_success)
   -------------------------------------------------------------------------- */
/* Печать order_success (компактный чек) */
@media print {
    /* При печати накладной (#print-invoice виден) — печатаем только её */
    body * { visibility: hidden; }
    #print-invoice,
    #print-invoice * { visibility: visible; }
    #print-invoice {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 12px !important;
        background: #fff !important;
        display: block !important;
    }
    .no-print,
    .btn:not(.print-btn),
    footer,
    header,
    .breadcrumb,
    .progress-section,
    .additional-actions,
    .success-icon,
    .lead,
    .alert,
    .card.bg-info,
    .actions-section:not(.print-actions) {
        display: none !important;
    }
    body {
        font-size: 9pt;
        line-height: 1.2;
        padding: 5px;
    }
    .card-body { padding: 5px; }
    .print-header h1 { font-size: 12pt; }
    .print-header p { font-size: 7pt; margin: 1px 0; }
    .table { font-size: 8pt; margin-bottom: 8px; }
    .table th, .table td { padding: 2px 3px; border: 1px solid #000; }
    .table th { font-size: 7pt; }
}

/* --------------------------------------------------------------------------
   Адаптивность
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0;
        text-align: center;
    }
    .hero-section h1 { font-size: 2rem; }
    .search-form .form-control,
    .search-form .btn {
        border-radius: 50px;
        margin-bottom: 1rem;
    }
    .categories-list { justify-content: center; }
    .stat-card .number { font-size: 2.2rem; }
}
@media (max-width: 576px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
    .product-card { margin-bottom: 1.5rem; }
    .stat-card { padding: 1.5rem; }
}

/* --------------------------------------------------------------------------
   Анимации и утилиты
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}
.rounded-xl { border-radius: 25px !important; }
.rounded-xxl { border-radius: 30px !important; }
.shadow-soft { box-shadow: 0 5px 20px rgba(0,0,0,0.05) !important; }
.shadow-strong { box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important; }
.bg-gradient-primary {
    background: linear-gradient(135deg, #4361ee 0%, #4895ef 100%) !important;
}
.bg-gradient-light {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%) !important;
}
.text-gradient {
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
