/* FoldSeek Structure Drawer Styles */

.foldseek-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 800px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1050;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.foldseek-drawer.open {
    transform: translateX(0);
}

.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1049;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.drawer-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.drawer-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.drawer-header h5 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.drawer-header .btn-close-drawer {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.5rem;
    line-height: 1;
}

.drawer-header .btn-close-drawer:hover {
    background: rgba(255, 255, 255, 0.3);
}

.drawer-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.viewer-section {
    margin-bottom: 2rem;
}

.viewer-section h6 {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #495057;
    display: flex;
    align-items: center;
}

.viewer-section h6 .badge {
    margin-left: 0.5rem;
}

#query-viewer-container,
#overlay-viewer-container {
    width: 100%;
    height: 350px;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

#alignment-details-container {
    margin-top: 2rem;
}

.alignment-viewer {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
}

.alignment-viewer pre {
    white-space: pre;
    margin: 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .foldseek-drawer {
        max-width: 100%;
    }
    
    #query-viewer-container,
    #overlay-viewer-container {
        height: 250px;
    }
    
    .drawer-body {
        padding: 1rem;
    }
}

/* Smooth scrolling within drawer */
.drawer-body {
    scroll-behavior: smooth;
}

/* Better spacing for cards inside drawer */
.drawer-body .card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #dee2e6;
}

.drawer-body .card-header {
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}

/* Viewer loading state */
.viewer-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
}

/* Badge styling for metrics */
.metric-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

/* Color legend styling */
.color-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 0.25rem;
    margin-top: 1rem;
}

.color-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-legend-box {
    width: 20px;
    height: 20px;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
}

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

.viewer-section {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar styling for drawer */
.drawer-body::-webkit-scrollbar {
    width: 8px;
}

.drawer-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.drawer-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.drawer-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Button styling within drawer */
.drawer-body .btn {
    transition: all 0.2s ease;
}

.drawer-body .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Tooltip-like hover for alignment residues */
.alignment-viewer pre {
    cursor: default;
    user-select: all;
}

/* Instructions alert styling */
.drawer-body .alert {
    border-left: 4px solid;
}

.drawer-body .alert-info {
    border-left-color: #0dcaf0;
    background: #cff4fc;
}

.drawer-body .alert-info h6 {
    color: #055160;
}

/* Ensure 3Dmol viewers fit properly */
#query-viewer-container > div,
#overlay-viewer-container > div {
    width: 100% !important;
    height: 100% !important;
}
