/* Основные стили сайта MATRIX */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(45deg, #667eea, #764ba2);
    --light-bg: rgba(255, 255, 255, 0.95);
    --dark-bg: #f8f9fa;
    --text-dark: #2c3e50;
    --text-light: #555;
    --accent: #667eea;
    --accent-dark: #5a6fd8;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #f44336;
    --shadow: 0 5px 15px rgba(0,0,0,0.1);
    --shadow-large: 0 10px 30px rgba(0,0,0,0.2);
    --border-radius: 10px;
    --transition: all 0.3s ease;
}

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

body {
      font-family: 'Poppins', 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--primary-gradient);
    min-height: 100vh;
}

/* ==================== ОБЩИЕ УТИЛИТЫ ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== ШАПКА (ОБЩИЕ СТИЛИ) ==================== */
.main-header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 106px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}


.nav-main ul {
    display: flex;
    list-style: none;
    gap: 25px;
    margin: 0;
    padding: 0;
}

.nav-main a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 5px 0;
    font-size: 0.95em;
}

.nav-main a:hover {
    color: var(--accent);
}

.nav-main a.active {
    color: var(--accent);
}

.nav-main a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--secondary-gradient);
}

.btn-matrix {
    background: var(--secondary-gradient);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    white-space: nowrap;
}

.btn-matrix:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: white;
}

/* ==================== ПОДВАЛ (ОБЩИЕ СТИЛИ) ==================== */
.main-footer {
    background: #2c3e50;
    color: white;
    padding: 70px 20px 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 50px;
    margin-bottom: 50px;
}

.footer-column h4 {
    color: var(--accent);
    margin-bottom: 25px;
    font-size: 1.2em;
    font-weight: 600;
    position: relative;
    padding-bottom: 10px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.footer-logo img {
    height: 40px;
}

.footer-logo h3 {
    font-size: 1.4em;
    margin: 0;
    color: white;
}

.footer-logo p {
    font-size: 0.9em;
    color: #aaa;
    margin: 0;
}

.footer-description {
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 0.95em;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: var(--transition);
    font-size: 1.1em;
}

.social-links a:hover {
    background: var(--accent);
    transform: translateY(-3px);
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 15px;
}

.footer-links a {
    color: #ddd;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95em;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--accent);
    transform: translateX(5px);
}

.footer-contacts {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
}

.footer-contacts li {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #ddd;
    font-size: 0.95em;
}

.footer-contacts i {
    color: var(--accent);
    margin-top: 3px;
    width: 20px;
}

.footer-contacts a {
    color: #ddd;
    text-decoration: none;
    transition: var(--transition);
}

.footer-contacts a:hover {
    color: var(--accent);
}

.footer-newsletter {
    margin-top: 25px;
}

.footer-newsletter p {
    color: #aaa;
    margin-bottom: 15px;
    font-size: 0.95em;
}

.newsletter-form {
    display: flex;
    gap: 10px;
}

.newsletter-form input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9em;
}

.newsletter-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.newsletter-form button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.newsletter-form button:hover {
    background: var(--accent-dark);
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    padding: 25px 0;
    text-align: center;
}

.footer-bottom .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-bottom p {
    color: #aaa;
    font-size: 0.9em;
    margin: 0;
}

.footer-legal {
    display: flex;
    gap: 25px;
}

.footer-legal a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9em;
    transition: var(--transition);
}

.footer-legal a:hover {
    color: var(--accent);
}

.footer-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.btn-footer {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-footer:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    color: white;
}

.btn-footer-outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 10px 25px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    font-size: 0.95em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-footer-outline:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
}

/* ==================== СТИЛИ ДЛЯ КАЛЬКУЛЯТОРА МАТРИЦЫ ==================== */
/* Контейнер калькулятора (ТОЛЬКО для matrix.html) */
.matrix-container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
    margin-top: 100px;
    margin-bottom: 30px;
}

.matrix-title {
    text-align: center;
    color: var(--text-dark);
    font-weight: 300;
    font-size: 2.2em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 5px;
}

