/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    overflow-x: hidden;
    height: 100vh;
    transition: background 0.3s ease;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header Styles - Minimal Version */
.header {
    text-align: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    position: relative;
}

.header-content {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 0 1rem;
}

/* Logo Container and Image */
.logo-container {
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 0;
}

.logo-image {
    height: 50px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.02);
}

.header h1 {
    font-size: 1.5rem;
    margin: 0;
}

/* Header Right Controls */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    z-index: 1001;
}

/* Header User Badge */
.header-user-badge {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.header-user-badge:hover {
    transform: scale(1.05);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

/* Header Sign In Button */
.header-signin-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.header-signin-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

/* Hamburger Menu Button */
.hamburger-menu-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    color: #2c3e50;
    transition: color 0.3s ease, transform 0.2s ease;
}

.hamburger-menu-btn:hover {
    color: #3498db;
    transform: scale(1.1);
}

.hamburger-icon {
    display: block;
    line-height: 1;
}

/* Menu Panel */
.menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 10002;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.menu-panel:not(.hidden) {
    transform: translateX(0);
}

.menu-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.menu-panel-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.close-menu-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.close-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.menu-panel-content {
    padding: 1.5rem;
}

.menu-section {
    margin-bottom: 1rem;
    padding-bottom: 0;
    border-bottom: none;
}

.menu-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.menu-section h4 {
    margin: 0 0 0.8rem 0;
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    opacity: 0.7;
}

.menu-select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.menu-select:hover {
    border-color: #3498db;
    background: #f8f9fa;
}

.menu-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* User Profile Section at Top */
.user-profile-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: -1.5rem -1.5rem 2rem -1.5rem;
    padding: 2rem 1.5rem;
    border-bottom: none;
}

.user-info-menu-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.user-avatar-menu-top {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.user-name-menu-top {
    font-weight: 600;
    color: white;
    font-size: 1.2rem;
}

/* Menu Item Buttons */
.menu-item-btn {
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: white;
    color: #2c3e50;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.menu-item-btn:hover {
    background: #f8f9fa;
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
}

.menu-item-btn.logout-btn {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.menu-item-btn.logout-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

/* Old styles kept for compatibility */
.user-info-menu {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
}

.user-avatar-menu {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

.user-name-menu {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.05rem;
}

.user-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.menu-action-btn {
    width: 100%;
    padding: 0.85rem 1.2rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.menu-action-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.menu-action-btn.logout-btn {
    background: #e74c3c;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.menu-action-btn.logout-btn:hover {
    background: #c0392b;
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.btn-login-menu {
    width: 100%;
    padding: 0.85rem 1.2rem;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-login-menu:hover {
    background: #2980b9;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
}

.menu-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

/* Hide old header controls */
.header-controls,
.mode-selector {
    display: none;
}

.theme-selector select:hover {
    border-color: #3498db;
}

.theme-selector select:focus {
    border-color: #667eea;
}

.header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Input Section */
.input-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem 2rem 2rem;
    overflow: hidden;
}

.input-container {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
    text-align: center;
}

#initial-prompt {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid #e1e5e9;
    border-radius: 50px;
    font-size: 1.1rem;
    font-family: inherit;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s ease;
    outline: none;
}

#initial-prompt:focus {
    border-color: #667eea;
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 200px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin: 0 0.5rem;
}

.btn-secondary:hover {
    background: white;
}

/* Mind Map Container */
.mindmap-container {
    flex: 1;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    margin: 0.5rem 1rem 1rem 1rem;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 0;
    z-index: 1;
}

.controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
}

#mindmap-svg {
    width: 100%;
    height: 100%;
    min-height: 600px;
    cursor: grab;
}

#mindmap-svg:active {
    cursor: grabbing;
}

/* Mind Map Node Styles */
.node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.node:hover .node-rect {
    stroke-width: 3;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.18));
    transform: scale(1.02);
}

.node:hover .node-text {
    font-weight: 600;
}

