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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    height: 100vh;
}

/* Навигация */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    background: rgba(255,255,255,0.2);
    color: white;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.nav-btn.primary {
    background: #ff6b6b;
    color: white;
}

.nav-btn.primary:hover {
    background: #ff5252;
}

/* Основной контейнер */
.main-container {
    display: flex;
    height: 100vh;
    padding-top: 70px;
}

.map-container {
    flex: 2;
    height: calc(100vh - 70px);
}

.right-panel {
    width: 400px;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
}

.panel-content {
    padding: 1.5rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

/* Карточка колледжа */
.college-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.college-card h3 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.college-card h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.college-info {
    margin: 1rem 0;
}

.info-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-label {
    font-weight: 600;
    color: #495057;
    display: inline-block;
    width: 140px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.tag {
    background: #e7f3ff;
    color: #0066cc;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-edit, .btn-delete {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-edit {
    background: #28a745;
    color: white;
}

.btn-edit:hover {
    background: #218838;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-large {
    max-width: 90%;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    margin: 0;
}

.close, .close-table {
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.close:hover, .close-table:hover {
    transform: scale(1.2);
}

form {
    padding: 1.5rem;
}

form label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

form input, form textarea, form select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

form input:focus, form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.2);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-save, .btn-cancel {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.btn-save {
    background: #28a745;
    color: white;
}

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

/* Таблица */
.table-container {
    overflow-x: auto;
    padding: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
}

tr:hover {
    background: #f8f9fa;
}

.action-btn {
    padding: 0.25rem 0.5rem;
    margin: 0 0.25rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.edit-action {
    background: #28a745;
    color: white;
}

.delete-action {
    background: #dc3545;
    color: white;
}

/* Стили для списка колледжей по адресу */
.colleges-list {
    padding: 0;
}

.college-card.compact {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 12px;
}

.college-card.compact:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.college-info-compact {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #666;
}

.address-info {
    background: #e7f3ff;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #0066cc;
    font-weight: 500;
}

/* Стили для примечаний */
.notes-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px !important;
    margin-top: 10px;
}

.notes-content {
    width: 100%;
    margin-top: 0.5rem;
}

.notes-display {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    margin: 8px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

.notes-edit {
    width: 100%;
    padding: 10px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin: 8px 0;
}

.notes-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-edit-notes, .btn-save-notes, .btn-cancel-notes {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-edit-notes {
    background: #17a2b8;
    color: white;
}

.btn-edit-notes:hover {
    background: #138496;
}

.btn-save-notes {
    background: #28a745;
    color: white;
}

.btn-save-notes:hover {
    background: #218838;
}

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

.btn-cancel-notes:hover {
    background: #5a6268;
}

/* Кнопка возврата к карте */
.back-to-map {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    width: fit-content;
}

.back-to-map:hover {
    background: #5a6268;
    transform: translateX(-2px);
}

.card-header, .list-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .map-container {
        height: 50vh;
    }
    
    .right-panel {
        width: 100%;
        height: 50vh;
    }
    
    .modal-large {
        width: 95%;
        margin: 2% auto;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .main-container {
        padding-top: 100px;
    }
    
    .info-label {
        width: 120px;
        font-size: 0.9rem;
    }
    
    .college-info-compact {
        flex-direction: column;
        gap: 5px;
    }
}
/* Стили для кластеров */
.cluster-balloon {
    max-width: 320px;
}

.cluster-balloon-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 12px;
    font-weight: bold;
    border-radius: 8px 8px 0 0;
}

.cluster-balloon-items {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}

.cluster-item {
    padding: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.cluster-item:hover {
    background: #f0f0f0;
    border-radius: 6px;
}

.cluster-item strong {
    color: #667eea;
}

.cluster-spec {
    font-size: 12px;
    color: #666;
}

.cluster-cost {
    font-size: 12px;
    color: #28a745;
    font-weight: bold;
}

/* Индикатор загрузки */
.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 10000;
    text-align: center;
}

.loader {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

/* Стили для элементов кластера */
.cluster-balloon-item {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.cluster-balloon-item:hover {
    background: #f5f5f5;
}

.cluster-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.cluster-link strong {
    color: #667eea;
    font-size: 14px;
}

.cluster-spec {
    font-size: 11px;
    color: #666;
    display: block;
}

.cluster-cost {
    font-size: 12px;
    color: #28a745;
    font-weight: bold;
    display: inline-block;
    margin-top: 3px;
}

/* Отключаем зум при клике на кластер */
.ymaps-2-1-79-cluster__content {
    cursor: pointer;
}
/* Стили для ссылок в примечаниях */
.notes-link {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px dashed #0066cc;
    transition: all 0.2s;
    display: inline-block;
    margin: 2px 0;
    word-break: break-all;
}

.notes-link:hover {
    color: #004499;
    border-bottom-color: #004499;
    text-decoration: none;
}

.notes-link:active {
    transform: scale(0.98);
}

/* Для отображения ссылок в режиме просмотра */
.notes-display {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #667eea;
    margin: 8px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
}

.notes-display a {
    color: #0066cc;
    text-decoration: none;
    border-bottom: 1px solid #0066cc;
}

.notes-display a:hover {
    color: #004499;
    border-bottom-color: #004499;
}

/* Убедимся что модальные окна правильно накладываются */
#tableModal {
    z-index: 9999;
}

#modal {
    z-index: 10000;
}

.modal-content {
    position: relative;
    background: white;
}

/* Затемнение фона */
.modal {
    background-color: rgba(0,0,0,0.5);
}

/* Кнопки в таблице должны быть кликабельны */
.action-btn {
    cursor: pointer;
    padding: 5px 10px;
    margin: 0 3px;
    border: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}