/* 🌙 Темная тема "Режим для Оли" */

/* Критический фон для мгновенного применения */
html.dark-theme {
    background: #1a1a1a !important;
}

html.dark-theme,
body.dark-theme {
    background: #1a1a1a;
    color: #eee;
}

/* Отключаем transitions при первой загрузке */
html.dark-theme.preload *,
html.dark-theme.preload *::before,
html.dark-theme.preload *::after {
    transition: none !important;
}

body.dark-theme #backgroundCanvas {
    opacity: 0.3;
}

body.dark-theme .container {
    color: #eee;
}

body.dark-theme header {
    background: rgba(30, 30, 30, 0.95);
    color: #eee;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

body.dark-theme header h1 {
    color: #ffffff;
}

body.dark-theme header .subtitle {
    color: #b0b0b0;
}

body.dark-theme .step-card {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    color: #eee;
}

body.dark-theme .step-header h2 {
    color: #eee;
}

body.dark-theme .upload-area {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.15);
}

body.dark-theme .upload-area:hover {
    background: rgba(118, 75, 162, 0.25);
}

body.dark-theme .upload-text {
    color: #b0b0b0;
}

body.dark-theme .file-info {
    background: rgba(102, 126, 234, 0.2);
    border-left: 4px solid #667eea;
}

body.dark-theme .file-info p {
    color: #eee;
}

body.dark-theme .hint {
    color: #b0b0b0;
}

body.dark-theme .minimum-item {
    background: rgba(102, 126, 234, 0.15);
    border: 2px solid rgba(102, 126, 234, 0.4);
}

body.dark-theme .minimum-item label {
    color: #eee;
}

body.dark-theme .minimum-item input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #444;
    color: #eee;
}

body.dark-theme .minimum-item input:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.15);
}

body.dark-theme .minimum-item select {
    background: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.4);
    color: #eee;
}

body.dark-theme .minimum-item select:focus {
    background: rgba(30, 30, 30, 1);
    border-color: #667eea;
}

body.dark-theme .minimums-container {
    color: #eee;
}

body.dark-theme .legend {
    background: rgba(102, 126, 234, 0.15);
}

body.dark-theme .legend h3 {
    color: #eee;
}

body.dark-theme #resultsTable {
    background: rgba(30, 30, 30, 0.95);
}

body.dark-theme #resultsTable th {
    background: #D52B1E;
}

body.dark-theme #resultsTable td {
    border: 1px solid #444;
    color: #eee;
}

body.dark-theme #resultsTable tbody tr:hover {
    background: rgba(102, 126, 234, 0.15);
}

/* Цвета статусов в темной теме */
body.dark-theme .cell-red {
    background-color: rgba(220, 53, 69, 0.3) !important;
    color: #ffcccc;
}

body.dark-theme .cell-yellow {
    background-color: rgba(255, 193, 7, 0.3) !important;
    color: #fff9cc;
}

body.dark-theme .cell-white {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #eee;
}

body.dark-theme .cell-green {
    background-color: rgba(40, 167, 69, 0.3) !important;
    color: #ccffcc;
}

/* Room cards */
body.dark-theme .room-card {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

body.dark-theme .room-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.7);
}

body.dark-theme .room-header {
    border-bottom: 2px solid #333;
}

body.dark-theme .room-header h3 {
    color: #a0a0ff;
}

body.dark-theme .room-details p {
    color: #b0b0b0;
}

body.dark-theme .btn-icon {
    background: #333;
    color: #eee;
}

/* Modal */
body.dark-theme .modal {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-theme .modal-content {
    background: rgba(30, 30, 30, 0.98);
    color: #eee;
}

body.dark-theme .modal-header {
    border-bottom: 2px solid #333;
}

body.dark-theme .modal-header h2 {
    color: #a0a0ff;
}

body.dark-theme .modal-close {
    color: #b0b0b0;
}

body.dark-theme .modal-close:hover {
    color: #fff;
}

body.dark-theme .modal-footer {
    border-top: 2px solid #333;
}

body.dark-theme .modal-body .form-group label {
    color: #eee;
}

body.dark-theme .modal-body .form-group input,
body.dark-theme .modal-body .form-group textarea {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #444;
    color: #eee;
}

body.dark-theme .modal-body .form-group input:focus,
body.dark-theme .modal-body .form-group textarea:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #667eea;
}

/* Check list specific */
body.dark-theme.check-list-page {
    background: #1a1a1a !important;
}

body.dark-theme .check-container {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

body.dark-theme .check-container header {
    background: transparent;
}

body.dark-theme .check-container header h1 {
    color: #ffffff;
}

body.dark-theme .check-container header p {
    color: #b0b0b0 !important;
}

body.dark-theme .upload-section {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.05);
}

