/* DNA Double Helix Visualization Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.dna-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

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

main {
    padding: 30px;
}

/* Visualization Sections */
.visualization-section,
.melting-section,
.sequence-section {
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
}

.panel-header h3 {
    font-size: 1.3em;
    font-weight: 600;
}

.panel-header p {
    font-size: 0.9em;
    opacity: 0.9;
    margin-top: 5px;
}

#threeCanvas {
    display: block;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    width: 100%;
    min-height: 500px;
    cursor: grab;
}

#threeCanvas:active {
    cursor: grabbing;
}

/* Structure Info */
.structure-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: white;
    justify-content: center;
}

.info-item {
    font-size: 0.95em;
    color: #333;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.info-item span:first-child {
    font-weight: 600;
    color: #667eea;
}

/* Legend Panel */
.legend-panel {
    background: white;
    padding: 20px;
}

.legend-panel h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

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

.legend-color.backbone { background: #9C27B0; }
.legend-color.adenine { background: #4CAF50; }
.legend-color.thymine { background: #FF5722; }
.legend-color.guanine { background: #2196F3; }
.legend-color.cytosine { background: #FFC107; }
.legend-color.hydrogen-bond-2 { background: #FFFFFF; border: 2px solid #333; }
.legend-color.hydrogen-bond-3 { background: #FFFF00; border: 2px solid #333; }

/* Melting Section */
.melting-info {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: white;
    justify-content: center;
}

#meltingCanvas {
    display: block;
    background: white;
    width: 100%;
}

/* Sequence Section */
.sequence-display {
    padding: 20px;
    background: white;
}

.strand-header {
    margin-bottom: 10px;
}

.strand-label {
    font-weight: 600;
    color: #667eea;
    font-size: 1em;
}

.strand-sequence {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    line-height: 2;
    letter-spacing: 2px;
    word-break: break-all;
}

.base {
    display: inline-block;
    padding: 2px 4px;
    margin: 0 2px;
    border-radius: 3px;
    font-weight: 600;
}

.base-a { color: #4CAF50; }
.base-t { color: #FF5722; }
.base-g { color: #2196F3; }
.base-c { color: #FFC107; }

.spacer {
    color: #999;
    font-size: 0.9em;
    margin: 0 5px;
}

/* Controls Panel */
.controls-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.control-group {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-group h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.control-group label {
    display: block;
    margin-bottom: 12px;
    color: #333;
    font-size: 0.95em;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e7ff;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 5px;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.control-button {
    width: 100%;
    padding: 12px 15px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    margin-bottom: 10px;
}

.control-button.melt {
    background: #ef4444;
}

.control-button.melt:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.control-button.reanneal {
    background: #22c55e;
}

.control-button.reanneal:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
}

.preset-btn {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 6px;
    background: white;
    color: #667eea;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 8px;
    margin-bottom: 8px;
}

.preset-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Formulas Section */
.formulas-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.formulas-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.formula-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.formula-label {
    font-weight: 600;
    color: #667eea;
    min-width: 150px;
    font-size: 0.95em;
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
    color: #333;
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
}

/* Explanation Section */
.explanation {
    background: #f8f9fa;
    padding: 30px;
    margin-top: 20px;
    border-radius: 10px 10px 0 0;
}

.explanation h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.explanation h3 {
    color: #764ba2;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.4em;
}

.explanation p {
    color: #333;
    line-height: 1.8;
    margin-bottom: 15px;
    font-size: 1.05em;
}

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

.explanation li {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    color: #333;
    line-height: 1.7;
}

.explanation strong {
    color: #667eea;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .controls-grid {
        grid-template-columns: 1fr;
    }

    .legend-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    main {
        padding: 20px;
    }

    .structure-info,
    .melting-info {
        flex-direction: column;
    }

    .strand-sequence {
        font-size: 1em;
        letter-spacing: 1px;
    }
}

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

.dna-container > * {
    animation: fadeIn 0.6s ease-out;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .dna-container {
        box-shadow: none;
        border-radius: 0;
    }

    .controls-panel {
        display: none;
    }

    #threeCanvas,
    #meltingCanvas {
        page-break-inside: avoid;
    }
}
