/* Основные стили SVETILUS */

/* CSS переменные для светлой темы */
:root {
    --bg-primary: #f8f9fa;
    --bg-secondary: white;
    --bg-hover: #f5f5f5;
    --bg-table-header: #edf2f7;
    --text-primary: #333;
    --text-secondary: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --border-color-light: #cbd5e0;
    --accent-primary: #4299e1;
    --accent-secondary: #3182ce;
    --accent-success: #48bb78;
    --accent-success-dark: #38a169;
    --accent-danger: #e53e3e;
    --shadow-sm: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.2);
    --modal-backdrop: rgba(0,0,0,0.5);
}

/* CSS переменные для темной темы */
:root.dark-theme,
body.dark-theme {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-hover: #223344;
    --bg-table-header: #374151;
    --text-primary: #e2e8f0;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: #4a5568;
    --border-color-light: #718096;
    --accent-primary: #1177cc;
    --accent-secondary: #1177aa;
    --accent-success: #44ff77;
    --accent-success-dark: #116611;
    --accent-danger: #fc8181;
    --shadow-sm: 0 4px 20px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.6);
    --modal-backdrop: rgba(0,0,0,0.7);
}

html {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

html.dark-theme {
    background-color: #1a202c !important;
    color: #e2e8f0 !important;
}

/* Перезаписываем стили Markdown Preview для темной темы */
html.dark-theme body {
    background-color: #1a202c !important;
    color: #e2e8f0 !important;
}



body h1,
body h2,
body h3,
body h4,
body h5,
body h6 {
    color: #444 !important;
}

body h2 {  
    padding-top: 50px !important;
}

body h3 {  
    padding-top: 20px !important;
}
hr {
    margin:70px 0 !important;
}

html.dark-theme body h1,
html.dark-theme body h2,
html.dark-theme body h3,
html.dark-theme body h4,
html.dark-theme body h5,
html.dark-theme body h6 {
    color: #eee !important;
}

html.dark-theme body strong {
    color: #e2e8f0 !important;
}

html.dark-theme body a {
    color: #63b3ed !important;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: sans-serif !important; 
    line-height: 1.6; 
    color: var(--text-primary) !important; 
    background-color: var(--bg-primary) !important; 
    margin: 0 auto; 
    padding: 20px; 
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.container { 
    background: var(--bg-secondary) !important; 
    border-radius: 12px; 
    box-shadow: var(--shadow-sm); 
    padding: 30px; 
    margin: 20px 0;
    transition: background-color 0.3s ease;
}
h1, h2, h3 { 
    color: var(--text-secondary) !important; 
    margin: 24px 0 16px;
    transition: color 0.3s ease;
}
h1 { 
    font-size: 2.5rem; 
    border-bottom: 3px solid var(--accent-primary); 
    padding-bottom: 10px;
}
table { 
    border-collapse: collapse; 
    margin: 24px 0; 
    width: 100%;
    transition: all 0.3s ease;
}
th, td { 
    padding: 16px; 
    text-align: left; 
    border-bottom: 1px solid var(--border-color) !important;
    transition: border-color 0.3s ease;
    color: var(--text-primary) !important;
    box-sizing: border-box;
}
th { 
    background: var(--bg-table-header) !important; 
    color: var(--text-secondary) !important; 
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease;
}
tr:hover { 
    background: var(--bg-hover) !important;
}

/* Кнопки */
.btn { 
    display: inline-block; 
    padding: 5px 12px; 
    border: none; 
    border-radius: 6px; 
    font-size: 1rem; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn-buy { 
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%); 
    color: white;
}
.btn-buy.in-cart { 
    background: linear-gradient(135deg, var(--accent-success) 0%, var(--accent-success-dark) 100%);
}
.btn-buy.added { animation: pulse 0.3s ease-in-out; }
.btn-waitlist { 
    background: linear-gradient(135deg, var(--accent-success) 0%, var(--accent-success-dark) 100%); 
    color: white; 
    padding: 14px 28px; 
    font-size: 1.1rem;
    
}
.btn-primary { 
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%); 
    color: white; 
    padding: 12px 24px;
}
.btn-secondary { 
    background: var(--border-color); 
    color: var(--text-muted); 
    padding: 12px 24px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Значок корзины с расширением */
.cart-icon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-secondary);
    border-radius: 50px;
    min-width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0;
    font-size: 24px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2px solid var(--accent-primary);
    overflow: visible;
    white-space: nowrap;
}

.cart-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(0,0,0,0.3);
}

.cart-icon.has-items {
    background: linear-gradient(135deg, var(--accent-success) 0%, var(--accent-success-dark) 100%);
    color: white;
    border-color: var(--accent-success-dark);
}

/* Иконка корзины */
.cart-icon-emoji {
    font-size: 24px;
    transition: all 0.3s;
    flex-shrink: 0;
}

/* Счетчик товаров */
.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--accent-danger);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s;
    z-index: 10;
}

/* Расширенное содержимое (текст + сумма) */
.cart-expanded-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    padding-right: 0;
}

