/* Base styles for the visualization container */
.visualization-container {
    width: 100%;
    height: 600px;
    position: relative;
    border: 1px solid #ccc;
    overflow: hidden;
    margin-top: 20px;
}

/* Viewer element styles */
#viewer {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Mol* specific overrides */
.msp-layout-standard {
    position: relative !important;
    height: 100% !important;
}

.msp-viewport-expanded {
    position: relative !important;
}

/* Tab navigation styles */
.tab-buttons {
    display: flex;
    margin-bottom: 10px;
}

.tab-button {
    padding: 8px 16px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 4px 4px 0 0;
}

.tab-button.active {
    background-color: #fff;
    border-bottom: 1px solid white;
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: block;
}

/* Controls layout and styling */
.controls-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
}

.control-group {
    margin-right: 20px;
    display: flex;
    align-items: center;
}

.control-group label {
    margin-right: 5px;
    font-weight: bold;
}

.control-group input {
    width: 80px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Form element styles */
select {
    margin: 0;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

/* Graph plot specific sizing */
#graph-plot {
    width: 80%;
    max-width: 1000px;
    height: 600px;
    margin: 0 auto; /* centra horizontalmente */
    display: block;
    padding-bottom: 30px; /* separación del texto de abajo */
}


/* Graph properties section */
.graph-properties {
    margin-top: 20px;
}

.properties-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.properties-table th, 
.properties-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.properties-table th {
    background-color: #f2f2f2;
}

.properties-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.graph-properties {
    margin-top: 40px;
    padding: 0 20px;
    width: 80%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    min-height: 200px;
}

/* Toggle switch styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 80px;
    height: 34px;
    margin-left: 10px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(46px);
}

.slider-text {
    font-size: 10px;
    font-weight: bold;
    color: white;
    z-index: 1;
}

input:checked + .slider .slider-text:before {
    content: attr(data-on);
}

input:not(:checked) + .slider .slider-text:before {
    content: attr(data-off);
}

/* Análisis Panel Styles */
.analysis-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.analysis-panel h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.analysis-section {
    margin-bottom: 25px;
    background: white;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.analysis-section h5 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* Basic Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.info-item .label {
    font-weight: 600;
    color: #495057;
}

.info-item .value {
    font-weight: 700;
    color: #007bff;
}

/* Centrality Summary Cards */
.centrality-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.metric-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.metric-card h6 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 0.95em;
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 5px;
}

.metric-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.metric-range {
    font-size: 0.85em;
    color: #6c757d;
}

.metric-mean {
    font-size: 0.9em;
    color: #495057;
    font-weight: 600;
}

.top-residues {
    font-size: 0.9em;
    color: #007bff;
    font-weight: 600;
}

/* Top Residues Grid */
.top-residues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.top-metric-column {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
}

.top-metric-column h6 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 0.9em;
    text-align: center;
    background: #f8f9fa;
    padding: 5px;
    border-radius: 4px;
}

.residue-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.residue-list li {
    padding: 4px 8px;
    margin-bottom: 3px;
    background: #f1f8ff; /* Slightly stronger background */
    border-radius: 3px;
    font-size: 0.95em; /* Larger for readability */
    display: flex;
    justify-content: space-between;
    color: #1a1a1a; /* High contrast */
    font-weight: 700;
}

.residue-list li:nth-child(1) { background: #fff3cd; border-left: 3px solid #ffc107; }
.residue-list li:nth-child(2) { background: #f8d7da; border-left: 3px solid #dc3545; }
.residue-list li:nth-child(3) { background: #d1ecf1; border-left: 3px solid #17a2b8; }

/* Key Residues Summary */
.key-residues {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 10px;
}

.key-residue-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    font-weight: 600;
}

.key-residue-item .metric-name {
    font-size: 0.9em;
}

.key-residue-item .residue-value {
    font-size: 0.95em;
    font-weight: 700;
}

/* Motifs Grid */
.motifs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
}

.motif-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f1f8ff;
    border-radius: 4px;
    border-left: 4px solid #0066cc;
}

.motif-name {
    font-weight: 600;
    color: #495057;
}

/* ==== Added: Motif dipoles grid & cards ==== */
.visualization-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.dipole-visualization-card {
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dipole-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.dipole-card-title {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
}

.dipole-card-subtitle {
    color: #6c757d;
}

.dipole-viewer {
    width: 100%;
    height: 260px; /* clave para que 3Dmol sea visible */
    position: relative;
}

.dipole-legend {
    pointer-events: none;
}

.motif-value {
    font-weight: 700;
    color: #0066cc;
}

/* Responsive Design */
@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .centrality-summary {
        grid-template-columns: 1fr;
    }
    
    .top-residues-grid {
        grid-template-columns: 1fr;
    }
    
    .key-residues {
        grid-template-columns: 1fr;
    }
}