.matrix-subtitle {
    text-align: center;
    margin-bottom: 10px;
    color: var(--text-dark);
    font-weight: 300;
    font-size: 1.025em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Логотип в углу (для калькулятора) */
.logo-container {
    display: flex;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    flex-direction: column;
    transition: transform 1s ease;
    transform-origin: top left;
}

.logo-container:hover {
    transform: scale(1.5);
}

.logo-img {
    display: block;
    width: 120px;
    height: auto;
    margin-bottom: 10px;
}

.logo__text {
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
    line-height: 1.2;
}

.logo-line {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.line1 {
    font-size: 15px;
}

.line2, .line3, .line4 {
    font-size: inherit;
}

@media (max-width: 768px) {
    .logo-container {
        transform: scale(0.8);
        top: 10px;
        left: 10px;
    }
    .logo-img {
        width: 100px;
    }
}

/* Стили для кнопок языка (базовые) */
.lang-btn {
    padding: 8px 16px;
    border: 2px solid var(--accent);
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--accent);
    min-width: 60px;
    text-align: center;
    line-height: 1.2;
}

.lang-btn.active {
    background: var(--accent);
    color: white;
}

.lang-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102,126,234,0.3);
}

/* Стили для кнопок периода (базовые) */
.period-btn {
    padding: 8px 16px;
    border: 2px solid var(--accent);
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--accent);
    min-width: 70px;
    text-align: center;
    line-height: 1.2;
}

.period-btn.active {
    background: var(--accent);
    color: white;
}

.period-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(102,126,234,0.3);
}

/* Стили для кнопок информации (базовые) */
.info-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102,126,234,0.3);
}

.info-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(102,126,234,0.5);
}

.info-btn img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* Стили для матрицы */
.current-date {
    font-size: 20px;
    font-weight: bold;
    color: white;
}

.date-input {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: var(--transition);
    width: 100%;
}

.date-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.results-table {
    width: 100%;
    margin-bottom: 30px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.table-cell {
    padding: 15px;
    text-align: center;
    font-size: 18px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    min-height: 60px;
}

.colspan-2 {
    grid-column: span 2;
}

.colspan-3 {
    grid-column: span 3;
}

.colspan-4 {
    grid-column: span 4;
}

.date-header {
    background: var(--secondary-gradient) !important;
    color: white;
    border: none !important;
}

.value-cell {
    background: white;
    cursor: pointer;
    position: relative;
    font-weight: 500;
    width: 100%;
    height: 100%;
}

.value-cell:hover {
    background: #bfc7ec;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.value-cell.empty {
    color: #999;
    font-style: italic;
    cursor: pointer;
}

.value-cell.empty:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background: #f0f0f0;
}

/* Контейнеры калькулятора */
.main-content-wrapper {
    max-width: 1000px;
    margin: 30px auto 0;
}

.time-matrices-wrapper {
    position: relative;
    height: 380px;
    margin-bottom: 20px;
    max-height: 380px;
}

.time-matrices-container {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.three-matrices {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    height: 100%;
    width: 100%;
}

.time-matrix {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 0;
    height: 100%;
}

#yesterdayMatrix {
    background: #d9d9d9;
}

#yesterdayMatrix .matrix-cell {
    background: #f0f0f0;
}

#yesterdayMatrix .matrix-value-cell:hover {
    background: #e0e0e0;
}

#tomorrowMatrix {
    background: #f0f8ff;
}

#tomorrowMatrix .matrix-cell {
    background: #f0f8ff;
}

#tomorrowMatrix .matrix-value-cell:hover {
    background: #d0e8ff;
}

.matrix-header {
    grid-column: span 4;
    background: var(--secondary-gradient);
    color: white;
    padding: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    border: none;
}

.matrix-date-row {
    grid-column: span 4;
    background: #f8f9fa;
    padding: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 12px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.matrix-rstring-row {
    grid-column: span 4;
    background: #e8eaf6;
    padding: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 11px;
    font-family: 'Poppins', 'Arial', sans-serif;
    border-bottom: 1px solid #e0e0e0;
}

.matrix-cell {
    padding: 6px;
    text-align: center;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    font-weight: 500;
    min-height: 0;
    overflow: hidden;
}

.matrix-value-cell {
    cursor: pointer;
    transition: var(--transition);
}

.matrix-value-cell:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.matrix-empty {
    color: #999;
    font-style: italic;
    cursor: pointer;
}

.matrix-empty:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: #f0f0f0;
}

.matrix-date-input {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    transition: var(--transition);
    min-width: 100px;
    width: auto;
    max-width: 150px;
    text-align: center;
    box-sizing: border-box;
}

.matrix-date-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 6px rgba(102, 126, 234, 0.3);
}

