/* ==========================================================================
   OneNote for Genealogy - Modern Design System & Stylesheet
   ========================================================================== */

/* Design Tokens & Variables */
:root {
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Theme Colors (Light Mode) */
    --primary: #5c2d91; /* OneNote Purple */
    --primary-hover: #4b2377;
    --primary-light: #f3effa;
    --accent: #7b3eb3;
    
    --bg-app: #ffffff;
    --bg-canvas: #ffffff;
    --bg-sidebar: #f3f2f1;
    --bg-panel: #faf9f8;
    --bg-card: #ffffff;
    
    --text-main: #242424;
    --text-muted: #605e5c;
    --text-on-primary: #ffffff;
    
    --border-light: #e1dfdd;
    --border-hover: #c8c6c4;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
    
    /* Code/Status Colors */
    --color-pro: #107c41; /* Excel Green */
    --color-con: #a80000; /* Red */
    --bg-pro-light: #e1f2e9;
    --bg-con-light: #fde7e9;
    
    --section-group-started: #5c2d91;
    --section-group-structure: #0078d4;
    --section-group-workflow: #107c41;
    --section-group-references: #d83b01;
    
    --transition-speed: 0.25s;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Dark Mode Variables Override */
body.dark-theme {
    --bg-app: #18181c;
    --bg-canvas: #1e1e24;
    --bg-sidebar: #121215;
    --bg-panel: #16161a;
    --bg-card: #282830;
    
    --text-main: #e3e3e6;
    --text-muted: #a19f9d;
    
    --border-light: #2d2c34;
    --border-hover: #403f4a;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.4);
    
    --primary-light: #2c1a40;
    
    --bg-pro-light: #162a1f;
    --bg-con-light: #371719;
}

/* General Reset & Layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-app);
    overflow: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.onenote-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   1. Top Title Bar Style
   ========================================================================== */
.onenote-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 16px;
    background-color: var(--primary);
    color: var(--text-on-primary);
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.titlebar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#toggle-sidebar-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-speed);
}

#toggle-sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.app-logo .purple-icon {
    color: #ffffff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.titlebar-center {
    flex: 1;
    max-width: 500px;
    margin: 0 20px;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-container input {
    width: 100%;
    height: 32px;
    padding: 0 36px;
    border: none;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 0.95rem;
    outline: none;
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
}

.search-container input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.search-container input:focus {
    background-color: #ffffff;
    color: #242424;
    box-shadow: var(--shadow-md);
}

.search-container input:focus + button,
.search-container input:focus ~ .search-icon {
    color: #605e5c;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    width: 16px;
    height: 16px;
    transition: color var(--transition-speed);
}

#clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.titlebar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle, .tools-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: inherit;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition-speed), border var(--transition-speed);
}

.theme-toggle:hover, .tools-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.tools-toggle.active {
    background-color: #ffffff;
    color: var(--primary);
    font-weight: 600;
    border-color: #ffffff;
}

.tools-toggle.active:hover {
    background-color: #f3f2f1;
}

/* ==========================================================================
   2. Workspace & Sidebar (Left Navigation)
   ========================================================================== */
.onenote-workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.onenote-sidebar {
    width: 290px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width var(--transition-speed), background-color var(--transition-speed), border-color var(--transition-speed);
}

.onenote-sidebar.collapsed {
    width: 0;
    border-right: none;
}

.sidebar-notebook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 12px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background-color var(--transition-speed);
}

.notebook-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
    flex: 1;
}

.notebook-arrow {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-speed);
}

.notebook-arrow.collapsed {
    transform: rotate(-90deg);
}

.notebook-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

body.dark-theme .notebook-icon {
    color: var(--accent);
}

.notebook-title {
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-speed), background-color var(--transition-speed);
}

.sidebar-action-btn:hover {
    color: var(--primary);
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-theme .sidebar-action-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-sections-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Nav Tree Flat Structure Styling */
.nav-tree {
    list-style: none;
}

.section-group-node {
    margin-bottom: 8px;
    border-left: 4px solid var(--border-light);
}

/* Accents per group */
.section-group-node.started { border-left-color: var(--section-group-started); }
.section-group-node.structure { border-left-color: var(--section-group-structure); }
.section-group-node.workflow { border-left-color: var(--section-group-workflow); }
.section-group-node.references { border-left-color: var(--section-group-references); }

.section-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
    position: relative;
}

.section-group-title-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.section-group-title i {
    width: 14px;
    height: 14px;
    transition: transform var(--transition-speed);
}