/* Export Controls */
.export-controls {
    text-align: center;
    padding: 15px;
}

/* Export Type Selection */
.export-type-selection {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.export-type-selection label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.export-type-selector {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 1em;
    background: white;
    transition: border-color 0.3s ease;
}

.export-type-selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.export-type-selector option[value="segments_atomicos"] {
    background-color: #e8f4fd;
    font-weight: 600;
}

.export-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.export-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.export-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.export-info {
    margin-top: 8px;
    font-size: 0.9em;
    color: #6c757d;
    font-style: italic;
}
/* Family Export Section */
.family-export-section {
    margin-top: 20px;
    padding: 15px;
    border: 2px dashed #667eea;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.family-export-section h6 {
    margin-bottom: 10px;
    color: #667eea;
    font-weight: 600;
}

.family-selector {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    background: white;
}

.family-export-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    margin-top: 10px;
}

.family-export-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.family-export-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838 0%, #1c9c85 100%);
}

/* Add to viewer.css */

/* py3Dmol viewer specific styles */
#py3dmol-dipole-viewer {
    position: relative;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#py3dmol-container {
    border-radius: 4px;
    overflow: hidden;
}

/* py3Dmol info overlay */
#py3dmol-dipole-viewer .info-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.95);
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
    z-index: 1000;
}

/* Smooth transitions between viewers */
.tab-content {
    transition: opacity 0.3s ease-in-out;
}

.tab-content:not(.active) {
    opacity: 0;
}

.tab-content.active {
    opacity: 1;
}

/* Dual View Layout Styles */
.dual-view-container {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    height: 80vh;
    min-height: 600px;
}

.structure-panel {
    flex: 1;
    min-width: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.graph-panel {
    flex: 1;
    min-width: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h4 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

/* View Controls for Structure Panel */
.view-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.structure-label {
    background: rgba(255,255,255,0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-right: 10px;
}

.graph-analysis-label {
    font-size: 0.9em;
    font-weight: normal;
}

.view-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: rgba(255,255,255,0.3);
}

.view-btn.active {
    background: white;
    color: #667eea;
    font-weight: 600;
}

/* Structure Container */
.structure-container {
    height: calc(100% - 60px);
    position: relative;
    overflow: hidden;
}

.structure-viewer {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.structure-viewer.active {
    display: block;
}

.structure-viewer:not(.active) {
    display: none;
}

/* Viewer Info Overlay */
.viewer-info {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.95);
    padding: 10px;
    border-radius: 6px;
    font-size: 11px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
    z-index: 1000;
}

/* Graph Panel Content */
.graph-controls {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.controls-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.graph-plot-container {
    flex: 1;
    padding: 15px;
    overflow: hidden;
}

#graph-plot {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* Analysis Toggle */
.analysis-toggle {
    text-align: center;
    margin: 20px 0;
}

.analysis-toggle-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.analysis-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.toggle-icon {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.analysis-toggle-btn.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Detailed Analysis Container */
.detailed-analysis-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.detailed-analysis-container.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design for Dual View */
@media (max-width: 1200px) {
    .dual-view-container {
        flex-direction: column;
        height: auto;
    }
    
    .structure-panel,
    .graph-panel {
        height: 500px;
    }
    
    .controls-row {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .dual-view-container {
        gap: 10px;
    }
    
    .structure-panel,
    .graph-panel {
        height: 400px;
    }
    
    .panel-header {
        padding: 10px 15px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .panel-header h4 {
        font-size: 1em;
    }
    
    .view-controls {
        flex-wrap: wrap;
        gap: 3px;
        justify-content: center;
    }
    
    .view-btn {
        padding: 3px 8px;
        font-size: 0.8em;
    }
    
    .controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .control-group {
        margin-right: 0;
    }
}

/* Hide tab-related styles since we're not using them anymore */
.tab-buttons,
.tab-content,

/* Button styles for new functionality */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

/* WT Comparison Section */
.wt-comparison-section {
    margin-top: 25px;
    padding: 20px;
    border: 2px dashed #ff6b6b;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 154, 158, 0.1) 100%);
}

.wt-comparison-section h6 {
    margin-bottom: 12px;
    color: #d63031;
    font-weight: 700;
    font-size: 1.1em;
}

.comparison-description {
    font-size: 0.85em;
    color: #636e72;
    margin-bottom: 15px;
    line-height: 1.4;
}

.comparison-description code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #e17055;
    font-weight: bold;
}

.wt-comparison-btn {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    margin-top: 15px;
    font-weight: 600;
}

.wt-comparison-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.wt-comparison-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #e84393 0%, #d63031 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 67, 147, 0.3);
}

/* Sistema de Feedback Visual para Exportaciones */
.export-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-in-out;
}

.export-modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    color: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.4s ease-out;
}

.modal-icon {
    font-size: 3em;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

.modal-title {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-subtitle {
    font-size: 1em;
    opacity: 0.9;
    margin-bottom: 20px;
}

.modal-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00d2ff 0%, #3a7bd5 100%);
    border-radius: 3px;
    animation: progressAnimation 3s ease-in-out infinite;
}

.modal-details {
    font-size: 0.85em;
    opacity: 0.8;
    line-height: 1.4;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border-left: 4px solid;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

.toast.success {
    border-left-color: #28a745;
}

.toast.info {
    border-left-color: #17a2b8;
}

.toast.warning {
    border-left-color: #ffc107;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.toast-icon {
    font-size: 1.2em;
    margin-right: 10px;
}

.toast.success .toast-icon {
    color: #28a745;
}

.toast.info .toast-icon {
    color: #17a2b8;
}

.toast.warning .toast-icon {
    color: #ffc107;
}

.toast.error .toast-icon {
    color: #dc3545;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95em;
    color: #333;
}

.toast-message {
    font-size: 0.85em;
    color: #666;
    line-height: 1.4;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: #333;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes progressAnimation {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        margin: 20px;
        padding: 20px;
    }
    
    .toast {
        min-width: 280px;
        margin-right: 10px;
    }
    
    .toast-container {
        right: 10px;
        left: 10px;
    }
}

/* Agregar estos estilos al final del archivo */

/* Dipole Status Styles */
.dipole-status {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid;
    min-width: 200px;
    text-align: center;
}

.dipole-status.disabled {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #dee2e6;
}

.dipole-status.calculating {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
    animation: pulse 2s infinite;
}

.dipole-status.ready {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-color: #28a745;
    font-weight: 600;
}

.dipole-status.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Estilos para botón py3Dmol deshabilitado */
.view-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
}

.view-btn:disabled:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    transform: none;
}

/* Agregar al final del archivo */

/* Mejorar el estilo de la información del dipolo */
#dipole-info .control-group > div {
    transition: all 0.3s ease;
}

