/* Graph Viewer Styles */
.graphs-section {
    padding: 2rem 0 4rem;
    background: var(--white);
}

.graph-container {
    margin-top: 2rem;
}

.graph-viewer {
    background-color: #fff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    height: 80vh;
    min-height: 600px;
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

/* Mobile responsive graph viewer */
@media (max-width: 768px) {
    .graphs-section {
        padding: 2rem 0;
    }
    
    .graphs-section .container {
        padding: 0 1rem;
        width: 100vw;
        max-width: none;
    }
    
    .graphs-section h2 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .graphs-section p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .graph-container {
        margin: 0;
        padding: 0;
    }
    
    .graph-viewer {
        height: 50vh;
        min-height: 300px;
        max-height: 400px;
        border-radius: 8px;
        margin: 0;
        width: 100%;
        position: relative;
        overflow: hidden;
    }
    
    /* Scale iframe content for mobile viewing */
    .graph-iframe {
        width: 250% !important;
        height: 250% !important;
        transform: scale(0.4);
        transform-origin: 0 0;
        border: none;
        position: absolute;
        top: 0;
        left: 0;
    }
    
    /* Mobile graph controls */
    .graph-selection-controls {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .graph-categories {
        gap: 0.5rem;
        justify-content: center;
    }
    
    .category-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-width: 60px;
        text-align: center;
    }
    
    .graph-search input {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 6px;
    }
    
    .graph-placeholder {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .graph-placeholder ul {
        font-size: 0.7rem;
        text-align: left;
        max-width: 280px;
    }
    
    .graph-placeholder li {
        margin-bottom: 0.5rem;
    }
}

.graph-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex: 1;
    color: #6c757d;
    font-size: 1.1rem;
    text-align: center;
}

.graph-placeholder p {
    margin: 0.5rem 0;
}

/* Graph iframe container */
.graph-iframe {
    width: 100%;
    height: 100%;
    flex: 1;
    border: none;
    display: block;
}

/* Graph selection and filtering controls */
.graph-selection-controls {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;

    margin-bottom: 1rem;
}

.graph-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.category-btn:hover {
    background-color: #e9ecef;
}

.category-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.graph-search {
    margin-bottom: 1rem;
}

.graph-search input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 1rem;
}

.graph-search input:focus {
    outline: none;
    border-color: #007bff;

}

.graph-quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Graph list modal */
.graph-list-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.graph-list-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;

}

.graph-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.graph-list-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background-color: #dee2e6;
}

.graph-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.graph-list-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fff;
}

.graph-list-item:hover {
    border-color: #007bff;
    background-color: #f8f9fa;
    transform: translateY(-1px);

}

.graph-list-icon {
    font-size: 2rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.graph-list-info {
    flex-grow: 1;
}

.graph-list-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.graph-list-desc {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.graph-list-file {
    font-size: 0.8rem;
    color: #999;
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    display: inline-block;
}

/* Animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Graph controls */
.graph-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1rem;
    background-color: #fff;
    border-radius: 8px;

}

.graph-controls .btn {
    padding: 0.75rem 1.5rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.graph-controls .btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

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

/* Graph loading state */
.graph-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 500px;
    background-color: #f8f9fa;
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #002FA7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.graph-loading h3 {
    color: #007bff;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.graph-loading p {
    color: #6c757d;
    margin-bottom: 1.5rem;
    max-width: 400px;
    line-height: 1.5;
}

.loading-progress {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #17a2b8);
    width: 0%;
    transition: width 2s ease;
    border-radius: 4px;
}

.graph-loading::after {
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Graph error state */
.graph-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 500px;
    background-color: #fff5f5;
    color: #dc3545;
    text-align: center;
    padding: 2rem;
}

.graph-error h3 {
    margin: 0 0 1rem 0;
    color: #dc3545;
    font-size: 1.5rem;
}

.graph-error p {
    margin: 0 0 1rem 0;
    color: #666;
    line-height: 1.5;
    max-width: 400px;
}

.error-details {
    font-size: 0.9rem;
    color: #888;
    font-style: italic;
}

.error-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.error-actions .btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.error-actions .btn:not(.secondary) {
    background-color: #007bff;
    color: white;
}

.error-actions .btn.secondary {
    background-color: #6c757d;
    color: white;
}

.error-actions .btn:hover {
    transform: translateY(-1px);

}

/* Graph metadata */
.graph-metadata {
    background-color: #fff;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;

}

.graph-metadata h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

.graph-metadata p {
    margin: 0.5rem 0;
    color: #6c757d;
}

/* Interactive features */
.graph-tools {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.graph-viewer:hover .graph-tools {
    opacity: 1;
}

.graph-tool {
    background: none;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: #666;
    transition: all 0.2s ease;
}

.graph-tool:hover {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* Fullscreen mode */
.graph-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: #fff;
}

.graph-fullscreen .graph-iframe {
    height: 100vh;
}

.fullscreen-exit {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    z-index: 10000;
}

/* Responsive design */
@media (max-width: 768px) {
    .graph-viewer {
        min-height: 400px;
    }
    
    .graph-placeholder {
        height: 400px;
    }
    
    .graph-iframe {
        height: 400px;
    }
    
    .graph-controls {
        gap: 0.5rem;
    }
    
    .graph-controls .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .graph-categories {
        gap: 0.25rem;
    }
    
    .category-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .graph-list-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .graph-list-content {
        width: 95%;
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .graphs-section {
        padding: 2rem 0;
    }
    
    .graph-viewer {
        min-height: 300px;
    }
    
    .graph-placeholder {
        height: 300px;
        font-size: 1rem;
    }
    
    .graph-iframe {
        height: 300px;
    }
    
    .graph-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .graph-controls .btn {
        width: 100%;
    }
}