.node.loading .node-rect {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.node-rect {
    fill: #ffffff;
    stroke: #cbd5e1;
    stroke-width: 2;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.12));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.node.root .node-rect {
    fill: #3b82f6;
    stroke: #2563eb;
    stroke-width: 3;
    filter: drop-shadow(0 8px 16px rgba(59, 130, 246, 0.3));
}

.node.expandable .node-rect {
    stroke: #10b981;
    stroke-width: 2.5;
    fill: #ffffff;
    filter: drop-shadow(0 4px 10px rgba(16, 185, 129, 0.15));
}

.node.expanded .node-rect {
    fill: #f0f9ff;
    stroke: #3b82f6;
    filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.2));
}

/* Color coding by depth */
.node.depth-1 .node-rect {
    stroke: #10b981;
    stroke-width: 2.5;
}

.node.depth-1.expanded .node-rect {
    fill: #f0fdf4;
    stroke: #10b981;
}

.node.depth-2 .node-rect {
    stroke: #f59e0b;
    stroke-width: 2.5;
}

.node.depth-2.expanded .node-rect {
    fill: #fffbeb;
    stroke: #f59e0b;
}

.node.depth-3 .node-rect {
    stroke: #ec4899;
    stroke-width: 2.5;
}

.node.depth-3.expanded .node-rect {
    fill: #fdf2f8;
    stroke: #ec4899;
}

.node.depth-4 .node-rect {
    stroke: #8b5cf6;
    stroke-width: 2.5;
}

.node.depth-4.expanded .node-rect {
    fill: #faf5ff;
    stroke: #8b5cf6;
}

.node.depth-5 .node-rect {
    stroke: #06b6d4;
    stroke-width: 2.5;
}

.node.depth-5.expanded .node-rect {
    fill: #f0fdfa;
    stroke: #06b6d4;
}

.node-text {
    fill: #1e293b;
    text-anchor: middle;
    font-size: 10px;
    font-weight: 500;
    pointer-events: none;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.node-text tspan {
    fill: inherit;
    text-anchor: middle;
}

.node.root .node-text {
    fill: white;
    font-weight: 600;
    font-size: 11px;
}

.node.root .node-text {
    fill: white;
    font-weight: 600;
    font-size: 13px;
}

.node.root .node-text tspan {
    fill: white;
}

/* Links between nodes */
.link {
    fill: none;
    stroke: rgba(102, 126, 234, 0.6);
    stroke-width: 2;
    transition: stroke-width 0.3s ease;
}

.link:hover {
    stroke-width: 3;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 1.1rem;
    color: #333;
}

/* Error Message */
.error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.error-message p {
    color: #dc3545;
    margin-bottom: 1rem;
    font-size: 1rem;
}

/* Context Menu Button */
.context-menu-btn {
    fill: #6c757d;
    stroke: white;
    stroke-width: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
}

.context-menu-text {
    opacity: 0;
    transition: all 0.2s ease;
}

.node:hover .context-menu-btn,
.node:hover .context-menu-text {
    opacity: 0.6;
}

.context-menu-btn:hover {
    fill: #495057;
}

.node:hover .context-menu-btn:hover,
.node:hover .context-menu-text:hover {
    opacity: 1;
}

/* Context Menu Dropdown */
#context-menu {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 4px;
    min-width: 160px;
    z-index: 10000;
    border: 1px solid #e0e0e0;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
    font-size: 14px;
}

.context-menu-item:hover {
    background: #f5f5f5;
}

.context-menu-item.danger {
    color: #e74c3c;
}

.context-menu-item.danger:hover {
    background: #fee;
}

.menu-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.menu-label {
    flex: 1;
    font-weight: 500;
}

body.theme-dark #context-menu {
    background: #34495e;
    border-color: #4a5f7f;
}

body.theme-dark .context-menu-item {
    color: #ecf0f1;
}

body.theme-dark .context-menu-item:hover {
    background: #4a5f7f;
}

body.theme-dark .context-menu-item.danger {
    color: #e74c3c;
}

body.theme-dark .context-menu-item.danger:hover {
    background: #4a2828;
}

/* Deep Dive Button */
.deep-dive-btn {
    fill: #e74c3c;
    stroke: white;
    stroke-width: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
}