#dipole-info small {
    line-height: 1.4;
}

/* Estilo para valores numéricos destacados */
#dipole-magnitude,
#dipole-angle-z {
    font-size: 1.1em;
    font-weight: 700;
}

/* Estilo para coordenadas */
#dipole-center,
#dipole-endpoint,
#dipole-direction {
    font-size: 0.9em;
    background: rgba(0,0,0,0.05);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Animación suave para mostrar información */
#dipole-info {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Agregar al final del archivo - Nuevos estilos para dipolo */

/* Contenedor principal del dipolo */
.dipole-info-container {
    margin-top: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #dee2e6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    animation: dipoleSlideIn 0.4s ease-out;
}

/* Header del dipolo */
.dipole-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #007bff;
}

.dipole-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Grid de propiedades del dipolo */
.dipole-properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    align-items: center;
}

/* Cada propiedad individual */
.dipole-property {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.dipole-property:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.2);
}

/* Etiquetas de propiedades */
.property-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.95em;
    min-width: 140px;
    flex-shrink: 0;
}

/* Valores de propiedades */
.property-value {
    font-weight: 700;
    color: #007bff;
    font-size: 1.1em;
    flex-grow: 1;
    text-align: center;
}

/* Unidades */
.property-unit {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.9em;
    flex-shrink: 0;
}

/* Estilos específicos para diferentes tipos de valores */
.direction-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background: rgba(0,123,255,0.1);
    padding: 4px 8px;
    border-radius: 4px;
    color: #0056b3;
}

.coordinates-value {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    background: rgba(108,117,125,0.1);
    padding: 4px 8px;
    border-radius: 4px;
    color: #495057;
}

/* Colores específicos para cada propiedad */
.dipole-property:nth-child(1) {
    border-left-color: #28a745; /* Verde para magnitud */
}

.dipole-property:nth-child(1) .property-value {
    color: #28a745;
}

.dipole-property:nth-child(2) {
    border-left-color: #fd7e14; /* Naranja para ángulo */
}

.dipole-property:nth-child(2) .property-value {
    color: #fd7e14;
}

.dipole-property:nth-child(3) {
    border-left-color: #6f42c1; /* Púrpura para dirección */
}

.dipole-property:nth-child(3) .property-value {
    color: #6f42c1;
}

.dipole-property:nth-child(4) {
    border-left-color: #dc3545; /* Rojo para centro de masa */
}

.dipole-property:nth-child(4) .property-value {
    color: #dc3545;
}

.dipole-property:nth-child(5) {
    border-left-color: #17a2b8; /* Cian para punto final */
}

.dipole-property:nth-child(5) .property-value {
    color: #17a2b8;
}

