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

:root {
    /* Light Mode Colors */
    --light-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --light-text: #333;
    --light-card-bg: white;
    --light-header-bg: rgba(255, 255, 255, 0.1);
    --light-sidebar-bg: white;
    --light-btn-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --light-btn-secondary: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    
    /* Dark Mode Colors */
    --dark-bg: linear-gradient(135deg, #1a1a1a 0%, #2d1b00 100%);
    --dark-text: #e0e0e0;
    --dark-card-bg: #2a2a2a;
    --dark-header-bg: rgba(255, 140, 0, 0.1);
    --dark-sidebar-bg: #252525;
    --dark-btn-primary: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    --dark-btn-secondary: linear-gradient(135deg, #d35400 0%, #e67e22 100%);
    --dark-accent: #ff8c00;
    --dark-accent-light: #ffa500;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    border: none;
    border-radius: 50px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 140, 0, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
}

/* Author Info */
.author-info {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 999;
    font-size: 0.85em;
    line-height: 1.4;
    padding: 12px 15px;
    background: rgba(255, 140, 0, 0.1);
    border-left: 3px solid #ff8c00;
    border-radius: 4px;
}

.author-info p {
    margin: 0;
}

.dark-mode .author-info {
    color: #e0e0e0;
}

.light-mode .author-info {
    color: #333;
    background: rgba(102, 126, 234, 0.1);
    border-left-color: #667eea;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(255, 140, 0, 0.6);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    transition: all 0.3s ease;
}

.dark-mode .theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.dark-mode .theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

.light-mode .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0);
}

.light-mode .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.light-mode .theme-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.light-mode .theme-toggle:hover {
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

/* Dark Mode Styles */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b00 100%);
    color: #e0e0e0;
}

body.dark-mode .container {
    color: #e0e0e0;
}

body.dark-mode header {
    background: rgba(255, 140, 0, 0.1);
    border: 1px solid rgba(255, 140, 0, 0.2);
}

body.dark-mode .sidebar {
    background: #252525;
    border: 1px solid #3a3a3a;
}

body.dark-mode .sidebar h2,
body.dark-mode .sidebar h3 {
    color: #ff8c00;
}

body.dark-mode .molecule-btn {
    background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
}

body.dark-mode .molecule-btn:hover {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    border-color: #ff8c00;
    color: white;
}

body.dark-mode .molecule-btn.active {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    border-color: #ff8c00;
}

body.dark-mode .search-btn {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    border-color: #ff8c00;
}

body.dark-mode .search-btn:hover {
    background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
    box-shadow: 0 6px 25px rgba(255, 140, 0, 0.4);
}

body.dark-mode .viewer-container {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
}

body.dark-mode .info-panel {
    background: linear-gradient(135deg, #2a2a2a 0%, #3a2a1a 100%);
    border: 1px solid #4a4a4a;
}

body.dark-mode .info-panel h3 {
    color: #ff8c00;
}

body.dark-mode .info-panel p {
    color: #c0c0c0;
}

body.dark-mode #moleculeFormula {
    color: #ffa500;
}

body.dark-mode .isomers-btn {
    background: linear-gradient(135deg, #d35400 0%, #e67e22 100%);
    box-shadow: 0 4px 15px rgba(211, 84, 0, 0.3);
}

body.dark-mode .isomers-btn:hover {
    box-shadow: 0 6px 20px rgba(211, 84, 0, 0.4);
}

body.dark-mode .back-btn {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
}

body.dark-mode .back-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 140, 0, 0.4);
}

body.dark-mode .style-btn {
    background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
}

body.dark-mode .style-btn:hover {
    background: linear-gradient(135deg, #3a3a3a 0%, #4a4a4a 100%);
    border-color: #ff8c00;
}

body.dark-mode .style-btn.active {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    border-color: #ff8c00;
}

body.dark-mode .modal-content {
    background: linear-gradient(135deg, #2a2a2a 0%, #3a2a1a 100%);
    border: 1px solid #4a4a4a;
}

body.dark-mode .modal-content h2 {
    color: #ff8c00;
}

body.dark-mode .isomer-info {
    color: #ffa500;
}

body.dark-mode .isomer-card {
    background: #252525;
    border: 1px solid #3a3a3a;
}

body.dark-mode .isomer-card:hover {
    border-color: #ff8c00;
    box-shadow: 0 8px 25px rgba(255, 140, 0, 0.3);
}

body.dark-mode .isomer-card h3 {
    color: #ff8c00;
}

body.dark-mode .isomer-type {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
}

body.dark-mode .close-modal {
    color: #ff8c00;
}

body.dark-mode .close-modal:hover {
    color: #ffa500;
}
/* Dark mode scrollbar styling */
body.dark-mode .isomers-list::-webkit-scrollbar-track {
    background: #2a2a2a;
}

body.dark-mode .isomers-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
}

body.dark-mode .isomers-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ff6b00 0%, #ff8c00 100%);
}