body.dark-theme .upload-section h2 {
    color: #eee;
}

body.dark-theme .upload-section p {
    color: #b0b0b0;
}

body.dark-theme .back-button {
    background: linear-gradient(135deg, #D52B1E 0%, #A01F15 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(213, 43, 30, 0.4);
}

body.dark-theme .back-button:hover {
    background: linear-gradient(135deg, #A01F15 0%, #D52B1E 100%);
    box-shadow: 0 6px 20px rgba(213, 43, 30, 0.6);
}

body.dark-theme .group-mapping-section,
body.dark-theme .minimums-section {
    background: rgba(30, 30, 30, 0.5);
    border: 2px solid rgba(102, 126, 234, 0.3);
}

body.dark-theme .group-mapping-section h2,
body.dark-theme .minimums-section h2 {
    color: #a0a0ff;
}

body.dark-theme .group-mapping-section h3,
body.dark-theme .minimums-section h3 {
    color: #eee;
}

body.dark-theme .mapping-item {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
}

body.dark-theme .mapping-item strong {
    color: #a0a0ff;
}

body.dark-theme .results-section {
    color: #eee;
}

body.dark-theme .results-section h2 {
    color: #a0a0ff;
}

body.dark-theme .issue-list li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #eee;
}

body.dark-theme #loading p {
    color: #eee;
}

body.dark-theme .error-report-box {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(220, 53, 69, 0.5);
}

body.dark-theme .error-report-header {
    background: rgba(220, 53, 69, 0.2);
    color: #ffcccc;
}

body.dark-theme .error-report-content {
    background: rgba(0, 0, 0, 0.3);
    color: #eee;
}

body.dark-theme .error-report-text {
    background: rgba(0, 0, 0, 0.5);
    color: #eee;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme details {
    background: rgba(30, 30, 30, 0.5);
    border: 2px solid rgba(220, 53, 69, 0.4);
}

body.dark-theme summary {
    color: #ffcccc;
    background: rgba(220, 53, 69, 0.2);
}

body.dark-theme summary:hover {
    background: rgba(220, 53, 69, 0.3);
}

body.dark-theme pre {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #eee;
}

body.dark-theme input[type="file"] {
    color: #eee;
}

body.dark-theme input[type="file"]::file-selector-button {
    background: linear-gradient(135deg, #D52B1E 0%, #A01F15 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

body.dark-theme input[type="file"]::file-selector-button:hover {
    background: linear-gradient(135deg, #A01F15 0%, #8B1A12 100%);
    transform: translateY(-2px);
}

body.dark-theme code {
    background: rgba(102, 126, 234, 0.2);
    color: #a0a0ff;
    padding: 2px 6px;
    border-radius: 4px;
}

body.dark-theme hr {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .status-box {
    background: rgba(255, 255, 255, 0.05);
    border-left-width: 4px;
}

body.dark-theme .status-success {
    background: rgba(40, 167, 69, 0.2);
    color: #ccffcc;
}

body.dark-theme .status-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #fff9cc;
}

body.dark-theme .status-error {
    background: rgba(220, 53, 69, 0.2);
    color: #ffcccc;
}

body.dark-theme .status-info {
    background: rgba(23, 162, 184, 0.2);
    color: #b8e7f5;
}

body.dark-theme .error-report-box {
    background: rgba(0, 0, 0, 0.3);
    color: #eee;
}

body.dark-theme .group-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #fff9cc;
}

body.dark-theme select {
    background: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.4);
    color: #eee;
}

body.dark-theme select:focus {
    background: rgba(30, 30, 30, 1);
    border-color: #667eea;
}

body.dark-theme select option {
    background: rgba(30, 30, 30, 0.98);
    color: #eee;
    padding: 10px;
}

body.dark-theme select option:hover {
    background: rgba(102, 126, 234, 0.3);
}

body.dark-theme select option:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

body.dark-theme select option[value=""] {
    color: #b0b0b0;
    font-style: italic;
}

body.dark-theme select option:disabled {
    color: #666;
}

/* Letter preview */
body.dark-theme #letterPreview {
    background: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.4);
    color: #eee;
}

body.dark-theme #letterText {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(102, 126, 234, 0.3);
    color: #eee;
}

body.dark-theme .letter-preview-box {
    background: rgba(30, 30, 30, 0.5);
    border-left: 4px solid #667eea;
}

body.dark-theme .letter-preview-box h3 {
    color: #a0a0ff;
}

body.dark-theme .letter-preview-box p {
    color: #eee;
}

