/* ==========================================================================
   1. ROOT VARIABLES & GLOBAL STYLES
   ========================================================================== */

   :root {
    --bg: #0F0F0F;
    --surface: #1F1F1F;
    --primary: #3E87F6;
    --text: #FFFFFF;
    --text-secondary: #AAAAAA;
    --border: #333333;
    --success: #4CAF50;
    --error: #F44336;
    --accent: #00B8FF;
    --surface-hover: #2a2a2a;
    --selection-bg: rgba(0, 184, 255, 0.1);
      /* Подставьте сюда реальную ширину вашей боковой панели */
    --sidebar-width: 320px;
    /* Отступ справа, если надо */
    --panel-offset-right: 30px;
}
.selection-actions {
    display: none;
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: var(--panel-offset-right);
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }
  
  /* Группа иконок */
.action-icons-group {
display: flex;
gap: 10px;
}
  
  /* Показываем, когда есть выделенные аккаунты */
  .selection-actions.show-icons .action-icons-group {
    display: flex;
  }
  
  /* Кнопки‑иконки */
  .action-btn {
    width: 40px;
    height: 40px;
    background: var(--surface-hover);
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
  }
  .action-btn i {
    font-size: 18px;
    color: var(--text-secondary);
  }
  .action-btn:hover {
    transform: scale(1.1);
  }
  .action-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg);
    color: var(--text);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1100;
  }
  
  /* Кнопка «Выбрать действие» */
  .action-button {
    padding: 12px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s ease;
  }
  .action-button:active {
    transform: scale(0.98);
  }
  
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 20px;
    line-height: 1.5;
    font-size: 16px;
}

/* ==========================================================================
   2. MAIN LAYOUT & HEADER
   ========================================================================== */

.proxy-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}





.header-section {
    margin-bottom: 25px;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* ==========================================================================
   3. FILTER FOLDERS & CONTROL BUTTONS
   ========================================================================== */

.account-folder-selector, .controls-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-folder-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.account-folder-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text);
}

.account-folder-btn .account-count {
    background-color: var(--border);
    color: var(--text);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.account-folder-btn .active-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.account-folder-btn.active {
    color: var(--text);
}

.account-folder-btn.active .active-indicator {
    transform: scaleX(1);
}

.control-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.control-button svg {
    width: 20px;
    height: 20px;
}

.control-button:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--text);
}

/* Tooltip for buttons */
.control-button[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg);
    color: var(--text);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}

/* Tooltip for action icons */
.action-icons img[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg);
    color: var(--text);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}

/* ==========================================================================
   4. ACCOUNTS TABLE
   ========================================================================== */
.table-wrapper {
    height: calc(100vh - 250px); /* Адаптируй под свой layout */
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--surface);
}

.proxy-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Стили скроллбара для WebKit браузеров */
.table-wrapper::-webkit-scrollbar {
    width: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #555555;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #777777;
}

/* Стили скроллбара для Firefox */
.table-wrapper {
    scrollbar-width: thin;
    scrollbar-color: #555555 #2a2a2a;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .table-wrapper {
        height: calc(100vh - 300px);
    }
    
    .proxy-table td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    .proxy-table th {
        padding: 8px 10px;
        font-size: 12px;
    }
}

.proxy-table thead {
    border-bottom: 2px solid var(--border);
}

.proxy-table th {
    padding: 12px 15px;
    text-align: left;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.proxy-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease-in-out;
}

.proxy-table tbody tr:last-child {
    border-bottom: none;
}

.proxy-table tbody tr:hover {
    background-color: var(--surface-hover);
    cursor: pointer;
}

.proxy-table tbody tr.selected {
    background-color: var(--selection-bg);
    border-left: 3px solid var(--accent);
}

.proxy-table td {
    padding: 15px;
    vertical-align: middle;
}

.proxy-table input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary); 
}

.status-ok {
    color: var(--success);
}

.status-error {
    color: var(--error);
}

.role-cell {
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
}

.role-cell:hover {
    text-decoration: underline;
}

.action-icons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.action-icons img {
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease;
}

.action-icons img:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* ==========================================================================
   5. ACTION BUTTON & MENU
   ========================================================================== */

.action-button-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.action-button {
    padding: 15px 25px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
}

.action-button:active {
    transform: scale(0.98);
}

.action-menu {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        visibility 0.2s;
}

body.menu-open::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* полупрозрачный чёрный слой */
    background: rgba(0, 0, 0, 0.4);
    /* собственно размытие */
    backdrop-filter: blur(8px);
    z-index: 998;
}

/* This class should be toggled with JS */
.action-menu.visible {
    opacity: 1;
    visibility: visible;
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-size: 20px;
}

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

.action-menu-item:hover {
    background-color: var(--surface-hover);
}

.action-menu-item .nav-icon-black {
    width: 20px;
    height: 20px;
}

.menu-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    transition: filter 0.3s ease;
    flex-shrink: 0;
    
    /* Основной фильтр для цвета #8A91A0 */
    filter: 
        brightness(0) 
        saturate(100%) 
        invert(90%) 
        sepia(1%) 
        saturate(447%) 
        hue-rotate(185deg) 
        brightness(97%) 
        contrast(89%)
}

.menu-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    transition: filter 0.3s ease;
    flex-shrink: 0;
    
    filter: brightness(0) invert(1);
}