body.dark-mode .sidebar::-webkit-scrollbar-track {
    background: #2a2a2a;
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb:hover {
    background: #ff6b00;
}
body.dark-mode input[type="text"] {
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
}

body.dark-mode input[type="text"]:focus {
    border-color: #ff8c00;
    box-shadow: 0 0 0 2px rgba(255, 140, 0, 0.2);
}

body.dark-mode .search-section {
    border: 1px solid #3a3a3a;
    background: rgba(42, 42, 42, 0.5);
}

body.dark-mode .category {
    border-top: 1px solid #3a3a3a;
}

body.dark-mode label {
    color: #c0c0c0;
}

body.dark-mode input[type="checkbox"] {
    accent-color: #ff8c00;
}

/* Light Mode Styles (default styles remain) */
body.light-mode {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.main-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    min-height: 700px;
}

.sidebar {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    max-height: 800px;
}

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

.category {
    margin-bottom: 25px;
}

.category h3 {
    color: #764ba2;
    font-size: 1.1em;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #f0f0f0;
}

.search-section {
    margin-bottom: 25px;
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
}

.search-section h3 {
    color: #764ba2;
    font-size: 1.1em;
    margin-bottom: 10px;
}

#iupacSearch {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    margin-bottom: 10px;
    transition: border-color 0.3s ease;
}

#iupacSearch:focus {
    outline: none;
    border-color: #667eea;
}

.search-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: bold;
    transition: all 0.3s ease;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.error-message {
    color: #f5576c;
    font-size: 0.85em;
    margin-top: 8px;
    min-height: 20px;
}

.molecule-btn {
    width: 100%;
    padding: 12px 15px;
    margin: 5px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.molecule-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.molecule-btn.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    transform: scale(1.02);
}

.controls {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.controls h3 {
    color: #764ba2;
    font-size: 1.1em;
    margin-bottom: 15px;
}

.controls label {
    display: block;
    margin: 10px 0;
    cursor: pointer;
    font-size: 0.95em;
}

.controls input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.style-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 15px;
}

.style-btn {
    padding: 10px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.style-btn:hover {
    background: #e0e0e0;
}

.style-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.viewer-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

#moleculeViewer {
    width: 100%;
    height: 600px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.3);
}

.info-panel {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
}

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

.info-panel p {
    color: #555;
    line-height: 1.6;
    margin: 5px 0;
}

#moleculeFormula {
    font-size: 1.2em;
    font-weight: bold;
    color: #764ba2;
}

#moleculeDescription {
    margin-top: 10px;
    font-size: 1em;
}

/* Isomer Buttons Container */
.isomer-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

/* Back to Parent Button */
.back-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    width: 100%;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.back-btn:active {
    transform: translateY(0);
}

/* Isomers Button */
.isomers-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
    width: 100%;
}

.isomers-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.4);
}

.isomers-btn:active {
    transform: translateY(0);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f5f7fa 100%);
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 1000px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    color: #667eea;
    float: right;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
    color: #764ba2;
    transform: scale(1.2);
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2em;
}

.isomer-info {
    color: #764ba2;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 25px;
}

.isomers-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
}

.isomers-list::-webkit-scrollbar {
    width: 8px;
}

.isomers-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.isomers-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.isomers-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.isomer-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.isomer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.isomer-card h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.isomer-type {
    display: inline-block;
    padding: 5px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: bold;
    margin-bottom: 10px;
}

.isomer-card p {
    color: #555;
    line-height: 1.6;
    margin-top: 10px;
}

.isomer-card .formula {
    font-weight: bold;
    color: #764ba2;
    font-size: 1.1em;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .sidebar {
        max-height: 400px;
    }

    #moleculeViewer {
        height: 500px;
    }
}
