/* Kondratieff Wave Visualization Styles */
.kondratieff-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Header Styles */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    margin: 0;
}

/* Section Styles */
section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

section h2 {
    color: #667eea;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* Formula Section */
.formula-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 10px;
    margin: 20px 0;
}

.formula-display {
    background: white;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Times New Roman', serif;
    font-size: 1.3em;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.formula-explanation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.explanation-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.explanation-item strong {
    color: #667eea;
    display: block;
    margin-bottom: 5px;
}

.hp-filter-note {
    background: rgba(102, 126, 234, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.hp-filter-note h4 {
    color: #667eea;
    margin: 0 0 8px 0;
}

.hp-filter-note p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.6;
}

/* Wave Section */
.wave-section {
    overflow: hidden;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.control-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    font-weight: 600;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.slider-control,
.toggle-control,
.comparison-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-control label,
.toggle-control label {
    font-weight: 600;
    color: #333;
}

#timeSlider {
    width: 200px;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

#timeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

#timeSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

#yearDisplay {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

#indicatorSelect {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-size: 0.95em;
}

.comparison-toggle label {
    cursor: pointer;
    user-select: none;
}

.comparison-toggle input[type="checkbox"] {
    margin-right: 5px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.canvas-container {
    position: relative;
    margin: 20px 0;
    border: 2px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    background: white;
}

#waveCanvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 300px;
    z-index: 1000;
    line-height: 1.5;
}

.tooltip.visible {
    opacity: 1;
}

.phase-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

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

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.legend-item.prosperity .legend-color {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.legend-item.recession .legend-color {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.legend-item.depression .legend-color {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.legend-item.recovery .legend-color {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* History Section */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

.waves-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.waves-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.waves-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.waves-table tbody tr {
    transition: all 0.3s;
    cursor: pointer;
}

.waves-table tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.waves-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

/* Current Analysis Section */
.current-analysis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.analysis-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.analysis-card h3 {
    color: #667eea;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.phase-indicator {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 1.1em;
    margin: 15px 0;
    text-align: center;
}

.phase-indicator.depression {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.phase-indicator.prosperity {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.phase-indicator.recession {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.phase-indicator.recovery {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.phase-period {
    font-size: 1.1em;
    color: #555;
    font-weight: 600;
    margin-bottom: 15px;
}

.phase-characteristics h4 {
    color: #667eea;
    margin: 15px 0 10px 0;
}

.phase-characteristics ul {
    list-style: none;
    padding: 0;
}

.phase-characteristics li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
    line-height: 1.6;
}

.phase-characteristics li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
    font-size: 1.2em;
}

.projection-timeline {
    position: relative;
    padding-left: 30px;
}

.projection-timeline:before {
    content: "";
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

.timeline-item {
    position: relative;
    margin-bottom: 25px;
}

.timeline-marker {
    position: absolute;
    left: -25px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #667eea;
    border: 3px solid white;
    box-shadow: 0 0 0 3px #667eea;
}

.timeline-marker.bottom {
    background: #f45c43;
    box-shadow: 0 0 0 3px #f45c43;
}

.timeline-marker.next {
    background: #38ef7d;
    box-shadow: 0 0 0 3px #38ef7d;
}

.timeline-content h4 {
    color: #667eea;
    margin: 0 0 5px 0;
    font-size: 1.1em;
}

.timeline-content p {
    font-weight: 600;
    color: #333;
    margin: 5px 0;
}

.timeline-content span {
    color: #666;
    font-size: 0.95em;
    line-height: 1.5;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.close:hover {
    color: #667eea;
}

#modalTitle {
    color: #667eea;
    margin-bottom: 20px;
}

#modalBody {
    line-height: 1.8;
    color: #555;
}

#modalBody ul {
    list-style: none;
    padding: 0;
}

#modalBody li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

#modalBody li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .kondratieff-container {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    section {
        padding: 20px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .slider-control,
    .toggle-control {
        flex-direction: column;
        align-items: stretch;
    }

    #timeSlider {
        width: 100%;
    }

    .formula-explanation {
        grid-template-columns: 1fr;
    }

    .current-analysis {
        grid-template-columns: 1fr;
    }

    .phase-legend {
        flex-direction: column;
        align-items: flex-start;
    }

    .waves-table {
        font-size: 0.9em;
    }

    .waves-table th,
    .waves-table td {
        padding: 8px;
    }
}

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

section {
    animation: fadeIn 0.5s ease-out;
}