.section-group-title.collapsed i {
    transform: rotate(-90deg);
}

.section-actions {
    display: none;
    align-items: center;
    gap: 4px;
}

.section-group-title:hover .section-actions {
    display: flex;
}

.section-group-children {
    list-style: none;
    padding-left: 0;
}

.section-group-node.collapsed .section-group-children {
    display: none;
}

/* Page items under section */
.page-node-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 18px;
    font-size: 0.95rem;
    color: var(--text-main);
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin: 2px 8px;
    gap: 8px;
    transition: background-color 0.15s, font-weight 0.15s;
    position: relative;
}

/* Subpage Indentation */
.page-node-item.subpage-node {
    padding-left: 32px;
}

.page-node-item.subpage-node::before {
    content: "";
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-left: 1px solid var(--border-hover);
    border-bottom: 1px solid var(--border-hover);
}

.page-node-title-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    overflow: hidden;
}

.page-node-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-node-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

body.dark-theme .page-node-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.page-node-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

body.dark-theme .page-node-item.active {
    color: #ffffff;
}

.page-node-item i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.page-node-item.active i {
    color: var(--primary);
}

body.dark-theme .page-node-item.active i {
    color: #ffffff;
}

/* Sidebar action icons shown on hover */
.page-actions {
    display: none;
    align-items: center;
    gap: 4px;
}

.page-node-item:hover .page-actions {
    display: flex;
}

.action-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity var(--transition-speed), color var(--transition-speed), background-color var(--transition-speed);
}

.action-icon-btn:hover {
    opacity: 1;
    color: var(--primary);
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-theme .action-icon-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.action-icon-btn i {
    width: 12px !important;
    height: 12px !important;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: var(--bg-sidebar);
}

.reset-btn {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
    width: 100%;
}

.reset-btn:hover {
    background-color: rgba(0,0,0,0.03);
    color: var(--color-con);
    border-color: rgba(168,0,0,0.2);
}

body.dark-theme .reset-btn:hover {
    background-color: rgba(255,255,255,0.03);
}

.reset-btn i {
    width: 13px;
    height: 13px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.green-dot {
    background-color: var(--color-pro);
    box-shadow: 0 0 8px var(--color-pro);
}

/* ==========================================================================
   3. Center Canvas & Page Content Style
   ========================================================================== */
.onenote-canvas {
    flex: 1;
    background-color: var(--bg-canvas);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: background-color var(--transition-speed);
}

.canvas-breadcrumbs {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    background-color: var(--bg-app);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-muted);
    gap: 6px;
    flex-wrap: wrap;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.breadcrumb-sep {
    width: 12px;
    height: 12px;
}

.canvas-breadcrumbs span.active {
    color: var(--text-main);
    font-weight: 500;
}

/* Editor Toolbar (For custom page modifications) */
.editor-toolbar {
    display: flex;
    align-items: center;
    padding: 8px 24px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-light);
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.02);
}

.toolbar-group {
    display: flex;
    gap: 4px;
    align-items: center;
}

.editor-tool-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--text-main);
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-speed), border var(--transition-speed);
}

.editor-tool-btn:hover {
    background-color: rgba(0,0,0,0.05);
    border-color: var(--border-light);
}

body.dark-theme .editor-tool-btn:hover {
    background-color: rgba(255,255,255,0.05);
}

.editor-tool-btn.active {
    background-color: var(--primary-light);
    border-color: rgba(92,45,145,0.2);
    color: var(--primary);
}

.editor-tool-btn i {
    width: 16px;
    height: 16px;
}

.editor-sep {
    width: 1px;
    height: 20px;
    background-color: var(--border-light);
}

.template-container select {
    height: 28px;
    padding: 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    outline: none;
    background-color: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
}

.onenote-page-wrapper {
    flex: 1;
    padding: 32px 40px 60px 40px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .onenote-page-wrapper {
        padding: 20px;
    }
}

.onenote-page-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 16px;
    margin-bottom: 28px;
    transition: border-color var(--transition-speed);
}

/* Edit Mode Visual Indicator */
[contenteditable="true"] {
    outline: none;
    border: 1px dashed transparent;
    transition: border-color var(--transition-speed);
    padding: 4px;
    border-radius: var(--radius-sm);
}

[contenteditable="true"]:hover {
    border-color: rgba(92, 45, 145, 0.2);
}

[contenteditable="true"]:focus {
    border-color: var(--primary);
    background-color: rgba(92, 45, 145, 0.02);
}

.onenote-page-header h1 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2.3rem;
    line-height: 1.2;
    color: var(--text-main);
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 12px;
}

