/* ====== Общие настройки ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ====== Шапка ====== */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0;
}

.logout-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.logout-btn:hover {
    background-color: #c0392b;
}

/* ====== Панель вкладок ====== */
.tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    background-color: #fff;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tab-button {
    padding: 12px 20px;
    border: none;
    background-color: #f8f9fa;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    border-right: 1px solid #ddd;
}

.tab-button:last-child {
    border-right: none;
}

.tab-button.active {
    background-color: #ffffff;
    color: #2c3e50;
    border-bottom: 3px solid #007bff;
    font-weight: 600;
}

.tab-button:hover:not(.active) {
    background-color: #e9ecef;
}

/* ====== Контент вкладок ====== */
.tab-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tab-pane {
    display: none;
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    padding: 20px;
    overflow-x: auto; /* Для горизонтальной прокрутки при узком экране */
}

.tab-pane.active {
    display: block;
}

/* ====== Раздел "Таблица пользователей" ====== */
.users-section .actions-top {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Перенос кнопок на новую строку при маленьком экране */
}

#addUserBtn,
#updateTableBtn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

#addUserBtn {
    background-color: #007bff;
    color: white;
}

#addUserBtn:hover {
    background-color: #0056b3;
}

#updateTableBtn {
    background-color: #6bec6b;
    color: white;
}

#updateTableBtn:hover {
    background-color: #99ff00;
}

/* ====== Таблица пользователей ====== */
.wl-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.wl-table th,
.wl-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.wl-table th {
    background-color: #007bff;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wl-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* ====== Контролы количества ====== */
.quantity-editor {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.quantity-editor input {
    width: 60px;
    padding: 6px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    appearance: textfield;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
}

.quantity-editor input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* Кнопки + и - */
.quantity-editor button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.minus-btn {
    background-color: #dc3545;
    color: white;
}

.minus-btn:hover {
    background-color: #c82333;
}

.plus-btn {
    background-color: #28a745;
    color: white;
}

.plus-btn:hover {
    background-color: #218838;
}

/* ====== Кнопки действий ====== */
.wl-table td:last-child {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

.wl-table .extend-btn,
.wl-table .delete-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

.extend-btn {
    background-color: #007bff;
    color: white;
}

.extend-btn:hover {
    background-color: #0056b3;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
}

.delete-btn:hover {
    background-color: #c82333;
}

/* ====== Раздел "Блэклист" ====== */
.blacklist-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#tickerInput {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

#tickerInput:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

#addTickerBtn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background-color: #dc3545;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#addTickerBtn:hover {
    background-color: #c82333;
}

/* ====== Таблица блэклиста ====== */
.bl-table table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.bl-table th,
.bl-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.bl-table th {
    background-color: #007bff;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bl-table .delete-ticker-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.bl-table .delete-ticker-btn:hover {
    background-color: #c82333;
}

/* ====== Раздел "Последние события" ====== */
.events-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ====== Таблица событий ====== */
.ev-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.ev-table th,
.ev-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.ev-table th {
    background-color: #28a745;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ev-table tbody tr:hover {
    background-color: #f8f9fa;
}

.ev-table pre {
    margin: 0;
    font-family: monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* ====== Модальное окно ====== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.5rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.modal-content label {
    display: block;
    margin-top: 15px;
    font-weight: 500;
    font-size: 1rem;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.modal-content input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap; /* Перенос кнопок на мобильных */
}

.modal-actions .action-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-actions .action-btn[type="submit"] {
    background-color: #007bff;
    color: white;
}

.modal-actions .action-btn[type="submit"]:hover {
    background-color: #0056b3;
}

.modal-actions .cancel-btn {
    background-color: #6c757d;
    color: white;
}

.modal-actions .cancel-btn:hover {
    background-color: #5a6268;
}

/* ====== Адаптивность (Mobile First) ====== */

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 10px 15px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .tabs {
        flex-direction: column;
        border-radius: 8px;
    }

    .tab-button {
        border: none;
        border-bottom: 1px solid #ddd;
        border-radius: 0;
    }

    .tab-button:first-child {
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
    }

    .tab-button:last-child {
        border-bottom: none;
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
    }

    .tab-button.active {
        border-bottom: 3px solid #007bff;
        border-radius: 0;
    }

    .tab-pane {
        padding: 15px;
    }

    .users-section .actions-top {
        flex-direction: column;
    }

    .wl-table th,
    .wl-table td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .quantity-editor input {
        width: 50px;
        font-size: 0.9rem;
    }

    .quantity-editor button {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .wl-table .extend-btn,
    .wl-table .delete-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .blacklist-section {
        gap: 10px;
    }

    #tickerInput {
        font-size: 0.9rem;
    }

    #addTickerBtn {
        font-size: 0.9rem;
    }

    .bl-table th,
    .bl-table td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .bl-table .delete-ticker-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .ev-table th,
    .ev-table td {
        padding: 8px 10px;
        font-size: 0.9rem;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
    }

    .modal-content h2 {
        font-size: 1.3rem;
    }

    .modal-content input {
        font-size: 0.9rem;
    }

    .modal-actions .action-btn {
        min-width: 45%;
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .header h1 {
        font-size: 1.2rem;
    }

    .wl-table th,
    .wl-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .quantity-editor input {
        width: 40px;
        font-size: 0.8rem;
    }

    .quantity-editor button {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }

    .wl-table .extend-btn,
    .wl-table .delete-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .bl-table th,
    .bl-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .bl-table .delete-ticker-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .ev-table th,
    .ev-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .modal-content {
        padding: 15px;
        width: 98%;
    }

    .modal-content h2 {
        font-size: 1.1rem;
    }

    .modal-content input {
        font-size: 0.8rem;
    }

    .modal-actions .action-btn {
        min-width: 40%;
        padding: 8px;
        font-size: 0.8rem;
    }
}