/* Textarea specific */
body.dark-theme #letterText,
body.dark-theme textarea#letterText {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid rgba(102, 126, 234, 0.4);
    color: #eee;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body.dark-theme #letterText:focus,
body.dark-theme textarea#letterText:focus {
    background: rgba(30, 30, 30, 0.95);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Copy button */
body.dark-theme .btn-copy {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

body.dark-theme .btn-copy:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
}

/* Letter display inline */
body.dark-theme #letterTextInline {
    background: rgba(30, 30, 30, 0.8) !important;
    border: 2px solid rgba(102, 126, 234, 0.4) !important;
    color: #eee !important;
}

body.dark-theme #recipientEmailInline {
    color: #a0a0ff !important;
}

body.dark-theme #letterPreviewBox {
    background: rgba(30, 30, 30, 0.5);
}

body.dark-theme #letterPreviewBox h3 {
    color: #eee;
}

body.dark-theme #letterPreviewBox small {
    color: #b0b0b0 !important;
}

body.dark-theme #letterPreviewBox > div {
    background: rgba(102, 126, 234, 0.15) !important;
}

/* Override inline styles for letter elements */
body.dark-theme div[style*="background: #f9f9f9"],
body.dark-theme div[style*="background:#f9f9f9"] {
    background: rgba(30, 30, 30, 0.8) !important;
    border-color: rgba(102, 126, 234, 0.4) !important;
    color: #eee !important;
}

body.dark-theme div[style*="background: rgba(102, 126, 234, 0.1)"] {
    background: rgba(102, 126, 234, 0.15) !important;
}

body.dark-theme span[style*="color: #333"] {
    color: #a0a0ff !important;
}

body.dark-theme small[style*="color: #666"] {
    color: #b0b0b0 !important;
}

body.dark-theme h3 {
    color: #eee;
}

/* Step cards content */
body.dark-theme .step-card div[style*="white-space: pre-wrap"] {
    background: rgba(30, 30, 30, 0.8) !important;
    border-color: rgba(102, 126, 234, 0.4) !important;
    color: #eee !important;
}

body.dark-theme .step-card div[style*="font-family: monospace"] span {
    color: #a0a0ff !important;
}

/* Email recipient box */
body.dark-theme div[style*="border-left: 4px solid #667eea"] {
    background: rgba(102, 126, 234, 0.15) !important;
    border-left-color: #667eea !important;
}

body.dark-theme div[style*="border-left: 4px solid #667eea"] small {
    color: #b0b0b0 !important;
}

/* General text color fixes */
body.dark-theme .step-card p,
body.dark-theme .step-card div,
body.dark-theme .step-card span {
    color: inherit;
}

/* Messages specific */
body.dark-theme .messages-container {
    color: #eee;
}

body.dark-theme .messages-header {
    color: white;
}