.cart-text {
    
    font-weight: 600;
    line-height: 1.2;
}

.cart-total {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

/* Расширенное состояние корзины */
.cart-icon.expanded {
    min-width: 220px;
    padding: 0 20px 0 15px;
    border-radius: 50px;
}

.cart-icon.expanded .cart-expanded-content {
    max-width: 150px;
    opacity: 1;
    padding-right: 5px;
}

/* Счетчик остается в правом верхнем углу всегда */
.cart-icon.expanded .cart-count {
    right: -5px;
    top: -5px;
}

/* Модальное окно корзины */
.cart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-backdrop);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}
.cart-modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transition: background-color 0.3s ease;
}
.cart-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s ease;
}
.cart-modal-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}
.cart-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.cart-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.cart-modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}
.cart-empty {
    text-align: center;
    padding: 40px 20px;
}
.cart-empty p {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

/* Элементы корзины */
.cart-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: border-color 0.3s ease;
}
.cart-item:last-child {
    border-bottom: none;
}
.cart-item-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}
.cart-item-prices {
    display: flex;
    gap: 8px;
    align-items: center;
}
.cart-item-price-old {
    text-decoration: line-through;
    color: var(--text-muted);
    
    transition: color 0.3s ease;
}
.cart-item-price-discount {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 16px;
    transition: color 0.3s ease;
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-item-controls button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color-light);
    background: var(--bg-secondary);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.cart-item-controls button:hover:not(:disabled) {
    background: var(--bg-hover);
}
.cart-item-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.cart-item-quantity {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
}
.cart-item-remove {
    margin-left: 8px;
    color: var(--accent-danger);
    transition: color 0.3s ease;
}
.cart-item-total {
    text-align: right;
}
.cart-item-total span {
    display: block;
    font-weight: 600;
    font-size: 16px;
}
.cart-item-total small {
    color: var(--accent-success);
    
    transition: color 0.3s ease;
}

/* Футер корзины */
.cart-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-hover);
    border-radius: 0 0 12px 12px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.cart-summary {
    margin-bottom: 20px;
}
.cart-total, .cart-savings {
    display: flex;
    justify-content: space-between;    
}
.cart-total {
    font-size: 18px;
    font-weight: 600;
}
.cart-savings {
    color: var(--accent-success);
    
    transition: color 0.3s ease;
}
.cart-actions {
    display: flex;
    gap: 12px;
}
.cart-actions .btn {
    flex: 1;
}

/* Медиа элементы */
.media-photo, .media-video { 
    margin: 24px 0;     
    overflow: hidden;    
}
.media-photo img { width: 100%; height: auto; display: block; }
.video-placeholder { 
    padding: 60px 20px; 
    text-align: center; 
    color: var(--text-muted);
    transition: color 0.3s ease;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Анимации для корзины */
@keyframes cartPulse {
    0% { transform: scale(1); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
    50% { transform: scale(1.2); box-shadow: 0 6px 30px rgba(66, 153, 225, 0.6); }
    100% { transform: scale(1); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
}

@keyframes cartBounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-15px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-8px); }
}

@keyframes cartShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
    75% { transform: rotate(-5deg); }
}