.date-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.nav-btn {
    background: var(--secondary-gradient);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.nav-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.nav-btn:active {
    transform: scale(0.95);
}

.triangle-left {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 7px solid white;
    margin-right: 2px;
}

.triangle-right {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid white;
    margin-left: 2px;
}

/* Большой контейнер */
.large-container-wrapper {
    height: 500px;
    margin-bottom: 20px;
    max-height: 500px;
}

.large-container {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.large-container-content {
    display: flex;
    height: 100%;
    width: 100%;
}

.pyramid-container {
    flex: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-right: 1px solid #e0e0e0;
    background: transparent;
}

.bg-toggle-btn {
    position: absolute;
    top: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--accent);
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.bg-toggle-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.bg-toggle-btn.active {
    background: var(--accent);
    color: white;
}

.bg-toggle-btn .fa-image {
    font-size: 16px;
}

.interpretations-container {
    flex: 1;
    height: 100%;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.interpretations-placeholder {
    text-align: center;
    color: #666;
    font-size: 16px;
}

/* График */
.graph-container-wrapper {
    margin-bottom: 20px;
}

.graph-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

/* Спойлеры */
.spoiler-section {
    margin-bottom: 15px;
}

.spoiler-toggle-btn {
    background: var(--secondary-gradient);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    transition: var(--transition);
    margin-bottom: 5px;
}

.spoiler-toggle-btn:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a4190);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.spoiler-toggle-btn .toggle-icon {
    transition: transform 0.3s ease;
}

.spoiler-toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

.spoiler-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.spoiler-content.active {
    max-height: 2000px;
}

/* График */
.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.graph-title {
    color: var(--text-dark);
    font-size: 1.5em;
    font-weight: 300;
    margin: 0;
}

.graph-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.time-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-label {
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}

.number-input {
    width: 60px;
    padding: 8px 12px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.number-input:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.number-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--accent);
    background: white;
    color: var(--accent);
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.number-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.number-btn:active {
    transform: scale(0.95);
}

.graph-canvas-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 15px;
}

#potentialChart {
    width: 100% !important;
    height: 100% !important;
}

.graph-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-text {
    font-size: 14px;
    color: var(--text-dark);
    font-weight: 500;
}