.page-meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item i {
    width: 14px;
    height: 14px;
}

/* Page Body Content Typography */
.onenote-page-body {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-main);
}

.onenote-page-body p {
    margin-bottom: 18px;
}

.onenote-page-body h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.6rem;
    margin-top: 36px;
    margin-bottom: 14px;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.onenote-page-body h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.25rem;
    margin-top: 24px;
    margin-bottom: 10px;
    color: var(--text-main);
}

.onenote-page-body ul, .onenote-page-body ol {
    margin-left: 20px;
    margin-bottom: 18px;
}

.onenote-page-body li {
    margin-bottom: 8px;
}

/* Page Hyperlinks */
.onenote-page-body a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary);
    transition: color var(--transition-speed), border-color var(--transition-speed);
}

.onenote-page-body a:hover {
    color: var(--accent);
    border-bottom-style: solid;
}

body.dark-theme .onenote-page-body a {
    color: #a881d8;
    border-bottom-color: #a881d8;
}

body.dark-theme .onenote-page-body a:hover {
    color: #c7a4ee;
}

/* ==========================================================================
   4. Structured Elements (Cards, Lists, Tables, Modals)
   ========================================================================== */

/* Modal styling */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 500;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
}

.custom-modal.active {
    display: flex;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 24px;
    animation: zoomInImage 0.2s ease-out;
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-input-group {
    margin-bottom: 18px;
}

.modal-input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.modal-input-group input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background-color: var(--bg-app);
    color: var(--text-main);
    outline: none;
}

.modal-input-group input:focus {
    border-color: var(--primary);
}

.color-picker-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform var(--transition-speed);
}

.color-circle:hover {
    transform: scale(1.1);
}

.color-circle.active {
    border-color: var(--text-main);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

.cancel-btn {
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0 16px;
    height: 36px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
}

.cancel-btn:hover {
    background-color: rgba(0,0,0,0.02);
}

/* Feature Cards Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.feature-card {
    display: flex;
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.feature-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.dark-theme .feature-card-icon {
    background-color: #312147;
    color: #c7a4ee;
}

.feature-card-content h4 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.feature-card-content p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.5;
}

/* Learning Path Block Links */
.learning-path-card {
    display: flex;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 14px;
    text-decoration: none !important; /* override global anchor style */
    color: inherit !important;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.learning-path-card:hover {
    transform: translateX(4px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.learning-path-card .card-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    flex-shrink: 0;
}

body.dark-theme .learning-path-card .card-icon {
    background-color: #312147;
    color: #c7a4ee;
}

.learning-path-card .card-body {
    flex: 1;
}

.learning-path-card h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}

.learning-path-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0;
    line-height: 1.5;
}

.learning-path-card .card-arrow {
    padding-left: 12px;
    color: var(--text-muted);
    transition: transform var(--transition-speed);
}

.learning-path-card:hover .card-arrow {
    transform: translateX(2px);
    color: var(--primary);
}

/* OneNote Table Styles */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 28px 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.onenote-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    text-align: left;
}

.onenote-table th {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-light);
}

body.dark-theme .onenote-table th {
    background-color: #241639;
    color: #c7a4ee;
}

.onenote-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
}

.onenote-table tr:last-child td {
    border-bottom: none;
}

.onenote-table tr:nth-child(even) td {
    background-color: rgba(0,0,0,0.015);
}

body.dark-theme .onenote-table tr:nth-child(even) td {
    background-color: rgba(255,255,255,0.015);
}

/* Callout / Warnings Boxes */
.onenote-callout {
    display: flex;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 24px 0;
    gap: 14px;
}

.onenote-callout .callout-icon {
    font-size: 1.25rem;
    color: var(--primary);
    flex-shrink: 0;
}

.onenote-callout .callout-content p {
    font-size: 0.95rem;
    margin-bottom: 0;
}

.info-callout {
    border-left-color: var(--section-group-structure);
    background-color: rgba(0, 120, 212, 0.03);
}
.info-callout .callout-icon {
    color: var(--section-group-structure);
}

.lock-callout {
    border-left-color: var(--section-group-references);
    background-color: rgba(216, 59, 1, 0.03);
}
.lock-callout .callout-icon {
    color: var(--section-group-references);
}

/* Badge Callouts (Pro / Con) */
.badge-callout {
    display: flex;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 12px;
    gap: 12px;
    font-size: 0.95rem;
}

.badge-callout.badge-pro {
    background-color: var(--bg-pro-light);
    border: 1px solid rgba(16, 124, 65, 0.2);
}