/* Animación de entrada */
@keyframes dipoleSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive design para el dipolo */
@media (max-width: 1200px) {
    .dipole-properties-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 12px;
    }
    
    .dipole-property {
        padding: 10px 14px;
    }
    
    .property-label {
        min-width: 120px;
        font-size: 0.9em;
    }
}

@media (max-width: 768px) {
    .dipole-properties-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .dipole-property {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }
    
    .property-label {
        min-width: auto;
        margin-bottom: 5px;
    }
    
    .property-value {
        margin-bottom: 3px;
    }
    
    .dipole-header h4 {
        font-size: 1.1em;
    }
}

/* Actualizar la animación de entrada existente */
#dipole-info {
    /* Remover la animación anterior y usar la nueva */
    animation: none;
}

/* Mejorar el contraste en dispositivos móviles */
@media (max-width: 480px) {
    .dipole-info-container {
        margin-top: 10px;
        padding: 15px;
        border-radius: 8px;
    }
    
    .dipole-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    .dipole-property {
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    }
    
    .property-value {
        font-size: 1em;
    }
}

/* Agregar al final del archivo */

/* Estilos para el estado del dipolo simplificado en controles */
#dipole-status-container {
    margin-left: auto; /* Empujar hacia la derecha */
}

#dipole-status-container .dipole-status {
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    border: 1px solid;
    min-width: 150px;
    text-align: center;
}

/* Botones de análisis mejorados */
.analysis-toggle {
    text-align: center;
    margin: 20px 0;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.analysis-toggle-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-width: 250px;
}

.dipole-toggle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.analysis-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.dipole-toggle-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.analysis-toggle-btn.expanded {
    background: linear-gradient(135deg, #218838 0%, #1c9c85 100%);
}

.dipole-toggle-btn.expanded {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.toggle-icon {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.analysis-toggle-btn.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Añadir a app/static/css/viewer.css */
.tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
}

.tooltip-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    font-size: 12px;
    cursor: help;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ===== HEADER PRINCIPAL ===== */
.page-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* ===== ICONOS PERSONALIZADOS ===== */
.icon-molecule::before {
    content: "🧬";
    font-size: 1.8rem;
}

.icon-dna::before {
    content: "🧬";
    font-size: 1rem;
    margin-right: 8px;
}

.icon-arrow-left::before {
    content: "←";
    font-size: 1.1rem;
    font-weight: bold;
}

/* ===== BOTÓN ANÁLISIS DE FAMILIA (igual al de volver) ===== */
.btn-family-analysis {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

.btn-family-analysis:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-family-analysis:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* ===== LAYOUT DEL HEADER ===== */
.row.mb-4 {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px 25px;
    border-radius: 12px;
    border: 2px solid #dee2e6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 25px !important;
}

.row.mb-4 .col-12 {
    align-items: center;
    gap: 20px;
}

/* ===== RESPONSIVE PARA EL HEADER ===== */
@media (max-width: 1200px) {
    .page-title {
        font-size: 2rem;
    }
    
    .btn-family-analysis {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
}

@media (max-width: 900px) {
    .row.mb-4 .col-12 {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .page-title {
        font-size: 1.8rem;
        justify-content: center;
    }
    
    .btn-family-analysis {
        width: auto;
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .row.mb-4 {
        padding: 15px 20px;
        margin-bottom: 20px !important;
    }
    
    .page-title {
        font-size: 1.6rem;
        gap: 8px;
    }
    
    .icon-molecule::before {
        font-size: 1.5rem;
    }
    
    .btn-family-analysis {
        padding: 10px 18px;
        font-size: 0.9rem;
        border-radius: 20px;
    }
    
    .icon-dna::before {
        font-size: 0.9rem;
        margin-right: 6px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.4rem;
        flex-direction: column;
        gap: 5px;
    }
    
    .btn-family-analysis {
        padding: 8px 16px;
        font-size: 0.85rem;
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    .row.mb-4 {
        padding: 12px 15px;
    }
}

/* ===== ANIMACIONES ===== */
@keyframes headerSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.row.mb-4 {
    animation: headerSlideIn 0.5s ease-out;
}

/* ===== EFECTOS VISUALES ADICIONALES ===== */
.btn-family-analysis::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    border-radius: 25px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.btn-family-analysis:hover::before {
    opacity: 1;
}

.btn-family-analysis {
    position: relative;
    overflow: hidden;
}

/* ===== MANTENER COMPATIBILIDAD CON ESTILOS EXISTENTES ===== */
.text-primary {
    color: #2c3e50 !important;
}

/* Actualizar el h1 existente para que use la nueva clase */
h1.text-primary {
    font-size: 2.2rem;
    font-weight: 800;
    color: #2c3e50;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}