/* --- ОБЩИЕ СТИЛИ --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
}

.container {
    width: 90%;
    max-width: 880px;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-top: 0;
}

textarea {
    width: 100%;
    min-height: 200px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    resize: vertical;
}

/* --- HEADER И FOOTER --- */
.navbar {
    background-color: #2c3e50;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    color: #fff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-link {
    color: #ecf0f1;
    text-decoration: none;
    margin-left: 1.5rem;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #3498db;
}

.footer {
    background-color: #34495e;
    color: #bdc3c7;
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
}

.footer .container {
    background: none;
    box-shadow: none;
    padding: 0;
}

.footer p {
    color: #bdc3c7;
    margin: 0;
}


/* --- ФОРМЫ И ЭЛЕМЕНТЫ УПРАВЛЕНИЯ --- */
.form-container {
    max-width: 400px;
}

.form-field {
    margin-bottom: 1.5rem;
}

.form-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-field input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.customer-type-selector {
    margin-bottom: 1rem;
    padding: 10px;
    background-color: #ecf0f1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.customer-type-selector label {
    font-weight: bold;
}

button {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:disabled {
    background-color: #a9cce3;
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    background-color: #2980b9;
}

.main-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 1rem;
}

.main-actions #checkButton {
    flex-grow: 1;
}

.main-actions #clearButton {
    flex-shrink: 0;
    background-color: #f0f0f0;
    color: #555;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    /* Уменьшаем размер, чтобы соответствовал .secondary-button */
    padding: 8px 15px;
    width: auto;
}

.main-actions #clearButton:hover {
    background-color: #e0e0e0;
}

/* --- СООБЩЕНИЯ И ОШИБКИ --- */
.message-box,
.error-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    /* ОБЩИЕ СТИЛИ ДЛЯ ИСПРАВЛЕНИЯ ШРИФТА */
    letter-spacing: normal;
    word-spacing: normal;
    text-transform: none;
    font-weight: 500;
    line-height: 1.5;
    display: none;
}

.message-box.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-box.error,
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- SUMMARY, PROGRESS, EXPORT --- */
.summary-container {
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    display: none;
    font-size: 0.9em;
    justify-content: space-around;
    flex-wrap: wrap;
    align-items: center;
}

.summary-item {
    margin: 5px 10px;
}

.summary-item:first-child {
    font-weight: bold;
}

.progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 15px;
    height: 10px;
    display: none;
}

.progress-bar {
    width: 0%;
    height: 10px;
    background-color: #4CAF50;
    border-radius: 5px;
    transition: width 0.4s ease;
}

.export-container {
    margin: 20px auto 0 auto;
    display: none;
    /* Изначально скрыт */
    justify-content: center;
    align-items: center;
    height: 40px;
}

.button-group {
    display: flex;
    gap: 10px;
}

.secondary-button {
    font-size: 0.9rem;
    padding: 8px 15px;
    width: auto;
    border-radius: 6px;
    border: 1px solid transparent;
    opacity: 0.9;
    transition: all 0.2s;
}

.secondary-button:hover:not(:disabled) {
    opacity: 1;
}

#copyButton {
    background-color: #28a745;
    border-color: #28a745;
}

#copyButton:hover:not(:disabled) {
    background-color: #218838;
    border-color: #1e7e34;
}

#saveHtmlButton {
    background-color: #007bff;
    border-color: #007bff;
}

#saveHtmlButton:hover:not(:disabled) {
    background-color: #0069d9;
    border-color: #0062cc;
}

.copy-feedback {
    display: none;
    margin-left: 15px;
    color: #28a745;
    font-weight: bold;
}

/* --- RESULTS TABLE --- */
.results-table-container {
    width: 90%;
    max-width: 1320px;
    margin: 20px auto;
}

