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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    gap: 15px;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 32px;
    font-weight: 600;
    text-align: center;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 15px;
}

.filter-section {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.dropdown {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 14px;
    min-width: 180px;
    cursor: pointer;
    transition: all 0.3s;
}

.dropdown:hover:not(:disabled) {
    border-color: #5568d3;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.dropdown:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.dropdown-input {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 14px;
    min-width: 200px;
    transition: all 0.3s;
}

.dropdown-input:hover:not(:disabled) {
    border-color: #5568d3;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.dropdown-input:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dropdown-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.upload-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-upload {
    background: #667eea;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-upload:hover {
    background: #5568d3;
}

.btn-upload input[type="file"] {
    display: none;
}

#fileName {
    color: #666;
    font-size: 14px;
}

.button-group {
    display: flex;
    gap: 10px;
}

.btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn:hover {
    background: #667eea;
    color: white;
}

#cy {
    flex: 1;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

.graph-wrapper {
    position: relative;
    flex: 1;
    min-height: 800px;
}

.graph-wrapper #cy {
    width: 100%;
    height: 100%;
}

.details-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: white;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    transform: translateX(105%);
    transition: transform 0.25s ease;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.details-panel.is-open {
    transform: translateX(0);
}

.details-panel__header {
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: start;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #f8f8ff;
}

.details-panel__header::before {
    content: '';
    width: 34px;
    height: 34px;
}

.details-panel__title {
    text-align: center;
    grid-column: 2;
    justify-self: center;
    align-self: center;
}

.details-panel__title h2 {
    font-size: 16px;
    color: #333;
    margin: 0;
}

.details-panel__subtitle {
    margin-top: 6px;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.details-panel__close {
    grid-column: 3;
    justify-self: end;
    align-self: start;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    line-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.details-panel__close:hover {
    background: #667eea;
    color: white;
}

.details-panel__body {
    padding: 16px;
    overflow: auto;
    flex: 1;
}

.details-panel__empty {
    color: #555;
    line-height: 1.6;
}

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

.details-table th,
.details-table td {
    text-align: left;
    vertical-align: top;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.details-table th {
    width: 40%;
    color: #333;
    font-weight: 600;
    font-size: 13px;
}

.details-table td {
    color: #555;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.graph-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    color: #333;
}

.graph-placeholder h2 {
    font-size: 18px;
    color: #667eea;
}

.graph-placeholder p {
    max-width: 720px;
    line-height: 1.6;
    color: #555;
}

.graph-placeholder-small {
    font-size: 13px;
    color: #666;
}

.info-panel {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.info-panel--primary h3 {
    margin-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-top: 12px;
}

.info-text {
    color: #555;
    line-height: 1.6;
}

.info-panel h4 {
    margin: 12px 0 8px;
    color: #333;
    font-size: 14px;
}

.info-panel--primary .subtitle {
    text-align: center;
}

.info-panel a {
    color: #667eea;
    text-decoration: none;
}

.info-panel a:hover {
    text-decoration: underline;
}

.info-panel h3 {
    margin-bottom: 12px;
    color: #667eea;
    font-size: 24px;
}

.info-panel ul {
    list-style: none;
    padding-left: 0;
}

.info-panel li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    color: #555;
    line-height: 1.6;
}

.info-panel li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.info-panel strong {
    color: #333;
    font-weight: 600;
}

.btn-get-started {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 28px;
    margin-left: auto;
    margin-right: auto;
    text-decoration: none;
    width: fit-content;
}

.help-sections {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-section {
    padding: 14px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #f8f8ff;
}

.help-section h5 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}

.help__figure {
    margin: 10px 0;
}

.help__image {
    width: 65%;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Responsive */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Helper GIF styles */
.gif-container {
    position: relative;
    display: block;
    width: 65%;
    cursor: pointer;
}

.clickable-gif {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    transition: background-color 0.2s;
}

.play-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.play-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 20px solid white;
}

.gif-container.playing .play-button {
    display: none;
}
