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

:root {
    --primary-color: #6C63FF;
    --secondary-color: #4A47A3;
    --accent-color: #FF6B6B;
    --success-color: #4ECDC4;
    --warning-color: #FFE66D;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #2D3748;
    --text-secondary: #718096;
    --border-color: #E2E8F0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.bonds-container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    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: 300;
}

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

main {
    padding: 30px;
}

/* Bond Selector */
.bond-selector {
    margin-bottom: 30px;
}

.bond-selector h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
}

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

.bond-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-color);
    border: 3px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.bond-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.bond-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
}

.btn-icon {
    font-size: 2em;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
}

.btn-content {
    flex: 1;
}

.btn-title {
    display: block;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.btn-subtitle {
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* Animation Section */
.animation-section {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.animation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.animation-header h3 {
    color: var(--primary-color);
    font-size: 1.4em;
}

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

.bond-energy span:first-child {
    color: var(--text-secondary);
}

.bond-energy span:nth-child(2) {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 1.2em;
}

#bondCanvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    background: white;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    display: block;
}

.animation-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.control-btn .icon {
    font-size: 1.2em;
}

/* Bond Info Section */
.bond-info-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-card {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.info-card h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.info-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid var(--success-color);
    line-height: 1.5;
}

.atom-config {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    border-left: 3px solid var(--accent-color);
}

/* Comparison Table */
.comparison-section {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.comparison-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.comparison-table {
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.comparison-table tr:hover {
    background: var(--bg-color);
}

.comparison-table td.highlight-ionic {
    background: #FFF5F5;
    border-left: 3px solid #FF6B6B;
}

.comparison-table td.highlight-covalent {
    background: #F0FFFE;
    border-left: 3px solid #4ECDC4;
}

.comparison-table td.highlight-metallic {
    background: #F0FFF4;
    border-left: 3px solid #95E1D3;
}

/* Energy Diagram */
.energy-diagram-section {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.energy-diagram-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
}

#energyCanvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    display: block;
}

.energy-legend {
    display: flex;
    justify-content: center;
    gap: 30px;
}

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

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

/* Educational Section */
.education-section {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.education-section h2 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 1.8em;
}

.bond-type-detail {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.bond-type-detail h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.4em;
}

.bond-type-detail p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 15px;
}

.key-points {
    margin-top: 15px;
}

.key-points h4 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.key-points ul {
    list-style: none;
    padding: 0;
}

.key-points li {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-color);
    border-radius: 6px;
    border-left: 3px solid var(--success-color);
}

/* Applications Section */
.applications-section {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.applications-section h2 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 1.8em;
}

.applications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.application-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-top: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.application-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.application-card.ionic {
    border-top-color: #FF6B6B;
}

.application-card.covalent {
    border-top-color: #4ECDC4;
}

.application-card.metallic {
    border-top-color: #95E1D3;
}

.application-card h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.2em;
}

.application-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

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

    .bond-info-section {
        grid-template-columns: 1fr;
    }
}

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

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

    main {
        padding: 15px;
    }

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

    .comparison-table {
        font-size: 0.9em;
    }

    .animation-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}