.badge-callout.badge-con {
    background-color: var(--bg-con-light);
    border: 1px solid rgba(168, 0, 0, 0.2);
}

.badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-pro .badge-icon {
    background-color: var(--color-pro);
    color: white;
}

.badge-con .badge-icon {
    background-color: var(--color-con);
    color: white;
}

/* Styled Figures & Captions */
.onenote-figure {
    margin: 32px 0;
    text-align: center;
    border: 1px solid var(--border-light);
    background-color: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.onenote-figure:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.onenote-figure img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    cursor: zoom-in;
    transition: transform 0.25s ease-out;
}

.onenote-figure img:hover {
    transform: scale(1.01);
}

.onenote-figure figcaption {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 12px;
    font-style: italic;
}

/* ==========================================================================
   5. Right Panel: Genealogy Tools Hub
   ========================================================================== */
.onenote-right-panel {
    width: 340px;
    background-color: var(--bg-panel);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: width var(--transition-speed), border-color var(--transition-speed), background-color var(--transition-speed);
}

.onenote-right-panel.collapsed {
    width: 0;
    border-left: none;
    overflow: hidden;
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    background-color: var(--bg-sidebar);
}

.panel-tab-btn {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-speed), border-color var(--transition-speed);
}

.panel-tab-btn:hover {
    color: var(--primary);
    background-color: rgba(0, 0, 0, 0.02);
}

body.dark-theme .panel-tab-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.02);
}

.panel-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background-color: var(--bg-panel);
}

body.dark-theme .panel-tab-btn.active {
    color: #ffffff;
    border-bottom-color: var(--accent);
}

.panel-tab-btn i {
    width: 16px;
    height: 16px;
}

.panel-contents {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel-tab-content {
    display: none;
}

.panel-tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.panel-contents h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-main);
}

.tab-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.4;
}

/* Tool Widgets Styling */
.tool-group {
    margin-bottom: 16px;
}

.tool-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.tool-group input, .tool-group select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition-speed);
}

.tool-group input:focus, .tool-group select:focus {
    border-color: var(--primary);
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button input {
    flex: 1;
}

.purple-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0 16px;
    height: 36px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color var(--transition-speed);
}

.purple-btn:hover {
    background-color: var(--primary-hover);
}

.btn-full {
    width: 100%;
}

/* Results box */
.solve-result-box {
    margin-top: 20px;
    padding: 16px;
    background-color: rgba(92, 45, 145, 0.05);
    border: 1px solid rgba(92, 45, 145, 0.15);
    border-radius: var(--radius-md);
    animation: slideDown 0.25s ease-out;
}

.result-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.result-val {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    margin: 4px 0 10px 0;
}

body.dark-theme .result-val {
    color: #c7a4ee;
}

.result-path {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-path i {
    width: 12px;
    height: 12px;
}

.path-node {
    padding: 2px 6px;
    background-color: var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-main);
}

.path-node.target {
    background-color: var(--primary);
    color: white;
}

.result-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
}

.quick-links-list {
    margin-top: 24px;
}

.quick-links-list h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.quick-links-list ul {
    list-style: none;
}

.quick-links-list li {
    margin-bottom: 6px;
}

.quick-links-list a {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
}

.quick-links-list a:hover {
    text-decoration: underline;
}

/* OCR Sandbox Specific Styling */
.ocr-preview-container {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 6px;
    background-color: var(--bg-card);
    margin-bottom: 16px;
}

.ocr-image-frame {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ocr-image-frame img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0.85;
}

.ocr-scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(92, 45, 145, 0) 0%,
        rgba(92, 45, 145, 0.4) 50%,
        rgba(92, 45, 145, 0) 100%
    );
    border-top: 2px solid #a881d8;
    pointer-events: none;
    animation: scanAnimation 2s linear infinite;
    z-index: 2;
}

@keyframes scanAnimation {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.ocr-output-box {
    margin-top: 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ocr-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    font-weight: 600;
}

#ocr-copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
}

#ocr-copy-btn:hover {
    color: var(--primary);
    background-color: rgba(0,0,0,0.05);
}

.ocr-text-pre {
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background-color: var(--bg-card);
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-all;
    height: 150px;
    overflow-y: auto;
}

/* ==========================================================================
   6. Image Zoom Lightbox
   ========================================================================== */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 75vh;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

#lightbox-caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 16px 0;
    font-size: 1.1rem;
    font-family: var(--font-heading);
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 36px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color var(--transition-speed);
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
}
