/* Molecule Builder - Shared Styles */

/* Center-align page content and set default font */
body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 20px;
}

/* Style the drawing canvas with border and centered display */
#canvas {
    border: 1px solid black;
    display: block;
    margin: 0 auto;
    cursor: pointer;
}

/* Spacing for the control buttons section */
.controls {
    margin: 20px 0;
}

/* Style individual control buttons */
.controls button {
    margin: 0 5px;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
}

/* Highlight active button with green background */
.controls button.active {
    background-color: #4CAF50;
    color: white;
}

/* Spacing for the atom selector dropdown */
.atom-selector {
    margin: 20px 0;
}

/* Style for validation result message */
#resultMessage {
    margin-top: 20px;
    font-size: 18px;
    transition: all 0.3s ease;
}

/* Success animation */
#resultMessage.success {
    font-size: 28px;
    font-weight: bold;
    color: #4CAF50;
    animation: celebrate 0.6s ease-in-out;
    text-shadow: 2px 2px 4px rgba(76, 175, 80, 0.3);
}

@keyframes celebrate {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Confetti-like celebration effect */
#resultMessage.success::before {
    content: "🎉 ";
    font-size: 32px;
    animation: spin 0.8s ease-in-out;
    display: inline-block;
}

#resultMessage.success::after {
    content: " 🎉";
    font-size: 32px;
    animation: spin 0.8s ease-in-out;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg) scale(0);
    }

    50% {
        transform: rotate(180deg) scale(1.2);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Error message styling */
#resultMessage.error {
    color: #f44336;
    font-size: 18px;
}

/* Status message to guide user */
#statusMessage {
    margin: 15px 0;
    padding: 10px;
    font-size: 16px;
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
    display: inline-block;
    border-radius: 4px;
}

/* Help button styling */
#helpButton {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    margin: 0 5px;
}

#helpButton:hover {
    background-color: #0b7dda;
}

/* Modal overlay - covers entire screen with semi-transparent background */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

/* Modal content box */
.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 10px;
    width: 80%;
    max-width: 700px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    text-align: left;
}

/* Close button (X) in modal */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    background: none;
    border: none;
}

.close:hover,
.close:focus {
    color: #000;
}

/* Modal heading */
.modal-content h3 {
    color: #2196F3;
    margin-top: 0;
}

/* Instructions list styling */
.modal-content ol {
    line-height: 1.8;
}

.modal-content li {
    margin-bottom: 10px;
}

.modal-content strong {
    color: #4CAF50;
}

.modal-content .tip {
    background-color: #fffbcc;
    padding: 10px;
    border-left: 4px solid #ffeb3b;
    margin: 15px 0;
}

.modal-content .example {
    background-color: #e3f2fd;
    padding: 10px;
    border-left: 4px solid #2196F3;
    margin: 15px 0;
}

/* Keyboard shortcuts panel */
#keyboardShortcuts {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(33, 33, 33, 0.95);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 14px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
}

#keyboardShortcuts.visible {
    display: block;
}

#keyboardShortcuts h4 {
    margin: 0 0 10px 0;
    color: #4CAF50;
    font-size: 16px;
}

#keyboardShortcuts .shortcut-row {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 13px;
}

#keyboardShortcuts .key {
    background-color: #555;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: monospace;
    font-weight: bold;
}

/* Focus indicator for keyboard navigation */
button:focus,
select:focus,
canvas:focus {
    outline: 3px solid #4CAF50;
    outline-offset: 2px;
}

/* Visual feedback when canvas is focused */
#canvas.focused {
    box-shadow: 0 0 0 3px #4CAF50;
}

/* Screen reader only content - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}