:root {
    /* Light theme colors (default) */
    --bg-gradient-start: #F5F5F0;
    --bg-gradient-end: #E8E8E0;
    --primary-text: #2C3E50;
    --secondary-text: #5D6D7E;
    --card-bg: #FFFFFF;
    --graph-bg: #FAFAFA;
    --graph-border: #E8E8E0;
    --graph-border-hover: #B4E7CE;
    --node-color-a: #A8DADC;
    --node-color-b: #FFB5A7;
    --node-hover: #B4E7CE;
    --node-border-hover: #A8E6CF;
    --edge-color: #95A5A6;
    --edge-hover: #34495E;
    --pill-bg: white;
    --pill-text: #34495E;
    --success-bg: #C1E1C1;
    --success-text: #1E5128;
    --failure-bg: #FFD4D4;
    --failure-text: #A22C29;
    --info-bg: #E3F2FD;
    --info-text: #1565C0;
    --dropdown-border: #E8E8E0;
    --modal-bg: #FFFFFF;
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --theme-toggle-bg: #E8E8E0;
    --theme-toggle-hover: #D0D0C8;
}

body.dark-theme {
    /* Dark theme colors */
    --bg-gradient-start: #1A1A2E;
    --bg-gradient-end: #16213E;
    --primary-text: #E4E4E7;
    --secondary-text: #A1A1AA;
    --card-bg: #0F3460;
    --graph-bg: #1A1A2E;
    --graph-border: #2C3E50;
    --graph-border-hover: #457B9D;
    --node-color-a: #64B5F6;
    --node-color-b: #FF8A65;
    --node-hover: #4FC3F7;
    --node-border-hover: #29B6F6;
    --edge-color: #78909C;
    --edge-hover: #90A4AE;
    --pill-bg: #1E3A5F;
    --pill-text: #E4E4E7;
    --success-bg: #1B5E20;
    --success-text: #A5D6A7;
    --failure-bg: #B71C1C;
    --failure-text: #FFCDD2;
    --info-bg: #01579B;
    --info-text: #81D4FA;
    --dropdown-border: #2C3E50;
    --modal-bg: #0F3460;
    --modal-overlay: rgba(0, 0, 0, 0.85);
    --theme-toggle-bg: #2C3E50;
    --theme-toggle-hover: #34495E;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    transition: background 0.3s ease;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary-text);
    margin-bottom: 15px;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.tutorial {
    font-size: 1.1rem;
    color: var(--secondary-text);
    font-weight: 400;
    max-width: 800px;
    line-height: 1.6;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.instructions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.instruction-pill {
    background: var(--pill-bg);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--pill-text);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.instruction-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.graph-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    width: 100%;
    max-width: 1400px;
    transition: background 0.3s ease;
}

.graph-headers {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
}

.graph-header-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.graph-controls {
    display: flex;
    gap: 5px;
}

.control-btn {
    background: var(--pill-bg);
    border: 1px solid var(--dropdown-border);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    color: var(--primary-text);
}

.control-btn:hover:not(:disabled) {
    background: var(--graph-border-hover);
    transform: translateY(-1px);
}

.control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.graph-label {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-text);
    transition: color 0.3s ease;
}

.graph-label.graph-a {
    color: #457B9D;
}

.graph-label.graph-b {
    color: #E76F51;
}

.graph-containers {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    width: 100%;
}