.legend-0 { background-color: #999; }
.legend-1 { background-color: #4ecdc4; }
.legend-2 { background-color: #ffa726; }
.legend-r2 { background-color: #81c784; }
.legend-r4 { background-color: #e57373; }
.legend-r2-r4 { background-color: #ba68c8; }

.graph-info {
    margin-top: 15px;
    padding: 12px;
    background: #f0f8ff;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-dark);
    text-align: center;
    border-left: 4px solid var(--accent);
    line-height: 1.5;
}

/* Спойлер анализа периодов */
.period-analysis-spoiler {
    margin-top: 10px;
    width: 100%;
}

.period-analysis-toggle {
    background: var(--secondary-gradient);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    transition: var(--transition);
}

.period-analysis-toggle:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a4190);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.period-analysis-toggle .toggle-icon {
    transition: transform 0.3s ease;
}

.period-analysis-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.period-analysis-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8f9fa;
    border-radius: 0 0 6px 6px;
    margin-top: 0;
}

.period-analysis-content.active {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
    padding: 10px;
}

.period-analysis {
    padding: 5px;
    font-size: 13px;
    text-align: left;
}

.period-analysis ul {
    margin: 5px 0;
    padding-left: 20px;
}

.period-analysis li {
    margin-bottom: 5px;
    padding: 3px 0;
    border-bottom: 1px solid #e0e0e0;
}

.period-analysis li:last-child {
    border-bottom: none;
}

.period-time {
    font-weight: 600;
    color: var(--text-dark);
    min-width: 50px;
    display: inline-block;
}

.period-description {
    color: #555;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    animation: modalAppear 0.3s ease;
}

@keyframes modalAppear {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal-title {
    margin-bottom: 15px;
    color: var(--text-dark);
    font-size: 1.4em;
}

.modal-text {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    max-height: 400px;
    overflow-y: auto;
}

.modal-text p {
    margin-bottom: 10px;
}

.table-header {
    background: var(--secondary-gradient) !important;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.table-subheader {
    background: #f8f9fa !important;
    font-weight: bold;
    color: var(--text-dark);
}

/* Стили для списка инструкций */
.features-list {
    margin: 15px 0;
    padding-left: 20px;
}

.features-list li {
    margin-bottom: 10px;
    padding-left: 10px;
    color: #555;
    line-height: 1.5;
}

.program-info {
    margin: 15px 0;
    padding: 15px;
    background: #f0f8ff;
    border-radius: 8px;
    font-size: 14px;
}

.program-info p {
    margin: 5px 0;
}

/* Адаптивность */
@media (max-width: 1300px) {
    .logo-container {
       display: none;
    }
}

@media (max-width: 1024px) {
    .three-matrices {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .time-matrix {
        min-height: 200px;
    }
    
    .time-matrices-wrapper {
        height: auto;
        min-height: 400px;
    }
    
    .large-container-wrapper {
        height: auto;
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .matrix-container {
        padding: 20px;
        margin-top: 80px;
    }
    
    .main-content-wrapper {
        margin-top: 15px;
    }
    
    .time-matrices-wrapper {
        height: auto;
        min-height: 300px;
        margin-bottom: 15px;
    }
    
    .large-container-wrapper {
        height: auto;
        min-height: 400px;
        margin-bottom: 15px;
    }
    
    .large-container-content {
        flex-direction: column;
        height: 100%;
    }
    
    .pyramid-container {
        height: 60%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .interpretations-container {
        height: 40%;
        padding: 15px;
    }
    
    .bg-toggle-btn {
        top: 5px;
        width: 32px;
        height: 32px;
    }
    
    .graph-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .graph-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .graph-canvas-container {
        height: 300px;
        padding: 10px;
    }
    
    .spoiler-toggle-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .period-analysis-content.active {
        max-height: 400px;
    }
    .header-container {
        padding: 0 6px;
    }
}

/* ============ АДАПТИВ ДЛЯ ПАНЕЛЕЙ С КНОПКАМИ ============ */
@media (max-width: 768px) {
    /* Контейнер с кнопками под таблицей */
    div[style*="justify-content: space-between"][style*="margin: 25px 0 15px 0"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        margin: 15px 0 10px 0 !important;
    }
    
    /* Левый контейнер (информация и язык) */
    div[style*="justify-content: space-between"] > div:first-child {
        width: 100%;
        justify-content: space-between;
        gap: 10px !important;
    }
    
    /* Правый контейнер (периоды) */
    div[style*="justify-content: space-between"] > div:last-child {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px !important;
    }
    
    /* Кнопки информации */
    .info-btn {
        width: 36px !important;
        height: 36px !important;
        box-shadow: 0 2px 6px rgba(102,126,234,0.3) !important;
    }
    
    .info-btn img {
        width: 16px !important;
        height: 16px !important;
    }
    
    /* Кнопки языка */
    .lang-btn {
        padding: 5px 10px !important;
        font-size: 12px !important;
        min-width: 45px !important;
        border-width: 1.5px !important;
    }
    
    /* Кнопки периода */
    .period-btn {
        padding: 5px 10px !important;
        font-size: 12px !important;
        min-width: 50px !important;
        border-width: 1.5px !important;
        flex: 0 1 auto;
    }
}

@media (max-width: 480px) {
    /* Кнопки информации */
    .info-btn {
        width: 32px !important;
        height: 32px !important;
    }
    
    .info-btn img {
        width: 14px !important;
        height: 14px !important;
    }
    
    /* Кнопки языка */
    .lang-btn {
        padding: 4px 8px !important;
        font-size: 11px !important;
        min-width: 40px !important;
    }
    
    /* Кнопки периода */
    .period-btn {
        padding: 4px 6px !important;
        font-size: 10px !important;
        min-width: 45px !important;
    }
    
    /* Уменьшаем отступы */
    div[style*="justify-content: space-between"] > div:first-child {
        gap: 8px !important;
    }
    
    div[style*="justify-content: space-between"] > div:last-child {
        gap: 4px !important;
    }
}

@media (max-width: 360px) {
    .info-btn {
        width: 28px !important;
        height: 28px !important;
    }
    
    .info-btn img {
        width: 12px !important;
        height: 12px !important;
    }
    
    .lang-btn {
        padding: 3px 6px !important;
        font-size: 10px !important;
        min-width: 35px !important;
    }
    
    .period-btn {
        padding: 3px 4px !important;
        font-size: 9px !important;
        min-width: 38px !important;
    }
}
/* ============ АДАПТИВ ДЛЯ ОСНОВНОЙ МАТРИЦЫ ============ */
@media (max-width: 768px) {
    .results-table {
        font-size: 14px;
        grid-template-columns: repeat(4, 1fr);
    }
    
    .table-cell {
        padding: 10px 5px;
        font-size: 14px;
        min-height: 45px;
        word-break: break-word;
    }
    
    .current-date {
        font-size: 16px;
    }
    
    .date-input {
        padding: 6px 8px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .results-table {
        font-size: 12px;
    }
    
    .table-cell {
        padding: 8px 3px;
        font-size: 12px;
        min-height: 40px;
    }
    
    .current-date {
        font-size: 14px;
    }
    
    .date-input {
        padding: 4px 6px;
        font-size: 12px;
    }
}
/* ============ ИСПРАВЛЕНИЯ ДЛЯ МОБИЛЬНОЙ ВЕРСИИ matrix.html ============ */

@media (max-width: 768px) {
    /* Увеличиваем отступ снизу перед футером */
    .main-content-wrapper {
        margin-bottom: 30px;
    }
    
    /* Фикс для пирамиды */
    .large-container-wrapper {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    .large-container {
        height: auto !important;
        min-height: 500px;
    }
    
    .large-container-content {
        flex-direction: column;
        height: auto;
    }
    
    .pyramid-container {
        height: 400px !important;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .interpretations-container {
        height: auto !important;
        min-height: 200px;
        padding: 20px;
        width: 100%;
    }
    
    /* Фикс для кнопок пирамиды */
    .bg-toggle-btn {
        top: 10px;
        width: 36px;
        height: 36px;
        z-index: 20;
    }
    
    #toggleBackgroundBtn {
        right: 10px !important;
    }
    
    #toggleDisplayBtn {
        right: 55px !important;
    }
    
    /* Фикс для графика */
    .graph-container-wrapper {
        margin-bottom: 20px;
    }
    
    .graph-container {
        padding: 15px;
    }
    
    .graph-canvas-container {
        height: 300px;
        padding: 10px;
    }
    
    .graph-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .time-control {
        justify-content: space-between;
    }
    
    .time-control .number-input {
        width: 70px;
    }
    
    .graph-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px;
    }
    
    .legend-item {
        width: 100%;
    }
    
    /* Фикс для спойлеров */
    .spoiler-section {
        margin-bottom: 10px;
    }
    
    .spoiler-toggle-btn {
        padding: 12px 15px;
        font-size: 15px;
    }
    
    .spoiler-content.active {
        max-height: none !important;
        overflow: visible;
    }
    
    /* Фикс для матриц */
    .time-matrices-wrapper {
        height: auto !important;
        max-height: none !important;
        min-height: auto !important;
    }
    
    .time-matrices-container {
        height: auto !important;
        padding: 10px;
    }
    
    .three-matrices {
        display: flex;
        flex-direction: column;
        gap: 15px;
        height: auto;
    }
    
    .time-matrix {
        height: auto;
        min-height: 200px;
    }
    
    .matrix-date-row {
        flex-wrap: wrap;
    }
    
    .matrix-date-input {
        max-width: 120px;
    }
    
    /* Отступ перед футером */
    .main-footer {
        margin-top: 40px !important;
        position: relative;
        z-index: 10;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .pyramid-container {
        height: 350px !important;
    }
    
    .interpretations-container {
        min-height: 180px;
        padding: 15px;
    }
    
    .interpretations-placeholder {
        font-size: 14px;
    }
    
    .interpretations-placeholder i {
        font-size: 36px !important;
    }
    
    .bg-toggle-btn {
        width: 32px;
        height: 32px;
    }
    
    #toggleBackgroundBtn {
        right: 5px !important;
    }
    
    #toggleDisplayBtn {
        right: 45px !important;
    }
    
    .graph-canvas-container {
        height: 250px;
    }
    
    .number-input {
        width: 50px;
        padding: 6px 8px;
    }
    
    .number-btn {
        width: 32px;
        height: 32px;
    }
    
    .spoiler-toggle-btn {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .matrix-cell {
        font-size: 11px;
        padding: 4px;
    }
}

/* Фикс для Canvas чтобы не ломался */
canvas {
    max-width: 100%;
    height: auto !important;
}

/* Убираем лишние ограничения высоты */
.large-container-wrapper,
.time-matrices-wrapper,
.graph-container-wrapper {
    max-height: none !important;
}

/* ============ ПОДКЛЮЧЕНИЕ ШРИФТА POPPINS ДЛЯ КАЛЬКУЛЯТОРА ============ */
body {
    font-family: 'Poppins', 'Arial', sans-serif !important;
}

.matrix-title,
.matrix-subtitle,
.table-cell,
.value-cell,
.matrix-cell,
.graph-title,
.legend-text,
.graph-info,
.period-analysis,
.spoiler-toggle-btn,
.period-analysis-toggle,
.burger-info-btn,
.burger-lang-btn,
.table-cell,
.value-cell,
.matrix-cell
.burger-period-btn {
    font-family: 'Poppins', sans-serif;
}

/* Для заголовков оставляем тонкое начертание */
.matrix-title,
.matrix-subtitle,
.graph-title,
h1, h2, h3 {
    font-weight: 300;
}

/* Для жирных элементов */
.btn-matrix,
.spoiler-toggle-btn,
.period-analysis-toggle,
.burger-info-btn,
.burger-lang-btn,
.burger-period-btn {
    font-weight: 500;
}