/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --secondary-color: #7b68ee;
    --danger-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --bg-color: #1a1a2e;
    --card-bg: #16213e;
    --text-color: #ecf0f1;
    --text-muted: #95a5a6;
    --border-color: #34495e;
    --hover-color: #2c3e50;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1em;
}

.connection-status {
    margin-top: 15px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

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

.connection-status.disconnected {
    color: var(--danger-color);
}

.connection-status i {
    font-size: 0.7em;
}

.connection-status.connected i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.license-status {
    margin-top: 10px;
    display: flex;
    justify-content: center;
}

.license-status .btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.license-status .btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    border: 1px solid #27ae60;
    color: white;
}

.license-status .btn-success:hover {
    background: linear-gradient(135deg, #229954 0%, #27ae60 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.license-status .btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.license-status .btn-secondary:hover {
    background: var(--hover-color);
    border-color: var(--primary-color);
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    margin-bottom: 30px;
    align-items: start;
    min-height: 0;
}

/* Правая колонка: содержит прогресс и результаты */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    width: 100%;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .right-column {
        width: 100%;
    }
}

/* Sections */
section {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

section.results-panel {
    /* Специальные стили для панели результатов */
    padding: 20px;
    display: flex !important;
    flex-direction: column;
    min-height: 400px;
    max-height: calc(100vh - 300px);
    overflow: hidden;
    position: relative;
    width: 100%;
    flex: 1;
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-color);
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input:disabled,
.form-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Buttons */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #6a5acd;
    transform: translateY(-2px);
}

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

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
}

/* Progress Panel */
.progress-panel {
    flex-shrink: 0;
    margin-bottom: 0;
}

.progress-bar-container {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-color);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s;
    border-radius: 15px;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.log-container {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-color);
    border-radius: 5px;
    padding: 10px;
}

.log {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.8;
}

.log-entry {
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 3px;
}

.log-entry.info {
    color: var(--text-color);
}

.log-entry.success {
    color: var(--success-color);
}

.log-entry.error {
    color: var(--danger-color);
}

.log-entry.warning {
    color: var(--warning-color);
}

/* Results Panel - стили применяются через section.results-panel выше */

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.results-actions {
    display: flex;
    gap: 10px;
}

.results-info {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 5px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.random-craft-info {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 5px;
    color: var(--success-color);
    font-weight: bold;
    flex-shrink: 0;
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 300px;
    max-height: calc(100vh - 450px);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    width: 100%;
    display: block;
    margin-top: 10px;
}

/* Улучшаем видимость скроллбара */
.table-container::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 7px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 7px;
    border: 2px solid var(--bg-color);
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    background: var(--bg-color);
    border-radius: 5px;
    overflow: hidden;
    font-size: 0.9em;
    table-layout: fixed;
}

thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, #357abd 100%);
    position: sticky;
    top: 0;
    z-index: 5;
}

th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Фиксированные ширины колонок (как в оригинале) */
th:first-child {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

th:nth-child(2),
th:nth-child(3) {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

th:nth-child(4) {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}

th:nth-child(5) {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

th:nth-child(6),
th:nth-child(7) {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

th:nth-child(8) {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

th:hover {
    background: rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s;
}

th i {
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.8em;
}

th.sorted i {
    opacity: 1;
}

td {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Колонки с названиями модов - компактные, с переносом при необходимости */
td:first-child,
td:nth-child(2),
td:nth-child(3) {
    width: 150px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    vertical-align: middle;
    font-size: 0.85em;
}

/* При наведении показываем полный текст в tooltip (через title атрибут) */
td:first-child:hover,
td:nth-child(2):hover,
td:nth-child(3):hover {
    background: var(--hover-color);
    z-index: 10;
    cursor: help;
}

/* Колонка с ценой */
td:nth-child(4) {
    width: 100px;
    max-width: 100px;
    text-align: right;
    white-space: nowrap;
    font-weight: 500;
    color: var(--success-color);
    font-size: 0.9em;
}

/* Колонка с валютой */
td:nth-child(5) {
    width: 80px;
    max-width: 80px;
    text-align: center;
    white-space: nowrap;
    font-size: 0.85em;
}

/* Колонки с числами */
td:nth-child(6),
td:nth-child(7) {
    width: 80px;
    max-width: 80px;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.9em;
}

td:nth-child(8) {
    width: 120px;
    max-width: 120px;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.9em;
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background: var(--hover-color);
}

tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:nth-child(even):hover {
    background: var(--hover-color);
}

tbody tr.empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 30px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9em;
}

footer .ash-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

footer .ash-info a {
    color: var(--primary-color);
    text-decoration: none;
    margin-left: 5px;
    transition: color 0.3s ease;
}

footer .ash-info a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.3em;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: var(--hover-color);
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.modal-body .form-group {
    margin-bottom: 15px;
}

.modal-body .form-control {
    width: 100%;
    padding: 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-color);
    font-size: 1em;
}

.modal-body .form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-body textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-info {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-top: 10px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
}