.results-table {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.results-header {
    display: none;
    font-weight: bold;
    background-color: #f7f7f7;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: center;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    display: flex;
    align-items: center;
}

.result-item {
    display: flex;
    padding: 15px 10px;
    border-bottom: 1px solid #eee;
    align-items: flex-start;
}

.result-item:last-child {
    border-bottom: none;
}

.col-code {
    flex: 0 0 120px;
}

.col-measure {
    flex: 0 0 200px;
    text-align: left;
    white-space: pre-line;
}

.col-name {
    flex: 1 1 auto;
    text-align: left;
}

.col-name>div>strong {
    font-weight: 600;
}

.source-info {
    font-size: 0.85em;
    color: #555;
    font-weight: normal;
    margin-left: 5px;
    white-space: nowrap;
}

.normalized-code-info {
    font-size: 0.85em;
    color: #777;
    margin-top: 4px;
    font-style: italic;
}

.status-ok {
    color: #28a745;
    font-weight: bold;
}

.col-measure.status-error,
.summary-item.status-error {
    color: #dc3545;
    font-weight: bold;
}

/* --- ICONS (Warning & Tooltip) --- */
.icons-container {
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.warning-icon,
.obsolete-icon {
    position: relative;
    cursor: help;
}

.warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    background-color: #ffc107;
    color: #333;
}

.obsolete-icon {
    font-size: 14px;
    line-height: 1;
}

.warning-icon .tooltip-text,
.obsolete-icon .tooltip-text {
    visibility: hidden;
    width: 250px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: normal;
}

.warning-icon:hover .tooltip-text,
.obsolete-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* --- ACCORDIONS (Details & Groups) --- */
.details-list {
    margin-top: 10px;
}

.detail-item {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 5px;
}

.toggle-header {
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    color: #007bff;
}

.toggle-header strong {
    color: #0056b3;
}

.toggle-header::before {
    content: '+';
    display: inline-block;
    width: 20px;
    font-weight: bold;
    font-size: 1.2em;
}

.toggle-header.open::before {
    content: '−';
}

.detail-item .content {
    display: none;
    padding-left: 20px;
    color: #333;
    margin-top: 5px;
}

.group-accordion-header {
    font-weight: bold;
    cursor: pointer;
    padding: 8px;
    margin-top: 15px;
    border-top: 1px solid #ddd;
    padding-top: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    transition: background-color 0.2s;
    position: relative;
}

.group-accordion-header:hover {
    background-color: #f0f0f0;
}

.group-accordion-header::after {
    content: '▼';
    font-size: 0.8em;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s;
}

.group-accordion-header.open::after {
    transform: translateY(-50%) rotate(180deg);
}

.group-accordion-content {
    padding-left: 15px;
    border-left: 2px solid #e0e0e0;
    display: none;
}

/* --- SPINNER --- */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, .2);
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

/* --- SETTINGS PAGE --- */
.settings-group {
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.settings-group legend {
    font-weight: bold;
    padding: 0 10px;
    margin-left: 5px;
    color: #34495e;
}

.setting-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
}

.setting-item label {
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
}

/* ====================================================== */
/* СТИЛИ ДЛЯ СТРАНИЦЫ "О ПРОЕКТЕ" (ЦВЕТА РОСТЕЛЕКОМА) */
/* ====================================================== */

.about-page .subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: #777;
    margin-top: -15px;
    margin-bottom: 20px;
}

.about-page h2 {
    /* Основной синий цвет Ростелекома */
    color: #7B29FF;
    border-bottom: 2px solid #FF4F12;
    /* Оранжево-розовый акцент */
    padding-bottom: 8px;
    margin-top: 25px;
}

.developer-contacts {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 20px;
    border-radius: 8px;
}

.developer-contacts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.developer-contacts li {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

/* Ссылки в фирменном цвете */
.about-page a {
    color: #0071BB;
    text-decoration: none;
    font-weight: 500;
}

.about-page a:hover {
    color: #FF4F12;
    text-decoration: underline;
}

/* ================================== */
/* СТИЛИ ДЛЯ ЛОГОТИПА НА СТРАНИЦЕ ABOUT */
/* ================================== */

.logo-container {
    text-align: center;
    margin: 10px 0 20px 0;
    /* Уменьшаем отступы */
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.logo-container img {
    max-width: 280px;
    /* Ограничиваем максимальную ширину логотипа */
    height: auto;
    /* Высота подстроится автоматически */
}

/* --- НОВЫЕ СТИЛИ ДЛЯ СЕТКИ КОНТАКТОВ --- */
.contacts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Создаем 2 колонки одинаковой ширины */
    gap: 15px 20px;
    /* Вертикальный и горизонтальный зазор */
    margin-top: 15px;
}

.contact-item {
    font-size: 1rem;
}

.contact-item strong {
    display: inline-block;
    /* Заголовок над контактом */
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
    margin-right: 8px;
}

/* --- КОНЕЦ НОВЫХ СТИЛЕЙ --- */

.about-page a {
    color: #0071BB;
    text-decoration: none;
    font-weight: 500;
}

.about-page a:hover {
    color: #FF4F12;
    text-decoration: underline;
}

.project-description p {
    line-height: 1.6;
    /* Улучшаем читаемость текста */
}