*{
    transition: all 0.2s;
}
:root {
    --main-color: #db1616;
    --main-color-light: #de8787;
    --bg-color-light: rgba(219, 22, 22, 0.1);
    --bg-color-dark: rgba(58, 212, 34, 0.15);
    --solid-bg-light: #ffebee;
    --solid-bg-dark: #1b5e20;
    --text-color: #333;
    --bg-primary: #ffffff;
    --bg-secondary: #f2f2f2;
    --border-color: #ddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body.night-theme {
    --text-color: #d4d4d4;
    --bg-primary: #171717;
    --bg-secondary: #232323;
    --border-color: #444;
    --shadow-color: rgba(255, 255, 255, 0.05);
}

/* Основные стили для элементов с использованием переменных */
body {
    background-color: var(--bg-primary);
    color: var(--text-color);
}

a {
    color: var(--main-color);
}

a:hover {
    color: var(--main-color-light);
}

button {
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

input, textarea {
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-color);
}

input:focus, textarea:focus {
    outline: 1px solid var(--main-color);
    border-color: var(--main-color);
}

/* Контейнер выбора темы */
.color-theme-selector {
    outline: 1px solid var(--main-color);
    border-color: var(--main-color);
    background-color: var(--bg-color-light);
    position: relative;
    border-radius: 10px;
    top: -11px;
}

.theme-selector-header {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 10px;
    font-family: Pompadur, 'site', cursive;
}

/* Ряд с кнопками тем */
.theme-options-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px;
}

/* Кнопка темы */
.theme-option {
    position: relative;
    cursor: pointer;
    transition: 0.2s all;
}

.theme-option:hover {
    transform: scale(1.15);
}

.theme-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px var(--shadow-color);
}

.theme-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Обводка для активной темы */
.theme-option.active .theme-icon {
    box-shadow: 0 0 0 2px var(--main-color), 0 0 0 4px var(--main-color), 0 4px 12px var(--shadow-color);
    /*! animation: pulse 2s infinite; */
}

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

.theme-name {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-color);
    opacity: 0;
    white-space: nowrap;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

.theme-option:hover .theme-name {
    opacity: 1;
}

/* Стили для иконки тёмной/светлой темы */
.theme-mode-toggle {
    margin-left: 10px;
    display: flex;
    align-items: center;
    /*! display: none; */
}

.theme-mode-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    box-shadow: 0 2px 8px var(--shadow-color);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.theme-mode-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.theme-mode-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

body.night-theme .theme-mode-icon {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

body.night-theme .theme-mode-icon:hover {
    box-shadow: 0 0 15px rgba(44, 62, 80, 0.4);
}

/* Контролы темы */
.theme-controls {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    padding: 15px;
    border-radius: 8px;
    background-color: var(--bg-color-light);
    margin-top: 15px;
}

.dark-theme-switch,
.gradient-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.control-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Стили для переключателей */
.dark-switch,
.gradient-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    gap: 8px;
}

.dark-switch input,
.gradient-switch input {
    display: none;
}

.dark-slider,
.gradient-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: color-mix(in srgb, var(--text-color) 30%, transparent);
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.dark-slider:before,
.gradient-slider:before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--bg-primary);
    top: 1px;
    left: 2px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.dark-switch input:checked + .dark-slider,
.gradient-switch input:checked + .gradient-slider {
    background-color: var(--main-color);
}

.dark-switch input:checked + .dark-slider:before,
.gradient-switch input:checked + .gradient-slider:before {
    transform: translateX(26px);
    background-color: white;
}

.dark-label,
.gradient-label {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    min-width: 80px;
    text-align: center;
}

