* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
}

.logo {
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

header h1 {
    font-size: 1.8em;
    margin-bottom: 6px;
    font-weight: 600;
}

.subtitle {
    font-size: 0.9em;
    opacity: 0.85;
}

/* Header responsive layout */
header > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header > div > div:first-child {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
}

header > div > div:last-child {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.weather-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    font-size: 0.9em;
}

.weather-icon {
    font-size: 1.3em;
}

.weather-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.weather-temp {
    font-weight: 600;
    font-size: 1em;
}

.weather-location {
    font-size: 0.8em;
    opacity: 0.9;
}

.search-section {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.search-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.search-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.search-field {
    display: flex;
    flex-direction: column;
}

.search-field label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9em;
}

.search-field input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.search-field input:focus {
    outline: none;
    border-color: #667eea;
}

.search-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.results-section {
    padding: 30px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-header h2 {
    color: #333;
    font-size: 1.5em;
}

.results-info {
    color: #666;
    font-size: 0.9em;
}

.results-container {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
}

/* Горизонтальная прокрутка сверху */
.scrollbar-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 17px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: #f8f9fa;
    display: none; /* Скрыт по умолчанию, показывается только когда есть таблица */
}

/* Скрыть scrollbar но оставить функциональность */
.scrollbar-top::-webkit-scrollbar {
    height: 17px;
}

.scrollbar-top::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.scrollbar-top::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

.scrollbar-top::-webkit-scrollbar-thumb:hover {
    background: #555;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    user-select: text; /* Allow text selection */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th.column-header {
    cursor: pointer;
    user-select: none;
    position: relative;
}

th.column-header:hover {
    background-color: #f0f0f0;
}

th.column-header:active {
    background-color: #e0e0e0;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
    user-select: text; /* Allow text selection */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    cursor: text; /* Show text cursor */
}

td.copyable-cell {
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    position: relative;
}

td.copyable-cell:hover {
    background-color: #f0f0f0;
}

td.copyable-cell:active {
    background-color: #e0e0e0;
}

td.copyable-cell.selecting {
    background-color: #e3f2fd;
}

/* Prevent text selection from spilling to other cells when dragging */
table tbody tr {
    position: relative;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

.placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1em;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #667eea;
    font-weight: 600;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination-top {
    margin-top: 0;
    margin-bottom: 20px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

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

.pagination .page-info {
    padding: 8px 16px;
    color: #666;
}

.error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    border-left: 4px solid #c33;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 30px;
}

.modal-body h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.modal-body form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.modal-body form input,
.modal-body form select {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.modal-body form input:focus,
.modal-body form select:focus {
    outline: none;
    border-color: #667eea;
}

.modal-body table {
    margin-top: 20px;
}

.modal-body table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
}

.modal-body table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

@media (max-width: 768px) {
    .search-fields {
        grid-template-columns: 1fr;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .modal-content {
        max-width: 100%;
    }
    
    .modal-body form {
        grid-template-columns: 1fr !important;
    }
}