.deep-dive-text {
    opacity: 0;
    transition: all 0.2s ease;
}

.node:hover .deep-dive-btn,
.node:hover .deep-dive-text {
    opacity: 0.6;
}

.deep-dive-btn:hover {
    fill: #c0392b;
}

.node:hover .deep-dive-btn:hover,
.node:hover .deep-dive-text:hover {
    opacity: 1;
}

/* Add Custom Topic Button */
.add-custom-btn {
    fill: #27ae60;
    stroke: white;
    stroke-width: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
}

.add-custom-text {
    opacity: 0;
    transition: all 0.2s ease;
}

.node:hover .add-custom-btn,
.node:hover .add-custom-text {
    opacity: 0.6;
}

.add-custom-btn:hover {
    fill: #229954;
}

.node:hover .add-custom-btn:hover,
.node:hover .add-custom-text:hover {
    opacity: 1;
}

/* Delete Button Styles */
.delete-btn {
    fill: #e74c3c;
    stroke: #c0392b;
    stroke-width: 1.5;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, fill 0.3s ease;
}

.delete-text {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.node:hover .delete-btn,
.node:hover .delete-text {
    opacity: 0.6;
}

.delete-btn:hover {
    fill: #c0392b;
}

.node:hover .delete-btn:hover,
.node:hover .delete-text:hover {
    opacity: 1;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 90vw;
    max-height: 80vh;
    width: 800px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    min-width: 150px;
    padding: 0.75rem 1.5rem;
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.loading-content .spinner {
    margin: 0 auto 1rem auto;
}

#deep-dive-content {
    line-height: 1.6;
}

#deep-dive-content h3 {
    color: #2c3e50;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

#deep-dive-content h3:first-child {
    margin-top: 0;
}

#deep-dive-content ul {
    margin: 1rem 0;
    padding-left: 2rem;
}

#deep-dive-content li {
    margin-bottom: 0.5rem;
}

#deep-dive-content a {
    color: #2980b9;
    text-decoration: underline;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

#deep-dive-content a:hover {
    background-color: #3498db;
    color: white;
    text-decoration: none;
}

#deep-dive-content .external-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#deep-dive-content .external-link:hover {
    background: linear-gradient(45deg, #2980b9, #1e6fa8);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.exploration-path {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid #3498db;
}

.path-item {
    display: inline-block;
    background: #ecf0f1;
    padding: 0.3rem 0.8rem;
    margin: 0.2rem;
    border-radius: 15px;
    font-size: 0.9rem;
    color: #2c3e50;
}

.path-arrow {
    margin: 0 0.5rem;
    color: #7f8c8d;
}

/* Custom Topic Modal */
.custom-topic-modal {
    width: 500px;
    max-width: 90vw;
}

.custom-topic-form {
    text-align: center;
}

#custom-topic-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s ease;
}

#custom-topic-input:focus {
    outline: none;
    border-color: #3498db;
}