body.dark-theme .messages-card {
    background: rgba(30, 30, 30, 0.95);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

body.dark-theme .template-item {
    background: rgba(102, 126, 234, 0.15);
    border-left: 4px solid #667eea;
}

body.dark-theme .template-item h3 {
    color: #a0a0ff;
}

body.dark-theme .template-item textarea {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #444;
    color: #eee;
}

body.dark-theme .template-item textarea:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #667eea;
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-size: 2em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.theme-toggle-tooltip {
    position: absolute;
    top: 50%;
    right: 75px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.theme-toggle:hover .theme-toggle-tooltip {
    opacity: 1;
}

body.dark-theme .theme-toggle {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

body.dark-theme .theme-toggle:hover {
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

/* Buttons in dark theme - ВСЕ КРАСНЫЕ */
body.dark-theme .btn {
    background: linear-gradient(135deg, #D52B1E 0%, #A01F15 100%);
    color: white;
    border: none;
}

body.dark-theme .btn:hover {
    background: linear-gradient(135deg, #A01F15 0%, #8B1A12 100%);
    transform: translateY(-2px);
}

body.dark-theme .btn-primary {
    background: linear-gradient(135deg, #D52B1E 0%, #A01F15 100%);
}

body.dark-theme .btn-primary:hover {
    background: linear-gradient(135deg, #A01F15 0%, #D52B1E 100%);
}

body.dark-theme .btn-secondary {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

body.dark-theme .btn-secondary:hover {
    background: linear-gradient(135deg, #3a4556 0%, #1d2738 100%);
}

body.dark-theme .btn-success {
    background: linear-gradient(135deg, #D52B1E 0%, #A01F15 100%);
}

body.dark-theme .btn-success:hover {
    background: linear-gradient(135deg, #A01F15 0%, #8B1A12 100%);
}

body.dark-theme .btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

body.dark-theme .btn-icon {
    background: rgba(102, 126, 234, 0.2);
    border: 2px solid rgba(102, 126, 234, 0.4);
}

body.dark-theme .btn-icon:hover {
    background: rgba(102, 126, 234, 0.4);
    border-color: #667eea;
}

/* Forms in dark theme */
body.dark-theme input[type="text"],
body.dark-theme input[type="email"],
body.dark-theme input[type="number"],
body.dark-theme input[type="date"],
body.dark-theme input[type="datetime-local"],
body.dark-theme textarea {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    color: #eee;
}

body.dark-theme input[type="text"]:focus,
body.dark-theme input[type="email"]:focus,
body.dark-theme input[type="number"]:focus,
body.dark-theme input[type="date"]:focus,
body.dark-theme input[type="datetime-local"]:focus,
body.dark-theme textarea:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Labels */
body.dark-theme label {
    color: #eee;
}

/* Back link */
body.dark-theme .back-link {
    background: rgba(102, 126, 234, 0.2);
    border: 2px solid rgba(102, 126, 234, 0.4);
    color: #a0a0ff;
}

body.dark-theme .back-link:hover {
    background: rgba(102, 126, 234, 0.4);
    border-color: #667eea;
    color: #ffffff;
}

/* Info boxes */
body.dark-theme .info-box {
    background: rgba(102, 126, 234, 0.15);
    border-left: 4px solid #667eea;
    color: #eee;
}

/* Stats */
body.dark-theme .stats-grid {
    color: #eee;
}

body.dark-theme .stat-item {
    background: rgba(102, 126, 234, 0.15);
    border: 2px solid rgba(102, 126, 234, 0.3);
}

body.dark-theme .stat-value {
    color: #a0a0ff;
}

/* Loading */
body.dark-theme #loading {
    background: rgba(0, 0, 0, 0.9);
}

body.dark-theme .loader {
    border: 5px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
}

/* Empty state */
body.dark-theme .empty-state {
    color: #b0b0b0;
}

body.dark-theme .empty-state h2 {
    color: #a0a0ff;
}

/* Check list wave container in dark theme */
body.dark-theme .check-list-wave-container {
    background: rgba(30, 30, 30, 0.95) !important;
    animation: none !important;
}

body.dark-theme .check-list-wave-container a {
    background: linear-gradient(135deg, #D52B1E 0%, #A01F15 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(213, 43, 30, 0.4) !important;
}

body.dark-theme .check-list-wave-container a:hover {
    box-shadow: 0 6px 20px rgba(213, 43, 30, 0.6) !important;
}

/* Scrollbar for dark theme */
body.dark-theme ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

body.dark-theme ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 10px;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* Select dropdown arrow */
body.dark-theme select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23eee' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Participant info in dark theme */
body.dark-theme #participantInfoBox {
    background: rgba(102, 126, 234, 0.15);
    border-left: 4px solid #667eea;
}

body.dark-theme #participantInfoBox h4 {
    color: #a0a0ff;
}

body.dark-theme #participantInfoBox p {
    color: #eee;
}

/* Download button highlight */
body.dark-theme #downloadBtn {
    background: linear-gradient(135deg, #D52B1E 0%, #A01F15 100%);
    box-shadow: 0 4px 15px rgba(213, 43, 30, 0.4);
}

body.dark-theme #downloadBtn:hover {
    box-shadow: 0 6px 20px rgba(213, 43, 30, 0.6);
    transform: translateY(-2px);
}

/* End date editing */
body.dark-theme #endDateInput {
    background: rgba(30, 30, 30, 0.95);
    border: 2px solid rgba(102, 126, 234, 0.6);
    color: #eee;
}

body.dark-theme #endDateInput:focus {
    background: rgba(30, 30, 30, 1);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

body.dark-theme #saveEndDateBtn {
    background: linear-gradient(135deg, #D52B1E 0%, #A01F15 100%);
}

body.dark-theme #saveEndDateBtn:hover {
    background: linear-gradient(135deg, #A01F15 0%, #8B1A12 100%);
    transform: translateY(-2px);
}

body.dark-theme #cancelEndDateBtn {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
}

body.dark-theme #cancelEndDateBtn:hover {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    transform: translateY(-2px);
}

body.dark-theme .edit-date-btn {
    color: rgba(255, 255, 255, 0.8) !important;
}

body.dark-theme .edit-date-btn:hover {
    color: rgba(255, 255, 255, 1) !important;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* AXES logo in dark theme - оставляем красным */
body.dark-theme .axes-logo {
    filter: none !important;
}

