/* Hydrogen Bond Formation 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;
    color: #333;
}

.hydrogen-bond-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: 40px;
    text-align: center;
}

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

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

main {
    padding: 40px;
}

/* State Selector */
.state-selector {
    margin-bottom: 30px;
}

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

.state-options {
    display: flex;
    gap: 15px;
}

.state-btn {
    padding: 12px 30px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.state-btn:hover {
    background: #f0f0ff;
    transform: translateY(-2px);
}

.state-btn.active {
    background: #667eea;
    color: white;
}

/* Canvas Layout */
.canvas-wrapper {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    margin-bottom: 30px;
}

.canvas-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#hydrogenCanvas {
    width: 100%;
    height: 550px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 10px;
    cursor: grab;
}

#hydrogenCanvas:active {
    cursor: grabbing;
}

/* Bond Info Panel */
.bond-info-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.bond-info-panel h4 {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #667eea;
}

.bond-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

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

.stat-row span:last-child {
    color: #333;
    font-weight: 700;
    font-size: 1.1em;
}

/* Molecule Details Panel */
.molecule-details {
    margin-bottom: 30px;
}

.molecule-details h3 {
    font-size: 1.3em;
    margin-bottom: 20px;
    color: #667eea;
}

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

.detail-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

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

.detail-value {
    color: #333;
    font-weight: 700;
    font-size: 1.1em;
}

/* Controls Panel */
.controls-panel {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

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

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

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

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.control-button {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-button.reset {
    background: #f5576c;
    color: white;
}

.control-button.reset:hover {
    background: #f3455c;
    transform: translateY(-2px);
}

.control-button.toggle {
    background: #4facfe;
    color: white;
}

.control-button.toggle:hover {
    background: #3a9bd9;
    transform: translateY(-2px);
}

.control-button.toggle.active {
    background: #00f2fe;
}

/* Toggle Options */
.toggle-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Formulas Section */
.formulas-section {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

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

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

.formula-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.formula-label {
    font-weight: 600;
    color: #333;
    min-width: 200px;
}

.formula {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.95em;
    color: #667eea;
}

/* Legend Section */
.legend-section {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.legend-section h4 {
    color: #667eea;
    margin-bottom: 15px;
}

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

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

.legend-color {
    width: 30px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.oxygen {
    background: radial-gradient(circle, #ff6b6b 0%, #ee5a5a 100%);
}

.legend-color.hydrogen {
    background: radial-gradient(circle, #ffffff 0%, #e0e0e0 100%);
    border: 1px solid #ccc;
}

.legend-color.covalent {
    height: 4px;
    background: #888;
}

.legend-color.hydrogen-bond {
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        #4ecdc4,
        #4ecdc4 5px,
        transparent 5px,
        transparent 10px
    );
}

/* Educational Content */
.explanation {
    padding: 40px;
    background: #f8f9fa;
    border-radius: 15px;
    margin-top: 30px;
}

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

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

.explanation p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: #555;
}

.explanation ul {
    margin-left: 30px;
    margin-bottom: 15px;
}

.explanation li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #555;
}

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

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

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    main {
        padding: 20px;
    }

    .state-options {
        flex-direction: column;
    }

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

    .button-group {
        flex-direction: column;
    }

    .toggle-options {
        flex-direction: column;
    }

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