/* Глобальные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Навигация */
.main-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--primary-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(52, 152, 219, 0.1);
}

.nav-link.active {
    color: white;
    background: var(--primary-color);
}

/* Секции */
.section {
    display: none;
    min-height: calc(100vh - 80px);
    padding: 2rem 0;
}

.section.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

h1 {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
}

/* Теория */
.theory-grid {
    display: grid;
    gap: 2rem;
    margin-top: 2rem;
}

.theory-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.theory-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.theory-card.full-width {
    grid-column: 1 / -1;
}

.theory-card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theory-content {
    color: #555;
    font-size: 1.1rem;
}

.theory-img {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Визуальные диаграммы */
.visual-diagram {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 1rem 0;
}

.equilibrium-visual {
    text-align: center;
}

.reaction-arrow-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 1rem;
}

.arrows-both {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.arrow-forward, .arrow-backward {
    font-size: 2rem;
    font-weight: bold;
}

.arrow-forward {
    color: var(--secondary-color);
}

.arrow-backward {
    color: var(--danger-color);
}

.speed-equal {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.speed-equal sub {
    font-size: 0.8em;
}

.particles-visual {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
}

.formula-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    font-size: 1.3rem;
    text-align: center;
}

.highlight {
    background: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1.2rem;
    color: #333;
    border-left: 5px solid var(--warning-color);
}

.factors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.factor-card {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    border: 2px solid rgba(52, 152, 219, 0.3);
    transition: var(--transition);
}

.factor-card:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.factor-card i {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.factor-card h3 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.factor-card p {
    color: #666;
    font-size: 0.95rem;
    margin: 0.5rem 0;
}

.goals-list {
    list-style: none;
    padding: 0;
}

.goals-list li {
    padding: 1rem;
    margin: 0.5rem 0;
    background: rgba(46, 204, 113, 0.1);
    border-left: 4px solid var(--secondary-color);
    border-radius: 4px;
    font-size: 1.1rem;
}

.goals-list strong {
    color: var(--primary-color);
}

/* Кнопки */
.btn-primary, .btn-secondary, .btn-control, .btn-action {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

.btn-control {
    background: var(--secondary-color);
    color: white;
    padding: 0.8rem 1.5rem;
}

.btn-control:hover:not(:disabled) {
    background: #27ae60;
}

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

.btn-action {
    background: var(--primary-color);
    color: white;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

.btn-action:hover {
    background: #2980b9;
}

/* Симуляция */
.reaction-selector {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.reaction-selector h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.reaction-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.reaction-btn {
    background: white;
    border: 3px solid #ddd;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.reaction-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.reaction-btn.active {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
    border-color: var(--primary-color);
}

.reaction-btn strong {
    display: block;
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.reaction-btn span {
    color: #666;
    font-size: 0.95rem;
}

/* Визуализация */
.simulation-area {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.reaction-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    margin-bottom: 2rem;
}

.reaction-side {
    text-align: center;
}

.reaction-side h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.molecule-display {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.molecule-display canvas {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
}

.concentration-display {
    margin-top: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.reaction-arrows {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.arrow-container {
    position: relative;
    width: 100%;
    height: 80px;
}

.arrow {
    position: absolute;
    height: 30px;
    background: var(--primary-color);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    transition: var(--transition);
    overflow: hidden;
}

.arrow.forward {
    top: 0;
    left: 0;
}

.arrow.backward {
    bottom: 0;
    left: 0;
    background: var(--danger-color);
}

.arrow-speed {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    animation: moveArrow 2s linear infinite;
}

@keyframes moveArrow {
    from {
        left: -20px;
    }
    to {
        left: 100%;
    }
}

.equilibrium-status {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.equilibrium-status.balanced {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #006400;
}

.equilibrium-status.forward {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: #b30000;
}

.equilibrium-status.backward {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #0066b3;
}

/* График */
.chart-container {
    margin: 2rem 0;
}

.chart-container h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Панель управления */
.control-panel {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.control-panel h3 {
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.control-group {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(155, 89, 182, 0.05) 100%);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 2px solid rgba(52, 152, 219, 0.2);
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.1rem;
}

.value-display {
    color: var(--primary-color);
    font-size: 1.2rem;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
    outline: none;
    margin: 1rem 0;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.temp-indicators, .pressure-indicators {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

.control-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.observation-box {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 2rem;
    border-left: 5px solid var(--warning-color);
}

.observation-box h4 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.observation-box p {
    color: #555;
    line-height: 1.8;
    font-size: 1.05rem;
}

/* Протокол */
.protocol-form {
    background: white;
    border-radius: var(--border-radius);
    padding: 3rem;
    margin: 2rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 3px solid var(--primary-color);
}

.form-header h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.form-subtitle {
    color: #666;
    font-size: 1.2rem;
}

.form-section {
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.03) 0%, rgba(155, 89, 182, 0.03) 100%);
    border-radius: var(--border-radius);
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    border-bottom: 2px solid rgba(52, 152, 219, 0.3);
    padding-bottom: 0.5rem;
}

.form-group {
    margin: 1rem 0;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-section textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.form-group input:focus,
.form-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.readonly-field {
    background: rgba(236, 240, 241, 0.5);
    padding: 1rem;
    border-radius: var(--border-radius);
    color: #555;
    font-size: 1.05rem;
}

.goals-checklist {
    list-style: none;
    padding: 0;
}

.goals-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 2px solid #ddd;
    transition: var(--transition);
}

.goals-checklist li:hover {
    border-color: var(--secondary-color);
}

.goals-checklist input[type="checkbox"] {
    margin-top: 0.3rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.goals-checklist label {
    flex: 1;
    cursor: pointer;
    font-size: 1.05rem;
    color: #555;
}

.info-text {
    color: #666;
    font-style: italic;
    padding: 1rem;
    background: rgba(241, 196, 15, 0.1);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--warning-color);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.results-table th,
.results-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.results-table th {
    font-weight: 600;
    font-size: 1rem;
}

.results-table tbody tr:hover {
    background: rgba(52, 152, 219, 0.05);
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #ddd;
}

/* Подвал */
.footer {
    background: rgba(44, 62, 80, 0.95);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

.footer p {
    margin: 0.5rem 0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .nav-link {
        text-align: center;
    }

    h1 {
        font-size: 1.8rem;
    }

    .reaction-container {
        grid-template-columns: 1fr;
    }

    .reaction-arrows {
        transform: rotate(90deg);
        margin: 2rem 0;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .control-buttons {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary, .btn-control {
        width: 100%;
        justify-content: center;
    }
}

/* Печать */
@media print {
    .main-nav,
    .control-panel,
    .form-actions,
    .footer {
        display: none !important;
    }

    body {
        background: white;
    }

    .section {
        display: block !important;
    }

    .protocol-form {
        box-shadow: none;
        padding: 1rem;
    }
}
