/* ============================================
   Coffee Evaluation Calculator - Components (buttons, toast, pagination, footer)
   ============================================ */

.toast {
    background: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px var(--shadow-hover);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: toastSlideIn var(--transition-normal);
    max-width: 300px;
    width: 100%;
}

.toast.success {
    border-left: 4px solid var(--quality-excellent);
}

.toast.error {
    border-left: 4px solid var(--quality-poor);
}

.toast.info {
    border-left: 4px solid var(--accent);
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-100%); }
}

.placeholder-text {
text-align: center;
    color: var(--text-light);
    font-style: italic;
    padding: var(--spacing-lg);
}

/* Footer */

.footer {
text-align: center;
    padding: var(--spacing-lg);
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-xl);
}

/* Responsive Design */

button:focus-visible,
input:focus-visible,
select:focus-visible {
outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ========== Tab Navigation Buttons ========== */

.tab-nav-row {
display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

.tab-nav-row > .nav-left,
.tab-nav-row > .nav-center,
.tab-nav-row > .nav-right {
    flex: 1;
    display: flex;
}
.tab-nav-row > .nav-left { justify-content: flex-start; }
.tab-nav-row > .nav-center { justify-content: center; }
.tab-nav-row > .nav-right { justify-content: flex-end; }

.btn-nav-back {
background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-nav-back:hover {
border-color: var(--accent);
    color: var(--accent);
    background: rgba(139, 69, 19, 0.05);
    transform: translateX(-3px);
}

.btn-nav-main {
padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 0 0 auto;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.btn-nav-main:hover {
transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

/* Radar Chart Size Control */

.radar-chart-container canvas {
max-width: 350px !important;
    margin: 0 auto !important;
    display: block;
}

/* Кнопка "Новый расчет" — предупреждающий красный */

.btn-new-calc {
background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white;
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
}

.btn-new-calc:hover {
transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.5);
    background: linear-gradient(135deg, #e74c3c 0%, #ff6b6b 100%);
}

/* Адаптивные стили для кнопок истории на мобильных */

/* Таблица "Информация о кофе" в спойлере истории */

.history-info-table {
width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 13px;
}

.history-info-table td {
padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.history-info-table tr:last-child td {
border-bottom: none;
}

.history-info-table .info-label {
color: var(--text-light);
    font-weight: 500;
    width: 50%;
    padding-right: 12px;
}

.history-info-table .info-value {
color: var(--text-primary);
}

/* Кнопки экспорта и удаления в спойлере истории */

.history-actions-inline {
display: flex;
    gap: 10px;
    align-items: center;
    margin-right: 8px;
}

.history-pdf {
display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid #2196F3;
    border-radius: 8px;
    font-size: 20px;
    color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.history-pdf:hover {
background: rgba(33, 150, 243, 0.15);
    transform: scale(1.05);
}

.history-delete {
display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid #e53935;
    border-radius: 8px;
    font-size: 20px;
    color: #e53935;
    background: rgba(229, 57, 53, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.history-delete:hover {
background: rgba(229, 57, 53, 0.15);
    transform: scale(1.05);
}

/* Центрирование текста фермы и сорта в спойлере */

.history-coffee-info {
text-align: center;
    margin: 0 auto;
    max-width: 500px;
    margin-bottom: 12px;
}

/* ============================================
   Выпадающий список сортировки истории
   ============================================ */

.history-sort-select {
padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: white;
    transition: all var(--transition-fast);
}

.history-sort-select:hover {
border-color: var(--accent);
}

.history-sort-select:focus {
outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(107, 166, 255, 0.2);
}

/* ============================================
   History Compact Table (new tab layout)
   ============================================ */

.history-compact-list {
display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-compact-item {
border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.history-compact-item:hover {
border-color: var(--coffee-light);
    box-shadow: 0 2px 8px var(--shadow);
}

.history-compact-row {
display: grid;
    grid-template-columns: 1.5fr 2fr 1fr 0.8fr 0.5fr 30px;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--cream-white);
    cursor: pointer;
    transition: background var(--transition-fast);
    user-select: none;
}

.history-compact-row:hover {
background: var(--cream-medium);
}

.compact-col {
font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-col.variety {
font-weight: 600;
}

.compact-col.farm {
color: var(--text-secondary);
}

.compact-col.date {
color: var(--text-light);
    font-size: 13px;
}

.compact-col.score {
display: flex;
    justify-content: center;
}

.compact-col.actions {
display: flex;
    gap: 4px;
    justify-content: flex-end;
}

/* Pagination */

.history-pagination {
display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.page-btn {
min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--cream-white);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
background: var(--coffee-dark);
    color: var(--cream-white);
    border-color: var(--coffee-dark);
}

.page-btn.active {
background: var(--coffee-dark);
    color: var(--cream-white);
    border-color: var(--coffee-dark);
}

.page-btn:disabled {
opacity: 0.4;
    cursor: not-allowed;
}

/* Search input — идентичен .form-group input */

.history-search-input {
padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: white;
    transition: all var(--transition-fast);
}

.history-search-input::placeholder {
color: var(--text-light);
}

.history-search-input:hover {
border-color: var(--accent);
}

.history-search-input:focus {
outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(107, 166, 255, 0.2);
}

/* Responsive: compact single-row on mobile */

/* Футер */


.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 14px;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: none;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary, #666);
}

.user-info.active {
    display: flex;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-name::before {
    content: "👤";
    font-size: 14px;
}

.user-days {
    background: var(--accent-color, #6c5ce7);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.user-days.warning {
    background: #e67e22;
}

.user-days.danger {
    background: #e74c3c;
}

.btn-logout {
    background: transparent;
    color: var(--text-secondary, #666);
    border: 1px solid var(--border-color, #ddd);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-logout:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* Dark theme */
[data-theme="dark"] .user-name {
    color: var(--text-primary, #f0f0f0);
}

[data-theme="dark"] .btn-logout {
    color: var(--text-secondary, #aaa);
    border-color: var(--border-color, #444);
}

/* Mobile */
@media (max-width: 480px) {
    .footer-right {
        flex-direction: column;
        gap: 8px;
    }
    
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Кнопки действий в истории — единый стиль с полями ввода */

.btn-history-action {
padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.btn-clear-history {
background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.btn-clear-history:hover {
background: #c0392b;
    border-color: #c0392b;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.btn-clear-history:disabled {
    background: #95a5a6;
    color: #ecf0f1;
    border-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-clear-history:disabled:hover {
    box-shadow: none;
}

.btn-export-excel {
background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.btn-export-excel:hover {
background: #219a52;
    border-color: #219a52;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.btn-export-csv {
background: #2980b9;
    color: white;
    border-color: #2980b9;
}

.btn-export-csv:hover {
background: #2471a3;
    border-color: #2471a3;
    box-shadow: 0 2px 8px rgba(41, 128, 185, 0.3);
}

/* ============================================
   Dark Theme Overrides (Specific Elements)
   ============================================ */

/* Radio buttons (Roast options) */

/* ============================================
   Tab Warning Indicator (Critical Defects)
   ============================================ */

.tab-warning {
position: relative;
}

.tab-warning::after {
content: '';
    position: absolute;
    top: 4px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #FF5722;
    border-radius: 50%;
    animation: warning-pulse 1.5s infinite;
    box-shadow: 0 0 6px rgba(255, 87, 34, 0.6);
}

@keyframes warning-pulse {
0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* ============================================
   Disabled Button State
   ============================================ */

.btn-disabled {
opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ============================================
   Critical Defect Modal
   ============================================ */

.critical-defect-modal {
display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.critical-defect-modal.active {
display: flex;
}

.critical-defect-modal-content {
background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modal-slide-in 0.3s ease;
}

@keyframes modal-slide-in {
from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.critical-defect-modal-header {
font-size: 18px;
    font-weight: 700;
    color: #D32F2F;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #FFCDD2;
}

.critical-defect-modal-body {
font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 20px;
}

.critical-defect-modal-footer {
text-align: right;
}

/* ============================================
   Input Highlight Animation
   ============================================ */

.input-highlight {
animation: input-highlight-pulse 2s ease;
    border-color: #FF5722 !important;
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.2) !important;
}

@keyframes input-highlight-pulse {
0%, 100% { box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(255, 87, 34, 0.4); }
}

/* ============================================
   Toast Warning Type
   ============================================ */

.toast.warning {
background: #FF9800;
    color: white;
    border-left-color: #E65100;
}

/* ============================================
   History - Critical Defect Highlighting
   ============================================ */

.cata-item.critical-defect {
color: #D32F2F;
    font-weight: 600;
}

.cata-item.off-flavor {
color: #f0c040;
    font-weight: 600;
}

/* ============================================
   History - Descriptor Tags Highlighting
   ============================================ */

.descriptor-tag.critical-defect {
background: rgba(211, 47, 47, 0.1);
    color: #B71C1C !important;
    border: 1px solid #D32F2F;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(211, 47, 47, 0.15);
}

.descriptor-tag.off-flavor {
background: rgba(255, 152, 0, 0.1);
    color: #E65100 !important;
    border: 1px solid #FF9800;
    font-weight: 600 !important;
    box-shadow: 0 1px 2px rgba(255, 152, 0, 0.15);
}

/* ============================================
   Tab Warning on Tab Button (Critical Defects)
   ============================================ */

/* Маркер на кнопке таба с предупреждением */

.tab-btn.tab-warning {
position: relative;
    background: rgba(255, 87, 34, 0.15) !important;
    border-color: #FF5722 !important;
    color: #FF5722 !important;
    font-weight: 600 !important;
}

.tab-btn.tab-warning::after {
content: '';
    position: absolute;
    top: 4px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #FF5722;
    border-radius: 50%;
    animation: warning-pulse 1.5s infinite;
    box-shadow: 0 0 6px rgba(255, 87, 34, 0.6);
}

/* Кнопка "Назад" с пульсирующим предупреждением */

.btn-warning-pulse {
animation: back-btn-pulse 2s infinite !important;
    background: rgba(255, 87, 34, 0.15) !important;
    border-color: #FF5722 !important;
    color: #FF5722 !important;
    font-weight: 600 !important;
}

@keyframes back-btn-pulse {
0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.4);
        background: rgba(255, 87, 34, 0.15);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 87, 34, 0);
        background: rgba(255, 87, 34, 0.3);
    }
}

/* ============================================
   Cup Uniformity Map (Кarta однородности чашек)
   Interactive cup circles for penalty visualization
   ============================================ */

.cup-map-container {
margin-top: 16px;
    padding: 16px;
    background: var(--cream-medium);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.cup-map-section {
margin-bottom: 16px;
}

.cup-map-section:last-child {
margin-bottom: 0;
}

.cup-map-label {
display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.cup-map-row {
display: flex;
    gap: var(--cup-map-gap);
    align-items: center;
}

.cup-circle {
width: var(--cup-circle-size);
    height: var(--cup-circle-size);
    border-radius: 50%;
    border: 2px solid var(--coffee-lighter);
    background: var(--cream-light);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: transparent;
    user-select: none;
    position: relative;
}

/* Цифра внутри кружка чашки */

.cup-number {
font-size: 0.95rem;
    font-weight: 700;
    color: var(--coffee-dark);
    pointer-events: none;
    transition: color 0.2s ease;
}

.cup-circle:hover {
transform: scale(1.1);
    box-shadow: 0 2px 8px var(--shadow);
}

.cup-circle:active {
transform: scale(0.95);
}

/* Состояние 0: Чистая чашка (по умолчанию) */

.cup-circle.state-0 {
border-color: var(--coffee-lighter);
    background: var(--cream-light);
    color: transparent;
}

/* Toggle: Неравномерная чашка — верхний ряд (оранжевый) */

.cup-circle[data-type="uneven"].state-1 {
border-color: #FF9800;
    background: #FF9800;
    color: #FFF;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
}

.cup-circle[data-type="uneven"].state-1 .cup-number {
color: #FFFFFF;
}

/* Toggle: Дефектная чашка — нижний ряд (красный) */

.cup-circle[data-type="defective"].state-1 {
border-color: #D32F2F;
    background: #D32F2F;
    color: #FFF;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.4);
}

.cup-circle[data-type="defective"].state-1 .cup-number {
color: #FFFFFF;
}

/* Счётчик чашек */

.cup-count {
margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

.cup-count-value {
font-weight: 700;
    font-size: 1rem;
}

.cup-count.active .cup-count-value {
color: var(--accent);
}

/* Подсказка при наведении */

.cup-circle::after {
content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: var(--coffee-darkest);
    color: #FFF;
    font-size: 0.7rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 4px;
}

.cup-circle:hover::after {
opacity: 1;
}

/* ============================================
   Autocomplete Dropdowns & Auto-filled Fields
   ============================================ */

/* Обёртка инпута (для позиционирования дропдауна) */

.autocomplete-wrapper {
position: relative;
width: 100%;
display: flex;
flex-direction: column;
min-width: 0;
}

/* Инпуты и селекты внутри обёртки — растягиваются на 100% ширины родителя */

.autocomplete-wrapper input,
.autocomplete-wrapper select {
width: 100%;
box-sizing: border-box;
}

/* Выпадающий список подсказок */

.autocomplete-dropdown {
position: absolute;
top: 100%;
left: 0;
right: 0;
z-index: 1000;
margin: 0;
padding: 0;
list-style: none;
background: var(--cream-white, #ffffff);
border: 2px solid var(--accent, #d4a574);
border-top: none;
border-radius: 0 0 var(--radius-md, 8px) var(--radius-md, 8px);
box-shadow: 0 4px 12px var(--shadow-hover, rgba(0,0,0,0.15));
max-height: 280px;
overflow-y: auto;
animation: acDropdownIn 0.15s ease-out;
}

@keyframes acDropdownIn {
from {
opacity: 0;
transform: translateY(-4px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

/* Элемент подсказки */

.autocomplete-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 14px;
cursor: pointer;
transition: background 0.12s ease;
border-bottom: 1px solid rgba(0,0,0,0.05);
font-size: 0.95rem;
color: var(--text-primary, #3e2723);
}

.autocomplete-item:last-child {
border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
background: rgba(212, 165, 116, 0.15);
}

.autocomplete-item.active {
background: rgba(212, 165, 116, 0.25);
}

/* Текст подсказки */

.ac-text {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.ac-text strong {
color: var(--coffee-dark, #5d4037);
font-weight: 700;
}

/* Счётчик частоты (сколько раз встречалось) */

.ac-count {
font-size: 0.75rem;
color: var(--text-light, #999);
margin-left: 8px;
flex-shrink: 0;
background: rgba(0,0,0,0.06);
padding: 2px 6px;
border-radius: 4px;
}

/* Поле с автозаполненным значением (зелёная подсветка) */

.auto-filled {
background-color: rgba(76, 175, 80, 0.08) !important;
border-color: rgba(76, 175, 80, 0.4) !important;
}

.auto-filled::after {
content: '✨';
position: absolute;
right: 8px;
top: 50%;
transform: translateY(-50%);
font-size: 0.85rem;
pointer-events: none;
opacity: 0.7;
}

/* Делаем input с автозаполнением relative для позиционирования иконки */

.autocomplete-wrapper input.auto-filled {
position: relative;
padding-right: 32px !important;
}

/* Select: недоступные месяцы */

.month-available {
opacity: 1;
}

.month-unavailable {
opacity: 0.35;
}

/* Dark theme: дропдаун */

body.dark-theme .autocomplete-dropdown {
background: var(--card-dark, #2d2d2d);
border-color: var(--accent, #d4a574);
}

body.dark-theme .autocomplete-item {
color: var(--text-dark, #e0e0e0);
border-bottom-color: rgba(255,255,255,0.05);
}

body.dark-theme .autocomplete-item:hover,
body.dark-theme .autocomplete-item.active {
background: rgba(212, 165, 116, 0.2);
}

body.dark-theme .ac-count {
background: rgba(255,255,255,0.1);
color: #999;
}

body.dark-theme .auto-filled {
background-color: rgba(76, 175, 80, 0.15) !important;
border-color: rgba(76, 175, 80, 0.5) !important;
}



/* Адаптивность перенесена в responsive.css */

/* ============================================
   Настройки (Settings page)
   ============================================ */

.settings-container {
    max-width: 700px;
    padding: 8px 0;
}

.settings-container h3 {
    color: var(--coffee-dark);
    margin-bottom: 24px;
    font-size: 1.4rem;
}

.settings-group {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px var(--shadow);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.settings-info label {
    display: block;
    font-weight: 600;
    color: var(--coffee-dark);
    font-size: 1rem;
    margin-bottom: 4px;
}

.settings-desc {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    border-radius: 28px;
    transition: var(--transition-normal);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* Server status */
.settings-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(212, 165, 116, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.settings-status.online #server-status-icon::before {
    content: "🟢 ";
}

.settings-status.offline #server-status-icon::before {
    content: "🔴 ";
}

.settings-status.checking #server-status-icon::before {
    content: "🟡 ";
}

/* Health panel */
.health-panel {
    margin-top: 12px;
    padding: 12px;
    background: rgba(76, 175, 80, 0.05);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: var(--radius-sm);
}

.health-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
}

.health-item:not(:last-child) {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.health-icon {
    font-size: 0.9rem;
}

.health-label {
    color: var(--text-secondary);
    min-width: 120px;
}

.health-value {
    font-weight: 600;
    color: var(--coffee-dark);
}

.health-item.health-error {
    color: var(--quality-poor);
}

.health-item.health-error .health-value {
    color: var(--quality-poor);
}

/* Dark theme for health panel */
body.dark-theme .health-panel {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
}

body.dark-theme .health-item:not(:last-child) {
    border-bottom-color: rgba(255,255,255,0.1);
}

body.dark-theme .health-label {
    color: var(--text-dark-secondary, #999);
}

body.dark-theme .health-value {
    color: var(--text-dark, #e0e0e0);
}

/* Buttons */
.settings-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.btn-settings-action {
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--coffee-dark);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.btn-settings-action:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-settings-action.btn-danger {
    color: var(--quality-poor);
    border-color: var(--quality-poor);
}

.btn-settings-action.btn-danger:hover {
    background: var(--quality-poor);
    color: white;
}

/* Sync row */
.settings-sync-row {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}
.settings-sync-row .btn-settings-action {
    width: 100%;
    margin-bottom: 6px;
}
.settings-sync-row .settings-desc {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-settings-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Server URL inputs */
.settings-server-url {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.server-url-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}
.settings-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.settings-input:focus {
    border-color: var(--accent);
}
.settings-input-port {
    max-width: 100px;
    flex: none;
}
.cors-note {
    margin-top: 8px !important;
    color: var(--warning-color, #ff9800);
    font-size: 0.78rem !important;
}

/* Info panel */
.settings-info-panel {
    margin-top: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
}

.info-value {
    font-weight: 600;
    color: var(--coffee-dark);
}

/* Dark theme */
body.dark-theme .settings-group {
    background: var(--card-dark, #2d2d2d);
}

body.dark-theme .settings-container h3,
body.dark-theme .settings-info label,
body.dark-theme .info-value {
    color: var(--text-dark, #e0e0e0);
}

body.dark-theme .settings-desc,
body.dark-theme .info-label {
    color: var(--text-dark-secondary, #999);
}

body.dark-theme .btn-settings-action {
    background: var(--card-dark, #2d2d2d);
    color: var(--text-dark, #e0e0e0);
    border-color: var(--border-dark, #444);
}

body.dark-theme .info-row {
    border-bottom-color: var(--border-dark, #444);
}

/* Setup Guide */
.guide-toggle {
    width: 100%;
    padding: 10px 16px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    color: var(--coffee-dark);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.guide-toggle:hover {
    background: var(--hover-bg, #f5f0eb);
}
.guide-content {
    display: none;
    margin-top: 8px;
    padding: 16px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
}
.guide-content.open {
    display: block;
}
.guide-steps {
    margin: 0;
    padding-left: 20px;
}
.guide-steps li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: var(--text-color, #333);
}
.guide-steps li code {
    background: var(--code-bg, #f0ebe6);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}
.guide-steps li a {
    color: var(--accent, #8B5E3C);
}
.guide-tip {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--code-bg, #f0ebe6);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-color, #333);
}
.guide-tip code {
    background: var(--card-bg, #fff);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Dark theme guide */
body.dark-theme .guide-toggle {
    background: var(--card-dark, #2d2d2d);
    color: var(--text-dark, #e0e0e0);
    border-color: var(--border-dark, #444);
}
body.dark-theme .guide-content {
    background: var(--card-dark, #2d2d2d);
    border-color: var(--border-dark, #444);
}
body.dark-theme .guide-steps li {
    color: var(--text-dark-secondary, #999);
}
body.dark-theme .guide-steps li code,
body.dark-theme .guide-tip code {
    background: #1a1a1a;
    color: var(--text-dark, #e0e0e0);
}
body.dark-theme .guide-tip {
    background: #1a1a1a;
    color: var(--text-dark-secondary, #999);
}

/* ============================================
   Login Modal Styles
   ============================================ */

.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.login-modal.active {
    display: flex;
}

.login-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.login-modal-content {
    position: relative;
    background: var(--card-bg, #ffffff);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: login-modal-slide-in 0.3s ease;
}

@keyframes login-modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-modal-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: var(--text-primary, #1a1a1a);
}

.login-subtitle {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary, #666);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1a1a1a);
}

.login-field input {
    padding: 12px 16px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--input-bg, #fff);
    color: var(--text-primary, #1a1a1a);
}

.login-field input:focus {
    outline: none;
    border-color: var(--accent-color, #6c5ce7);
}

.login-error {
    color: #e74c3c;
    font-size: 14px;
    min-height: 20px;
    text-align: center;
}

.login-btn {
    padding: 14px 24px;
    background: var(--accent-color, #6c5ce7);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.login-btn:hover:not(:disabled) {
    background: #5b4cdb;
    transform: translateY(-1px);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

.login-footer p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary, #888);
}

/* Dark theme */
[data-theme="dark"] .login-modal-content {
    background: var(--card-bg, #2a2a2a);
}

[data-theme="dark"] .login-modal-header h2 {
    color: var(--text-primary, #f0f0f0);
}

[data-theme="dark"] .login-field label {
    color: var(--text-primary, #f0f0f0);
}

[data-theme="dark"] .login-field input {
    background: var(--input-bg, #333);
    border-color: var(--border-color, #444);
    color: var(--text-primary, #f0f0f0);
}

[data-theme="dark"] .login-footer {
    border-top-color: var(--border-color, #444);
}

/* Mobile */
@media (max-width: 480px) {
    .login-modal-content {
        padding: 24px;
        margin: 16px;
    }
    
    .login-modal-header h2 {
        font-size: 20px;
    }
}