@keyframes cartGlow {
    0% { box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
    50% { box-shadow: 0 0 30px rgba(66, 153, 225, 0.8), 0 0 40px rgba(66, 153, 225, 0.4); }
    100% { box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
}

/* Постоянная пульсация при наличии товаров */
.cart-icon.pulsing {
    animation: subtlePulse 2s infinite ease-in-out;
}

@keyframes subtlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Кнопка переключения темы */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: 0 6px 30px rgba(0,0,0,0.3);
}

.theme-toggle:active {
    transform: scale(0.95) rotate(-20deg);
}

/* Адаптивность */
@media (max-width: 768px) {
    body { padding: 10px; }
    .container { padding: 20px; margin: 10px 0; }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    table { display: block; overflow-x: auto; }
    th, td { padding: 12px 8px; font-size: 0.9rem; }
    .btn { width: 100%; margin-bottom: 10px; }
    
    .cart-icon {
        bottom: 20px;
        right: 20px;
        min-width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .cart-icon.expanded {
        min-width: 200px;
        padding: 0 18px 0 12px;
    }
    
    .cart-icon-emoji {
        font-size: 20px;
    }
    
    .cart-text {
        font-size: 13px;
    }
    
    .cart-total {
        
    }
    
    .theme-toggle {
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .cart-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    .cart-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .cart-item-total {
        text-align: left;
    }
    .cart-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .cart-icon {
        bottom: 15px;
        right: 15px;
        min-width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .cart-icon.expanded {
        min-width: 180px;
        padding: 0 15px 0 10px;
    }
    
    .cart-icon-emoji {
        font-size: 18px;
    }
    
    .cart-text {
        
    }
    
    .cart-total {
        font-size: 13px;
    }
    
    .cart-count {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    
    .theme-toggle {
        bottom: 15px;
        left: 15px;
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    /* Дополнительные стили для очень маленьких экранов */
    tbody td:not(:last-child):before {
        width: 35%;
        min-width: fit-content;
        
    }
    
    tbody td {
        
        padding: 10px 0;
    }
    
    tbody tr {
        padding: 15px 12px;
    }
    
    .btn-buy, .btn-buy.in-cart {
        padding: 12px 16px;
        
    }
    
    /* Для таблиц с двумя колонками (например, FAQ) */
    table td:first-child {
        font-weight: bold;
    }
}

/* Планшеты (горизонтальные и небольшие экраны) */
@media (max-width: 992px) and (min-width: 769px) {
    table {
        font-size: 130% !important;
    }
    
    th, td {
        padding: 14px 10px !important;
    }
    
    /* Начинаем применять карточный дизайн для компактности */
    tbody tr {
        transition: all 0.3s ease;
    }
    
    tbody tr:hover {
        background-color: var(--bg-hover);
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
    }
}

/* Удалена старая кнопка оформления заказа - функционал интегрирован в значок корзины */
html body table td, html body table th {
    border-color:#888 !important;
    font-size:150% !important;
}
html.dark-theme body table td, html.dark-theme body table th {
    border-color:#aaa !important;
    font-size:150% !important;
}
blockquote {
    padding:15px !important;
    font-size:110% !important;
    background-color: var(--border-color);
    color: var(--text-primary);
}
html.dark-theme blockquote {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* Стили для кнопок управления сворачиваемыми блоками */
.collapsible-controls {
    position: fixed;
    bottom: 100px;
    left: 30px;
    /*display: flex;*/
    display: none !important;
    gap: 10px;
    z-index: 999;    
}

.collapsible-controls .btn {
    padding: 8px 16px;
    
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.collapsible-controls .btn:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .collapsible-controls {
        bottom: 80px;
        left: 20px;
        flex-direction: column;
    }
    
    .collapsible-controls .btn {
        padding: 6px 12px;
        
    }
    
    /* Адаптивные таблицы для мобильных */
    table {
        display: block;
        width: 100%;
        overflow-x: hidden;
        border: none;
        margin: 20px 0;
    }
    
    thead {
        display: none;
    }
    
    tbody {
        display: block;
        width: 100%;
    }
    
    tbody tr {
        display: block;
        width: 100%;
        margin-bottom: 25px;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 20px 15px;
        background: var(--bg-secondary);
        box-shadow: var(--shadow-sm);
        transition: all 0.3s ease;
        box-sizing: border-box;
    }
    
    tbody tr:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }
    
    tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 12px 0;
        border: none;
        border-bottom: 1px solid var(--border-color-light);
        font-size: 100% !important;
    }
    
    tbody td:last-child {
        border-bottom: none;
        padding-top: 15px;
        margin-top: 10px;
        justify-content: center;
    }
    
    /* Псевдо-заголовки для ячеек */
    tbody td:not(:last-child):before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--text-secondary);
        margin-right: 15px;
        flex-shrink: 0;
        width: 35%;
        min-width: fit-content;
    }
    
    tbody td:not(:last-child) {
        text-align: right;
        padding-left: 0;
    }
    
    /* Кнопка покупки - растягиваем на всю ширину */
    .btn-buy {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        margin-top: 5px;
    }
    
    .btn-buy.in-cart {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    /* Убедимся, что кнопка в корзине выглядит хорошо */
    .btn-buy.in-cart:before {
        content: none;
    }
}

/* Стили для сворачиваемых блоков blockquote */
.collapsible-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 0 0;
    padding: 10px 15px;
    background: var(--bg-hover);
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.collapsible-header:hover {
    background: var(--border-color);
}

.collapsible-header h2,
.collapsible-header h3,
.collapsible-header h4,
.collapsible-header h5,
.collapsible-header h6 {
    margin: 0 !important;
    flex: 1;
    color: var(--text-secondary) !important;
}

.collapsible-toggle {
    font-size: 20px;
    transition: transform 0.3s ease;
    color: var(--accent-primary);
    min-width: 24px;
    text-align: center;
}

.collapsible-header.collapsed .collapsible-toggle {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease;
    opacity: 1;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: var(--bg-secondary);
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    border: none;
}

.collapsible-content blockquote {
    margin: 0 !important;
    border-left: 4px solid var(--accent-primary) !important;
    border-radius: 0 0 4px 4px;
    background: var(--bg-hover) !important;
}

.collapsible-content blockquote p {
    margin: 0;
    padding: 15px;
}

/* Анимация для плавного раскрытия */
@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 1000px;
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        max-height: 1000px;
        opacity: 1;
    }
    to {
        max-height: 0;
        opacity: 0;
    }
}

.info1 {
    background: linear-gradient(0deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    padding: 10px;
    border-radius: 10px;
    color: #fff !important;
    font-size:110%;
}
.info1 strong {
    color: #fff !important;
}

html.dark-theme body .info1 {
    background: linear-gradient(0deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);    
    color: #fff !important;
    font-size:110%;
}
html.dark-theme body .info1 strong {
    color: #fff !important;
}
.cart-icon {
    display:none !important;
}