* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

section {
    background: white;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

section h2 {
    color: #1e3c72;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.intro {
    text-align: center;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.nav-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #2a5298;
}

.nav-card h3 {
    color: #1e3c72;
    margin-bottom: 0.5rem;
}

.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.city-link {
    background: #dc3545;
    color: white;
    padding: 1rem;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s;
}

.city-link:hover {
    background: #c82333;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

table th,
table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}


table th {
    background-color: #c5d5f5;
    color: #000;
    font-weight: 700;
    font-size: 17px;
    padding: 8.5px;
    text-align: left;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

table thead tr:first-child th {
    background-color: #c5d5f5;
    color: #000;
    font-weight: 700;
}

table thead tr:last-child th {
    background-color: #e8eef8;
    color: #000;
    font-weight: 600;
    font-size: 14px;
    padding: 6px 8.5px;
}

table tbody tr {
    transition: background-color 0.2s;
}

table tbody tr:hover {
    background-color: #f0f7ff;
}

table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

table tbody tr:nth-child(even):hover {
    background-color: #f0f7ff;
}

table td:first-child {
    font-weight: 500;
    color: #1e3c72;
}

/* Убираем ограничение ширины для первой колонки */
table th:first-child,
table td:first-child {
    max-width: none;
}

/* Визуальное разделение столбцов валют */
/* Разделяем группы: USD (2 столбца), EUR (2 столбца), UAH (2 столбца) */
/* Столбцы: 1-2 (Кантор, Дата), 3-4 (USD), 5-6 (EUR), 7-8 (UAH) */

/* Толстые разделители между группами валют (USD, EUR, UAH) */
/* Разделитель перед USD (3-й столбец) - в первой строке заголовка и в данных */
table thead tr:first-child th:nth-child(3),
table thead tr:last-child th:nth-child(3),
table tbody td:nth-child(3) {
    border-left: 3px solid #1e3c72;
    padding-left: 1.2rem;
}

/* Разделитель перед EUR (5-й столбец) */
table thead tr:first-child th:nth-child(5),
table thead tr:last-child th:nth-child(5),
table tbody td:nth-child(5) {
    border-left: 3px solid #1e3c72;
    padding-left: 1.2rem;
}

/* Разделитель перед UAH (7-й столбец) */
table thead tr:first-child th:nth-child(7),
table thead tr:last-child th:nth-child(7),
table tbody td:nth-child(7) {
    border-left: 3px solid #1e3c72;
    padding-left: 1.2rem;
}

/* Тонкие разделители между "Сдать" и "Купить" внутри каждой валюты */
/* Вторая строка заголовка: разделитель перед "Купить" (четные столбцы 4, 6, 8) */
table thead tr:last-child th:nth-child(4),
table thead tr:last-child th:nth-child(6),
table thead tr:last-child th:nth-child(8) {
    border-left: 1px solid #a0a0a0;
    padding-left: 0.8rem;
}

/* Стили для ссылок в таблице */
table tbody td a {
    color: #1e3c72;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

table tbody td a:hover {
    color: #2a5298;
    text-decoration: underline;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    background: white;
    margin-top: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #218838;
}

.btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nav-grid {
        grid-template-columns: 1fr;
    }

    .cities-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

