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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 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;
    line-height: 1.6;
}

main {
    padding: 30px;
}

.visualization-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .visualization-layout {
        grid-template-columns: 1fr;
    }
}

.chart-display {
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.chart-display h3 {
    color: #1a1a2e;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.chart-display canvas {
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.structure-legend,
.distribution-info,
.stepwise-info,
.competitive-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #333;
}

.metal-icon {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #c0392b);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ligand-icon {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 30% 30%, #74b9ff, #0984e3);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.bond-icon {
    width: 30px;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #74b9ff);
    border-radius: 2px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: #555;
    font-weight: 500;
}

.controls-panel {
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    color: #1a1a2e;
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 600;
}

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

.control-group {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

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

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95em;
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #0f3460, #16213e);
    outline: none;
    margin-bottom: 5px;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff6b6b, #c0392b);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff6b6b, #c0392b);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.control-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 0.95em;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.control-group select:focus {
    outline: none;
    border-color: #0f3460;
}

.slider-hint {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 15px;
    font-style: italic;
}

.preset-btn,
.anim-btn {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #0f3460, #16213e);
    color: white;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover,
.anim-btn:hover {
    background: linear-gradient(145deg, #16213e, #1a1a2e);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 52, 96, 0.3);
}

.preset-btn:active,
.anim-btn:active {
    transform: translateY(0);
}

.formulas-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.formulas-section h3 {
    color: #1a1a2e;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
}

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

.formula-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border-left: 4px solid #0f3460;
}

.formula-label {
    font-weight: 600;
    color: #16213e;
    min-width: 150px;
    font-size: 0.9em;
}

.formula {
    color: #333;
    font-family: 'Times New Roman', serif;
    font-size: 1.05em;
}

.explanation {
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 16px;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.explanation h2 {
    color: #1a1a2e;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 700;
}

.explanation h3 {
    color: #16213e;
    margin-top: 25px;
    margin-bottom: 12px;
    font-size: 1.3em;
    font-weight: 600;
}

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

.explanation strong {
    color: #1a1a2e;
}

/* Animation effects */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes ligandApproach {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

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

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

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

    .formula-item {
        flex-direction: column;
    }

    .formula-label {
        min-width: auto;
    }
}