.form-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.form-buttons .btn-primary,
.form-buttons .btn-secondary {
    flex: 1;
    max-width: 150px;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .input-section {
        padding: 0.5rem 1rem 1rem 1rem;
    }
    
    .input-container {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    #initial-prompt {
        font-size: 1rem;
        padding: 0.8rem 1rem;
    }
    
    .mindmap-container {
        margin: 0.25rem 0.5rem 0.5rem 0.5rem;
    }
    
    .controls {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .btn-secondary {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        margin: 0 0.2rem;
    }
    
    #mindmap-svg {
        min-height: 500px;
    }
    
    .theme-selector {
        margin-top: 0.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .theme-selector select {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Theme Styles */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #c3cfe2;
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-text: #2c3e50;
    --header-subtitle: #7f8c8d;
    --node-bg: #ffffff;
    --node-border: #bdc3c7;
    --node-root-bg: #2c3e50;
    --node-root-border: #34495e;
    --node-text: #2c3e50;
    --node-root-text: #ffffff;
    --btn-primary: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    --btn-primary-hover: #2980b9;
}

/* Dark Theme */
body.theme-dark {
    --bg-primary: #2c3e50;
    --bg-secondary: #34495e;
    --header-bg: rgba(52, 73, 94, 0.95);
    --header-text: #ecf0f1;
    --header-subtitle: #bdc3c7;
    --node-bg: #34495e;
    --node-border: #7f8c8d;
    --node-root-bg: #e74c3c;
    --node-root-border: #c0392b;
    --node-text: #ecf0f1;
    --node-root-text: #ffffff;
    --btn-primary: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    --btn-primary-hover: #c0392b;
}

/* Ocean Theme */
body.theme-ocean {
    --bg-primary: #e3f2fd;
    --bg-secondary: #bbdefb;
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-text: #0d47a1;
    --header-subtitle: #1976d2;
    --node-bg: #ffffff;
    --node-border: #64b5f6;
    --node-root-bg: #1976d2;
    --node-root-border: #0d47a1;
    --node-text: #0d47a1;
    --node-root-text: #ffffff;
    --btn-primary: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    --btn-primary-hover: #1976d2;
}

/* Forest Theme */
body.theme-forest {
    --bg-primary: #e8f5e8;
    --bg-secondary: #c8e6c9;
    --header-bg: rgba(255, 255, 255, 0.95);
    --header-text: #1b5e20;
    --header-subtitle: #388e3c;
    --node-bg: #ffffff;
    --node-border: #81c784;
    --node-root-bg: #388e3c;
    --node-root-border: #2e7d32;
    --node-text: #1b5e20;
    --node-root-text: #ffffff;
    --btn-primary: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    --btn-primary-hover: #388e3c;
}

/* Theme-specific link styling */
body.theme-dark #deep-dive-content .external-link {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
}

body.theme-dark #deep-dive-content .external-link:hover {
    background: linear-gradient(45deg, #c0392b, #a93226);
}

/* Dark theme depth colors */
body.theme-dark .node.depth-1.expanded .node-rect {
    fill: #1e4620;
    stroke: #10b981;
}

body.theme-dark .node.depth-1 .node-text {
    fill: #10b981;
}

body.theme-dark .node.depth-2.expanded .node-rect {
    fill: #4a3a1a;
    stroke: #f59e0b;
}

body.theme-dark .node.depth-2 .node-text {
    fill: #fbbf24;
}

body.theme-dark .node.depth-3.expanded .node-rect {
    fill: #4a1e3a;
    stroke: #ec4899;
}

body.theme-dark .node.depth-3 .node-text {
    fill: #f9a8d4;
}

body.theme-dark .node.depth-4.expanded .node-rect {
    fill: #3a2a4a;
    stroke: #8b5cf6;
}

body.theme-dark .node.depth-4 .node-text {
    fill: #c4b5fd;
}

body.theme-dark .node.depth-5.expanded .node-rect {
    fill: #1a3a4a;
    stroke: #06b6d4;
}

body.theme-dark .node.depth-5 .node-text {
    fill: #67e8f9;
}

body.theme-ocean #deep-dive-content .external-link {
    background: linear-gradient(45deg, #2196f3, #1976d2);
}

body.theme-ocean #deep-dive-content .external-link:hover {
    background: linear-gradient(45deg, #1976d2, #0d47a1);
}

body.theme-forest #deep-dive-content .external-link {
    background: linear-gradient(45deg, #4caf50, #388e3c);
}

body.theme-forest #deep-dive-content .external-link:hover {
    background: linear-gradient(45deg, #388e3c, #2e7d32);
}

/* Actionable Steps Styling */
.actionable-step {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #2c3e50;
    background: linear-gradient(45deg, #f39c12, #e67e22);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}

.actionable-step:hover {
    background: linear-gradient(45deg, #e67e22, #d35400);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-color: #f39c12;
}

.actionable-step:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Fallback actionable steps have slightly different styling */
.fallback-actionable {
    background: linear-gradient(45deg, #9b59b6, #8e44ad) !important;
    border: 1px dashed #8e44ad;
}

.fallback-actionable:hover {
    background: linear-gradient(45deg, #8e44ad, #7d3c98) !important;
}

/* Theme-specific actionable step styling */
body.theme-dark .actionable-step {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
}

body.theme-dark .actionable-step:hover {
    background: linear-gradient(45deg, #c0392b, #a93226);
}

body.theme-ocean .actionable-step {
    background: linear-gradient(45deg, #2196f3, #1976d2);
    color: white;
}

body.theme-ocean .actionable-step:hover {
    background: linear-gradient(45deg, #1976d2, #0d47a1);
}

body.theme-forest .actionable-step {
    background: linear-gradient(45deg, #4caf50, #388e3c);
    color: white;
}

body.theme-forest .actionable-step:hover {
    background: linear-gradient(45deg, #388e3c, #2e7d32);
}

/* Apply theme variables */
body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.header {
    background: var(--header-bg);
}

.header h1 {
    color: var(--header-text);
}

.header p {
    color: var(--header-subtitle);
}

.theme-selector label {
    color: var(--header-subtitle);
}

.node-rect {
    fill: var(--node-bg);
    stroke: var(--node-border);
}

.node.root .node-rect {
    fill: var(--node-root-bg);
    stroke: var(--node-root-border);
}

.node-text {
    fill: var(--node-text);
}

.node.root .node-text,
.node.root .node-text tspan {
    fill: var(--node-root-text);
}

.btn-primary {
    background: var(--btn-primary);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
}

/* Learning Mode Styles */
.learning-progress {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

#progress-stats {
    color: #3498db;
}

.btn-learning {
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(142, 68, 173, 0.3);
}

.btn-learning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(142, 68, 173, 0.4);
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

/* Learning node states */
.node.completed .node-rect {
    stroke: #27ae60;
    stroke-width: 3;
}

.node.completed::after {
    content: '✓';
    position: absolute;
    top: -10px;
    right: -10px;
    background: #27ae60;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.node.learning .node-rect {
    stroke: #f39c12;
    stroke-width: 3;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { stroke-opacity: 1; }
    50% { stroke-opacity: 0.5; }
}

.node.locked .node-rect {
    opacity: 0.4;
    stroke: #95a5a6;
    stroke-dasharray: 5, 5;
}

.node.needs-review .node-rect {
    stroke: #e74c3c;
    stroke-width: 2.5;
}

/* Learning Modal */
.learning-card {
    max-width: 700px;
}

.learning-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.learning-section:last-child {
    border-bottom: none;
}

.learning-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.learning-text {
    line-height: 1.8;
    color: #555;
    font-size: 15px;
}

.learning-text p {
    margin-bottom: 1rem;
}

.learning-text ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.learning-text li {
    margin-bottom: 0.5rem;
}

/* Quiz Styles */
.quiz-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.quiz-question {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option {
    padding: 12px 16px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.quiz-option:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.quiz-option.correct {
    border-color: #27ae60;
    background: #d5f4e6;
}

.quiz-option.incorrect {
    border-color: #e74c3c;
    background: #fadbd8;
}

.quiz-option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
}

.quiz-feedback.correct {
    background: #d5f4e6;
    color: #27ae60;
    border: 1px solid #27ae60;
}

.quiz-feedback.incorrect {
    background: #fadbd8;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.btn-success:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e67e22, #f39c12);
}

body.theme-dark .learning-progress {
    background: rgba(52, 73, 94, 0.95);
}

body.theme-dark .progress-text {
    color: #ecf0f1;
}

body.theme-dark .learning-section h3 {
    color: #ecf0f1;
}

body.theme-dark .learning-text {
    color: #bdc3c7;
}

body.theme-dark .quiz-container {
    background: #2c3e50;
}

body.theme-dark .quiz-question {
    color: #ecf0f1;
}

body.theme-dark .quiz-option {
    background: #34495e;
    border-color: #4a5f7f;
    color: #ecf0f1;
}

body.theme-dark .quiz-option:hover {
    border-color: #3498db;
    background: #2c3e50;
}

/* Authentication Styles */
.auth-section {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-login {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.btn-login:hover {
    background: linear-gradient(135deg, #2980b9, #3498db);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.4);
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 200px;
}

/* Login buttons in menu panel (different styling) */
.login-buttons-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0;
    width: 100%;
}

.login-section {
    width: 100%;
}

.btn-social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px solid;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    width: 100%;
    justify-content: flex-start;
}

.btn-google {
    border-color: #db4437;
    color: #db4437;
}

.btn-google:hover {
    background: #db4437;
    color: white;
}

.btn-facebook {
    border-color: #4267B2;
    color: #4267B2;
}

.btn-facebook:hover {
    background: #4267B2;
    color: white;
}

.btn-twitter {
    border-color: #1DA1F2;
    color: #1DA1F2;
}

.btn-twitter:hover {
    background: #1DA1F2;
    color: white;
}

.social-icon {
    font-weight: bold;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #3498db;
    object-fit: cover;
}

.user-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.btn-user-menu {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.btn-user-menu:hover {
    background: rgba(52, 152, 219, 0.1);
}

.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 160px;
    overflow: hidden;
}

.user-menu button {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
    color: #2c3e50;
}

.user-menu button:hover {
    background: #f8f9fa;
}

/* Mind Maps List Styles */
.mindmaps-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 1rem 0;
}

.mindmap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.mindmap-item:hover {
    background: #e9ecef;
    border-color: #3498db;
}

.mindmap-info {
    flex: 1;
}

.mindmap-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.mindmap-details {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.mindmap-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-load {
    background: #3498db;
    color: white;
}

.btn-load:hover {
    background: #2980b9;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
}

.no-content {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
    font-style: italic;
}

/* Settings Styles */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Subscription Section */
.subscription-info {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
}

.tier-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.tier-badge #current-tier {
    text-transform: uppercase;
}

.tier-badge.free #current-tier {
    background: #95a5a6;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
}

.tier-badge.pro #current-tier {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
}

#subscription-details {
    margin: 1rem 0;
}

#tier-description {
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.usage-info {
    background: rgba(255, 255, 255, 0.7);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.usage-info p {
    margin: 0;
    color: #34495e;
}

#stripe-pricing-container {
    margin-top: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
}

#stripe-pricing-container.hidden {
    display: none;
}

.tier-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.tier-column {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid #ecf0f1;
}

.tier-column.pro {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px solid #667eea;
    position: relative;
}

.tier-column h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.tier-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tier-column ul li {
    padding: 0.5rem 0;
    color: #34495e;
    position: relative;
    padding-left: 1.5rem;
}

.tier-column ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #27ae60;
    font-weight: bold;
}

.tier-column.pro ul li:before {
    color: #667eea;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #ecf0f1;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-weight: 500;
    color: #34495e;
}

.setting-item select {
    padding: 0.5rem;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    background: white;
    color: #2c3e50;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.stat-label {
    font-weight: 500;
    color: #495057;
}

.stat-value {
    font-weight: 600;
    color: #3498db;
    font-size: 1.1rem;
}

.save-form {
    margin: 1rem 0;
}

.save-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.save-form input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.save-form input:focus {
    outline: none;
    border-color: #3498db;
}

.form-help {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.6rem;
    line-height: 1.5;
}

/* Dark Theme Authentication Styles */
body.theme-dark .login-buttons,
body.theme-dark .user-menu {
    background: #2c3e50;
    border-color: #34495e;
}

body.theme-dark .btn-social {
    background: #34495e;
    color: #ecf0f1;
}

body.theme-dark .user-name {
    color: #ecf0f1;
}

body.theme-dark .user-menu button {
    color: #ecf0f1;
}

body.theme-dark .user-menu button:hover {
    background: #34495e;
}

body.theme-dark .mindmap-item {
    background: #34495e;
    border-color: #4a5f7f;
}

body.theme-dark .mindmap-item:hover {
    background: #2c3e50;
}

body.theme-dark .mindmap-name {
    color: #ecf0f1;
}

body.theme-dark .stat-item {
    background: #34495e;
    border-color: #4a5f7f;
}

body.theme-dark .save-form input {
    background: #34495e;
    border-color: #4a5f7f;
    color: #ecf0f1;
}

body.theme-dark .save-form input:focus {
    border-color: #3498db;
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .login-buttons {
        position: relative;
        margin-top: 1rem;
    }
    
    .user-profile {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}