/* ==========================================================================
   6. MODAL WINDOWS (ИСПРАВЛЕНА ЦЕНТРАЦИЯ)
   ========================================================================== */

.modal, .modal-add {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* JS should change to 'flex' to show */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--surface);
    margin: auto;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Центрирование контента внутри модального окна */
.modal-add .modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.modal-add .close {
    color: var(--text-secondary);
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-add .close:hover,
.modal-add .close:focus {
    color: var(--text);
}

.modal-add h2 {
    margin-bottom: 20px;
    color: var(--primary);
    text-align: center;
    width: 100%;
}

.modal-add .info-message {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 25px;
    line-height: 1.6;
    width: 100%;
}

.modal-add button {
    width: 100%;
    max-width: 200px;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal-add button:hover {
    background: #e000b8;
}

.add-form textarea {
    width: 100%;
    min-height: 250px;
    padding: 15px;
    border: 1px solid #3a3f45; /* Темная граница как в таблице */
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 20px;
    background: #2a2e34; /* Темный фон как в таблице */
    color: #e0e0e0; /* Светлый текст */
    font-family: 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s ease;
}

.add-form textarea:focus {
    border-color: #1976d2; /* Акцентный цвет при фокусе */
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.add-form textarea::placeholder {
    color: #6c757d; /* Серый цвет плейсхолдера */
    opacity: 1;
}

/* Добавляем стили для статуса */
.status-cell {
    text-align: left;
    font-weight: bold;
}

.status-alive {
    color: #4CAF50; /* Зеленый для "Жив" */
}

.status-dead {
    color: #F44336; /* Красный для "Мертв" */
}


/* Добавляем в ваш CSS файл или в блок стилей */

/* Стили для основного чекбокса "Выбрать все" */
#select-all-checkbox {
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #3E87F6;
    border-radius: 4px;
    background-color: #2d2d3a;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    outline: none;
}

#select-all-checkbox:checked {
    background-color: #3E87F6;
    border-color: #3E87F6;
}

#select-all-checkbox:checked::before {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

#select-all-checkbox:hover {
    box-shadow: 0 0 8px rgba(255, 0, 204, 0.6);
}

/* Стили для чекбоксов в строках таблицы */
.row-checkbox {
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #3E87F6;
    border-radius: 3px;
    background-color: #2d2d3a;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    outline: none;
}

.row-checkbox:checked {
    background-color: #3E87F6;
    border-color: #3E87F6;
}

.row-checkbox:checked::before {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 11px;
    font-weight: bold;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.row-checkbox:hover {
    box-shadow: 0 0 6px rgba(0, 174, 255, 0.5);
}

/* Стили для строк таблицы при наведении и выделении */
#accounts-table tbody tr:hover {
    background-color: rgba(0, 119, 255, 0.1);
}

#accounts-table tbody tr.selected {
    background-color: rgba(0, 153, 255, 0.15);
    box-shadow: inset 0 0 0 1px rgba(0, 102, 255, 0.3);
}

/* Анимация для плавного изменения состояния */
@keyframes checkboxPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 0, 204, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(255, 0, 204, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 0, 204, 0); }
}

.row-checkbox:focus, 
#select-all-checkbox:focus {
    animation: checkboxPulse 0.5s;
}




/* Уведомления в стиле вашей темной темы */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    transform: translateY(-150%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notification.show {
    transform: translateY(0);
}

.notification-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon svg {
    width: 16px;
    height: 16px;
    fill: white;
}

.notification-content {
    display: flex;
    flex-direction: column;
}

.notification-title {
    font-weight: 600;
    color: var(--text);
    font-size: 15px;
}

.notification-message {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

@keyframes progress {
    from { width: 100%; }
    to { width: 0; }
}

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--success);
    animation: progress 3s linear forwards;
    border-radius: 0 0 0 12px;
}

/* Стиль для уведомлений об ошибке */
.notification.error .notification-icon {
    background: var(--error);
}

.notification.error .notification-progress {
    background: var(--error);
}

/* ==========================================================================
   7. CLEAN ACCOUNT MODAL STYLES
   ========================================================================== */

.clean-options {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Стили для кастомных чекбоксов */
.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: var(--surface-hover);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.checkbox-container:hover {
    background: #333333;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 20px;
    width: 20px;
    background-color: #2d2d2d;
    border: 2px solid var(--border);
    border-radius: 4px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark::after {
    content: "";
    display: none;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    position: relative;
    top: -1px;
}

.checkbox-container input:checked ~ .checkmark::after {
    display: block;
}

.checkbox-container span:last-child {
    color: var(--text);
    font-size: 15px;
    font-weight: 400;
    user-select: none;
}

/* Стили для скроллбара в clean-options */
.clean-options::-webkit-scrollbar {
    width: 6px;
}

.clean-options::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.clean-options::-webkit-scrollbar-thumb {
    background: #555555;
    border-radius: 3px;
}

.clean-options::-webkit-scrollbar-thumb:hover {
    background: #777777;
}

/* Стили для кнопок в модальном окне */
.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-secondary, .btn-primary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: var(--surface-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #3a3a3a;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #2d76e5;
    transform: translateY(-1px);
}

.btn-secondary:active, .btn-primary:active {
    transform: translateY(0);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .clean-options {
        max-height: 250px;
    }
    
    .checkbox-container {
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    
    .checkbox-container span:last-child {
        font-size: 14px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .btn-secondary, .btn-primary {
        width: 100%;
        padding: 14px;
    }
}