/* Статус темы */
.theme-status {
    text-align: center;
    padding: 10px;
    margin-top: 10px;
    background-color: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.current-theme-info {
    font-size: 13px;
    color: var(--text-color);
}

.current-theme-name {
    font-weight: bold;
    color: var(--main-color);
    text-transform: capitalize;
}

/* Элементы с полупрозрачным фоном */
.transparent-bg {
    background-color: var(--bg-color-light);
}

body.night-theme .transparent-bg {
    background-color: var(--bg-color-dark);
}

/* Элементы с сплошным фоном */
.solid-bg-light {
    background-color: var(--solid-bg-light);
}

.solid-bg-dark {
    background-color: var(--solid-bg-dark);
}

/* Специфические элементы */
.comment.admin-comment {
    background-color: var(--bg-color-light);
    border-left: 3px solid var(--main-color);
}

body.night-theme .comment.admin-comment {
    background-color: var(--main-color-dark-opaque);
}

.reaction-btn.user-reacted {
    background-color: var(--bg-color-light);
    border: 1px solid var(--main-color);
}

body.night-theme .reaction-btn.user-reacted {
    background-color: var(--bg-color-dark);
}

.submit-comment {
    background-color: var(--main-color);
}

.submit-comment:hover {
    background-color: var(--main-color-light);
}

/* Анимации */
@keyframes themeChange {
    0% { opacity: 0.8; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

.theme-changing {
    animation: themeChange 0.5s ease;
}

/* Адаптивность */
@media screen and (max-width: 525px) {
    .color-theme-selector {
        float: right;
        margin-top: 10px;
    }
    
}
@media screen and (max-width: 410px) {
    .color-theme-selector > .theme-options-row > .theme-mode-toggle {
        display: none;
    }
}
@media screen and (max-width: 455px) {
  .theme-options-row {
    gap: 5px;
  }
}
@media screen and (min-width: 408px) {
    .color-theme-selector > .theme-options-row > .theme-mode-toggle {
        display: block !important;
    }
}
@media screen and (min-width: 349px) and (max-width: 369px) {
    .color-theme-selector > .theme-options-row > .theme-mode-toggle {
        display: block !important;
    }
}
@media screen and (min-width: 769px) {
    .color-theme-selector{
        top: -7px;
    }
}
@media screen and (max-width: 768px) {
    .color-theme-selector {
        /*! padding: 12px; */
        /*! margin: 15px 0; */
        top: -8px;
    }
    
    .theme-options-row {
        /*! gap: 10px; */
    }
    
    .theme-icon {
        width: 36px;
        height: 36px;
    }
    
    .theme-mode-icon {
        width: 32px;
        height: 32px;
    }
    
    .theme-mode-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .theme-controls {
        flex-direction: column;
        gap: 15px;
        padding: 12px;
    }
    
    .dark-theme-switch,
    .gradient-toggle {
        justify-content: center;
    }
    
    .dark-slider,
    .gradient-slider {
        width: 45px;
        height: 22px;
    }
    
    .dark-slider:before,
    .gradient-slider:before {
        width: 18px;
        height: 18px;
    }
    
    .theme-name {
        font-size: 9px;
        bottom: -18px;
    }
}


/* Специальные стили для разных тем */
[data-theme="red"] .theme-icon {
    background: linear-gradient(135deg, #cd0b0c, #db1616);
}

[data-theme="green"] .theme-icon {
    background: linear-gradient(135deg, #16c807, #0f9504);
}

[data-theme="orange"] .theme-icon {
    background: linear-gradient(135deg, #e67e22, #f39c12);
}

[data-theme="yellow"] .theme-icon {
    background: linear-gradient(135deg, #f1c40f, #bf7e15);
}

[data-theme="pink"] .theme-icon {
    background: linear-gradient(135deg, #e84393, #fd79a8);
}

[data-theme="blue"] .theme-icon {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

[data-theme="purple"] .theme-icon {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

/* Состояния hover для тем */
[data-theme="red"]:hover .theme-icon {
    box-shadow: 0 0 15px rgba(219, 22, 22, 0.4);
}

[data-theme="green"]:hover .theme-icon {
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
}

[data-theme="orange"]:hover .theme-icon {
    box-shadow: 0 0 15px rgba(230, 126, 34, 0.4);
}

[data-theme="yellow"]:hover .theme-icon {
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.4);
}

[data-theme="pink"]:hover .theme-icon {
    box-shadow: 0 0 15px rgba(232, 67, 147, 0.4);
}

[data-theme="blue"]:hover .theme-icon {
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
}

[data-theme="purple"]:hover .theme-icon {
    box-shadow: 0 0 15px rgba(155, 89, 182, 0.4);
}

/* Улучшенная доступность */
.theme-option:focus {
    outline: 2px solid var(--main-color);
    outline-offset: 2px;
}

.theme-mode-icon:focus {
    outline: 2px solid var(--main-color);
    outline-offset: 2px;
}

.dark-switch:focus .dark-slider,
.gradient-switch:focus .gradient-slider {
    outline: 2px solid var(--main-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .theme-icon {
        border: 2px solid var(--text-color);
    }
    
    .theme-option.active .theme-icon {
        border-width: 4px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .theme-option,
    .theme-icon,
    .theme-mode-icon {
        transition: none;
    }
    
    .theme-option.active .theme-icon {
        animation: none;
    }
}