.cytoscape-graph {
    width: calc(50% - 10px);
    height: 450px;
    border: 2px solid var(--graph-border);
    border-radius: 12px;
    background: var(--graph-bg);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.cytoscape-graph:hover {
    border-color: var(--graph-border-hover);
}

.control-panel {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: inherit;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#check-homeomorphism {
    background: linear-gradient(135deg, #B4E7CE 0%, #A8E6CF 100%);
    color: #2C3E50;
}

#check-homeomorphism:hover:not(:disabled) {
    background: linear-gradient(135deg, #A8E6CF 0%, #9AE0C4 100%);
}

#check-isomorphism {
    background: linear-gradient(135deg, #D4A5FF 0%, #C89EF8 100%);
    color: #2C3E50;
}

#check-isomorphism:hover:not(:disabled) {
    background: linear-gradient(135deg, #C89EF8 0%, #BC92EB 100%);
}

.example-dropdown {
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: 12px;
    border: 2px solid var(--dropdown-border);
    background: var(--card-bg);
    cursor: pointer;
    font-family: inherit;
    color: var(--primary-text);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.example-dropdown:hover {
    border-color: var(--graph-border-hover);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.example-dropdown:focus {
    outline: none;
    border-color: #A8E6CF;
}

#result {
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#result.success {
    background: var(--success-bg);
    color: var(--success-text);
    box-shadow: 0 4px 6px rgba(193, 225, 193, 0.3);
}

#result.failure {
    background: var(--failure-bg);
    color: var(--failure-text);
    box-shadow: 0 4px 6px rgba(255, 212, 212, 0.3);
}

#result.info {
    background: var(--info-bg);
    color: var(--info-text);
    box-shadow: 0 4px 6px rgba(227, 242, 253, 0.3);
}

/* Theme Toggle Styles */
.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
}

#theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
}

#about-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

.theme-toggle {
    background: var(--theme-toggle-bg);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-text);
    font-weight: 500;
    font-family: inherit;
    margin: 0;
    padding: 10px 20px;
}

.theme-toggle:hover {
    background: var(--theme-toggle-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle:active {
    transform: translateY(0);
}

.about-btn {
    background: linear-gradient(135deg, #A8DADC 0%, #89C9CC 100%);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: var(--primary-text);
    font-weight: 500;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 10px 20px;
}

.about-btn:hover {
    background: linear-gradient(135deg, #89C9CC 0%, #7AB8BA 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.about-btn:active {
    transform: translateY(0);
}

body.dark-theme .about-btn {
    background: linear-gradient(135deg, #457B9D 0%, #3A6A85 100%);
}

body.dark-theme .about-btn:hover {
    background: linear-gradient(135deg, #3A6A85 0%, #31596E 100%);
}

/* About Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--modal-bg);
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 40px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease, background 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--secondary-text);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--graph-border);
    color: var(--primary-text);
    transform: rotate(90deg);
}

.modal-content h2 {
    color: var(--primary-text);
    font-size: 2rem;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--graph-border);
    padding-bottom: 15px;
    transition: color 0.3s ease;
}

.modal-content h3 {
    color: var(--primary-text);
    font-size: 1.4rem;
    margin-top: 25px;
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.modal-content h4 {
    color: var(--primary-text);
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.modal-content p {
    color: var(--secondary-text);
    line-height: 1.8;
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.modal-content ul {
    color: var(--secondary-text);
    margin-left: 25px;
    margin-bottom: 15px;
    line-height: 1.8;
    transition: color 0.3s ease;
}

.modal-content ul li {
    margin-bottom: 8px;
}

.modal-content code {
    background: var(--graph-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary-text);
    transition: background 0.3s ease, color 0.3s ease;
}

.modal-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--graph-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: background 0.3s ease;
}

.modal-content th {
    background: var(--graph-border);
    color: var(--primary-text);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    transition: background 0.3s ease, color 0.3s ease;
}

.modal-content td {
    padding: 12px;
    border-bottom: 1px solid var(--graph-border);
    color: var(--secondary-text);
    transition: color 0.3s ease;
}

.modal-content tr:last-child td {
    border-bottom: none;
}

.section-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--graph-border), transparent);
    margin: 30px 0;
    transition: background 0.3s ease;
}

/* cytoscape node selection */
.selected-source {
    border-width: 4px !important;
    border-color: #F39C12 !important;
    background-color: #FDB863 !important;
}

/* responsive */
@media (max-width: 1024px) {
    .graph-containers {
        flex-direction: column;
    }
    
    .cytoscape-graph {
        width: 100%;
    }
    
    .graph-headers {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .graph-header-group {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .tutorial {
        font-size: 1rem;
    }
    
    .graph-section {
        padding: 20px;
    }
    
    .cytoscape-graph {
        height: 350px;
    }
}
