/* Molecular Polarity 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;
}

.molecular-polarity-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;
}

/* Molecule Selector */
.molecule-selector {
    margin-bottom: 30px;
}

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

.molecule-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

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

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

/* Canvas Layout */
.canvas-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    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);
}

#moleculeCanvas {
    width: 100%;
    height: 500px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 10px;
    cursor: grab;
}

#moleculeCanvas:active {
    cursor: grabbing;
}

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

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

.polarity-status {
    text-align: center;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.polarity-status.polar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    animation: pulse 2s infinite;
}

.polarity-status.nonpolar {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.dipole-moment {
    text-align: center;
    font-size: 1.3em;
    color: #333;
    font-weight: 600;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-item span:first-child {
    color: #667eea;
    font-weight: 600;
    margin-right: 8px;
}

.stat-item span:last-child {
    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;
}

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

.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: flex;
    flex-direction: column;
    gap: 10px;
}

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

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

.legend-color.positive {
    background: #ff6b6b;
}

.legend-color.negative {
    background: #4ecdc4;
}

.legend-color.vector {
    background: linear-gradient(90deg, #ffd93d 0%, #ff6b6b 100%);
}

/* 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;
    }

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

    .stats-panel {
        grid-template-columns: 1fr;
    }

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

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