/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Font Stacks */
    --font-family-default: 'Calibri', 'Google Sans', 'Product Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-family-gmail: 'Google Sans', Roboto, RobotoDraft, Helvetica, Arial, sans-serif;
    --font-family-gemini: "Google Sans", "Helvetica Neue", sans-serif;
    --font-family-google: "Google Sans", "Roboto", "Helvetica Neue", Arial, sans-serif;
    --font-family-uisans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica, "Apple Color Emoji", "Noto Sans Arabic", "Noto Sans Hebrew", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
    --font-family-cascadiacode: 'Cascadia Code', 'Cascadia Mono', Consolas, 'Courier New', monospace;
    
    /* Gemini Font Variables */
    --gemini-font-weight-regular: 400;
    --gemini-font-weight-medium: 500;
    --gemini-font-opsz: 14;
    
    /* Text Sizing */
    --text-size-body: 1rem;
    --text-size-label: 0.875rem;
    --line-height-comfortable: 1.6;
    --line-height-gemini: clamp(1.4, 1.5, 1.6);
    
    /* Accent Colors */
    --accent-cyan: #00d4ff;
    --accent-purple: #9333ea;
    
    /* Material Design System Colors - Light Mode */
    --md-sys-color-surface: #F8F9FA;
    --md-sys-color-primary: #0B57D0;
    --md-sys-color-on-surface: #1F1F1F;
    --md-sys-color-outline: #747775;
    
    /* Material Design System Colors - Dark Mode */
    --md-sys-color-surface-dark: #131314;
    --md-sys-color-primary-dark: #A8C7FA;
    --md-sys-color-on-surface-dark: #E3E3E3;
    --md-sys-color-outline-dark: #8E918F;
    
    /* Active font (defaults to font1) */
    --active-font-family: var(--font-family-default);
    --active-line-height: 1.6;
}

body {
    font-family: var(--active-font-family);
    line-height: var(--active-line-height);
    color: var(--md-sys-color-on-surface);
    font-size: var(--text-size-body);
    background-color: var(--md-sys-color-surface);
}

/* Gradient text utility class */
.aura {
    -webkit-text-fill-color: transparent;
    /* background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple)); */
    background: #086dd6;
    -webkit-background-clip: text;
    background-clip: text;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Font Theme Classes */
body.font-theme-font1 {
    --active-font-family: var(--font-family-default);
    --active-line-height: 1.6;
}

body.font-theme-gmail {
    --active-font-family: var(--font-family-gmail);
    --active-line-height: 1.5;
}

body.font-theme-gemini {
    --active-font-family: var(--font-family-gemini);
    --active-line-height: 1.5;
}

body.font-theme-gemini * {
    font-weight: var(--gemini-font-weight-regular);
    font-optical-sizing: var(--gemini-font-opsz);
}

body.font-theme-google {
    --active-font-family: var(--font-family-google);
    --active-line-height: 1.5;
}

body.font-theme-uisans {
    --active-font-family: var(--font-family-uisans);
    --active-line-height: 1.5;
    color: #2c2c2b;
    font-size: 16px;
}

body.font-theme-cascadiacode {
    --active-font-family: var(--font-family-cascadiacode);
    --active-line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #E5EDFF;
}

.login-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container h1 {
    margin: 0;
    font-size: 1.125rem;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group select,
.form-group .font-select-dropdown {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #999;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #f5f5f5;
    color: #2c3e50;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.form-group select:hover,
.form-group .font-select-dropdown:hover {
    background: #e8e8e8;
}

.form-group select:focus,
.form-group .font-select-dropdown:focus {
    outline: none;
    background: #e8e8e8;
    border-color: #0B57D0;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

.login-container button {
    width: 100%;
    padding: 0.75rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.login-container button:hover {
    background: #2980b9;
}

/* App Page */
.app-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: #EEEEEE;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(0.5rem + 4px) 2rem calc(0.5rem + 3px) 1rem;
    background: #eeeeee;
    color: #2c3e50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Font Selector Dropdowns in Header */
.font-selector-dropdowns {
    display: flex;
    gap: 0.5rem;
    margin-right: 0.5rem;
    align-items: center;
}

.page-margin-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.page-margin-icon {
    width: 14px;
    height: 14px;
    color: #666;
    flex-shrink: 0;
    position: absolute;
    left: 0.35rem;
    z-index: 1;
    pointer-events: none;
}

#pageMarginSelect {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
    padding-left: 25px !important;
}

/* Tab space wrapper and icon */
.tab-space-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.tab-space-icon {
    width: 14px;
    height: 14px;
    color: #666;
    flex-shrink: 0;
    position: absolute;
    left: 0.35rem;
    z-index: 1;
    pointer-events: none;
}

/* Tab space select styling */
#tabSpaceSelect {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    padding-left: 1.75rem !important;
}

/* Override font-select-dropdown width for page margin select */
#pageMarginSelect.font-select-dropdown {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
}

.font-select-dropdown {
    padding: 0.35rem 0.75rem;
    border: 1px solid #999;
    border-radius: 4px;
    font-size: 0.875rem;
    background: #f5f5f5;
    color: #2c3e50;
    cursor: pointer;
    min-width: 90px;
    max-width: 90px;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

/* Specifically target the font dropdown in doc header */
#regularFontSelect,
.font-selector-dropdowns .font-select-dropdown {
    min-width: 100px !important;
    max-width: 100px !important;
    width: 100px !important;
}

.font-select-dropdown:hover {
    background: #e8e8e8;
}

.font-select-dropdown:focus {
    outline: none;
    background: #e8e8e8;
}

/* Fonts Tab Layout */
.fonts-tab-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 1rem;
    height: 100%;
    max-height: 400px;
    overflow: hidden;
}

.fonts-list-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Create New Font Button */
.create-font-btn {
    background: #45a049;
    color: white;
    border: none;
    padding: 0.625rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(69, 160, 73, 0.2);
    flex-shrink: 0;
    margin-bottom: 0.75rem;
}

.create-font-btn:hover {
    background: #3d8b40;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(69, 160, 73, 0.3);
}

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

/* Scrollable container for font sections */
.fonts-list-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1rem 0 0;
    min-height: 0;
}

/* Font Sections */
.font-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.font-section-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fonts-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 0;
}

.font-template-item {
    padding: 0.375rem 0.625rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.font-template-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.font-template-item.selected {
    border-color: #3b82f6;
    background: #dbeafe;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* System Font Template Styling */
.font-template-item.system {
    background: #f5f5f4;
    border-color: #d6d3d1;
}

.font-template-item.system:hover {
    background: #e7e5e4;
    border-color: #a8a29e;
}

.font-template-item.system.selected {
    background: #e7e5e4;
    border-color: #78716c;
    box-shadow: 0 0 0 3px rgba(120, 113, 108, 0.1);
}

.font-template-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.font-template-item.system .font-template-name {
    color: #57534e;
}

.font-maker-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Font Editor Header */
.font-editor-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.font-editor-header h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.system-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: #78716c;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.font-maker-column h3 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.font-maker-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    min-height: 0; /* Allow flex shrinking */
    gap: 0.75rem;
    padding: 0 1rem 0 0;
}

.font-maker-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.font-maker-row label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.font-maker-row input[type="text"],
.font-maker-row select.font-base-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    font-family: monospace;
    transition: border-color 0.2s;
}

.font-maker-row input[type="text"]:focus,
.font-maker-row select.font-base-select:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

.font-maker-row input[type="text"]:disabled,
.font-maker-row select.font-base-select:disabled {
    background: #f3f4f6;
    color: #374151;
    cursor: not-allowed;
}

.font-maker-row input[type="checkbox"] {
    margin-right: 0.5rem;
}

.font-maker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

.save-template-btn,
.reset-template-btn,
.duplicate-template-btn,
.delete-template-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.save-template-btn {
    background-color: #1A73E8;
    color: white;
}

.save-template-btn:hover {
    background-color: #1557b0;
}

.duplicate-template-btn {
    background-color: #3b82f6;
    color: white;
}

.duplicate-template-btn:hover {
    background-color: #2563eb;
}

.delete-template-btn {
    background-color: #ef4444;
    color: white;
}

.delete-template-btn:hover {
    background-color: #dc2626;
}

.reset-template-btn {
    background-color: #f5f5f5;
    color: #666;
}

.reset-template-btn:hover {
    background-color: #e0e0e0;
}

/* Font Context Menu */
.font-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 120px;
    padding: 0.2rem 0;
}

.font-context-menu .context-menu-item {
    display: block;
    width: 100%;
    padding: 0.35rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.875rem;
    color: #2c3e50;
    cursor: pointer;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f5f5f5;
}

.context-menu-item:disabled {
    color: #999;
    cursor: not-allowed;
}

.header-search-wrapper {
    position: relative;
    display: inline-block;
    margin-top: -3px;
    margin-left: 20px;
}

.header-search {
    padding: calc(0.5rem + 5px) 4rem calc(0.5rem + 5px) 0.75rem;
    border: 1px solid #D5D5D5;
    border-radius: 20px;
    font-size: 0.875rem;
    font-family: 'Google Sans', Arial, sans-serif;
    width: 370px;
    max-width: 400px;
    background: #D5D5D5;
    color: #2c3e50;
}

.header-search:focus {
    outline: none;
    border: 2px solid #1a73e8;
    padding: calc(0.5rem + 5px - 1px) 2.5rem calc(0.5rem + 5px - 1px) calc(0.75rem - 1px);
}

.header-search::placeholder {
    color: #999;
}

.clear-search-btn {
    position: absolute;
    right: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.clear-search-btn:hover {
    background-color: #d0d0d0;
}

.clear-search-btn svg {
    width: 25px !important;
    height: 25px !important;
    min-width: 25px !important;
    min-height: 25px !important;
    fill: #4A4A4A !important;
    filter: none !important;
    opacity: 1 !important;
}

.clear-search-btn svg path {
    fill: #4A4A4A !important;
    stroke: none !important;
}

.clear-search-btn:hover svg {
    fill: #4A4A4A !important;
    opacity: 1 !important;
}

.clear-search-btn:hover svg path {
    fill: #4A4A4A !important;
}

.pending-sync-indicator {
    position: absolute;
    right: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #ff6b6b;
    cursor: help;
    z-index: 10;
}

.pending-sync-indicator svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.pending-sync-indicator:hover svg {
    opacity: 1;
}

.search-icon-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.search-icon-btn:hover {
    background-color: #d0d0d0;
}

.search-icon-btn svg {
    width: 20px;
    height: 20px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.archive-btn {
    background: white;
    color: #333;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.9rem;
    width: 100%;
    text-align: left;
    transition: background 0.2s;
    display: block;
}

.archive-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.settings-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4a4a;
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    overflow: hidden;
}

.settings-icon-btn:hover {
    background-color: #E0E0E0;
}

.settings-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: #4a4a4a;
}

.admin-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4a4a;
    border-radius: 50%;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.admin-icon-btn:hover {
    background-color: #E0E0E0;
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.admin-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: #4a4a4a;
}

/* Archive button hidden on desktop - now in profile dropdown */
.archive-icon-btn.desktop-only {
    display: none !important;
}

.archive-icon-btn {
    background: #e0e0e0;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4a4a;
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.archive-icon-btn:hover {
    background-color: #c4c4c4;
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.archive-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: #4a4a4a;
}

.help-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4a4a;
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    overflow: hidden;
}

.help-icon-btn:hover {
    background-color: #E0E0E0;
}

.help-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: #4a4a4a;
}

.report-issue-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4a4a;
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    overflow: hidden;
}

.report-issue-icon-btn:hover {
    background-color: #E0E0E0;
}

.report-issue-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: #4a4a4a;
}

.editor-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4a4a;
    margin-left: 0.35rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    overflow: hidden;
}

.editor-icon-btn:hover {
    background-color: #E0E0E0;
}

.editor-icon-btn svg {
    width: 20px;
    height: 20px;
    stroke: #4a4a4a;
}

.editor-icon-btn.active {
    background-color: #E0E0E0;
}

/* User profile button - shows picture or initials (same circle size as header icon buttons) */
.user-profile-btn {
    background: #9ca3af;
    border: none;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-left: 0.35rem;
    border-radius: 50%;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
    padding: 0;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.user-profile-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.user-profile-btn .profile-picture {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-profile-btn .profile-initials {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
}

/* Sign out button hidden on desktop - now in profile dropdown */
.signoff-icon-btn.desktop-only {
    display: none !important;
}

.signoff-icon-btn {
    background: #e0e0e0;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a4a4a;
    margin-left: 0.35rem;
    border-radius: 50%;
    position: relative;
    z-index: 1;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.signoff-icon-btn:hover {
    background-color: #c4c4c4;
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}

.signoff-icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: #4a4a4a;
    stroke-width: 2;
}

.user-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-icon-btn:hover {
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.user-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 1000;
    overflow: hidden;
    animation: fadeInDown 0.2s ease-out;
}

.user-menu.show {
    display: block;
}

.user-menu-item {
    display: block;
    padding: 0.4rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    text-align: left;
}

.user-menu-item:hover {
    background: #f5f5f5;
}

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

/* App Container */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding-left: 10px;
    position: relative;
    background-color: #eeeeee;
}

/* Left gutter: #eeeeee strip straight down, aligned with row 2 and panels */
.app-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 10px;
    height: 100%;
    background: #eeeeee;
    pointer-events: none;
    z-index: 0;
}

/* Blue line under row 2 (toolbar), starts flush with white pane-headers and panel 1 (after 10px strip); panels 1–3 sit below */
.app-container::after {
    content: '';
    position: absolute;
    top: calc(2.8rem - 2px);
    left: 10px;
    width: calc(100% - 10px);
    height: 5px;
    background: #36A0F4;
    pointer-events: none;
    z-index: 1;
}

/* Panes */
.pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #d3d3d3;
    overflow: hidden;
}

/* Reduce border width to minimize spacing between panes */
.left-pane {
    border-right: 1px solid #d3d3d3;
    transition: width 0.2s ease-out, min-width 0.2s ease-out;
}

.left-pane .pane-header {
    transition: opacity 0.1s ease-out;
}

.middle-pane {
    border-right: 1px solid #d3d3d3;
    box-shadow: none; /* Removed right shadow */
    transition: width 0.2s ease-out, min-width 0.2s ease-out;
    overflow: hidden;
    opacity: 1;
    position: relative;
    z-index: 1;
}

.middle-pane .pane-header {
    transition: opacity 0.1s ease-out;
}

/* Disable transitions during initial load to prevent layout shifts */
.left-pane.no-transition,
.middle-pane.no-transition,
.main-pane.no-transition,
.pane.no-transition,
.app-container.no-transition .left-pane,
.app-container.no-transition .middle-pane,
.app-container.no-transition .main-pane,
.app-container.no-transition .pane {
    transition: none !important;
}

.middle-pane.hiding {
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
}

.pane:last-child {
    border-right: none;
}

.pane-header {
    padding: 3px 1rem;
    background: white;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 2px 2px 0 0;
}

/* Topic header (left pane) */
.left-pane .pane-header {
    min-height: 2.8rem;
    padding-left: 0.25rem;
    padding-right: 0.5rem;
    border-radius: 12px 0 0 0;
}

/* Sub-topic header (middle pane) */
.middle-pane .pane-header {
    min-height:2.8rem;
    border-radius: 2px 0 0 0;
}

/* Docs header (main pane) */
.main-pane .pane-header {
    min-height: 2.8rem;
    justify-content: flex-start;
    padding-left: 3px;
}

.header-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.header-buttons-left {
    display: flex;
    gap: 0;
    align-items: center;
    flex-wrap: nowrap;
    overflow: visible;
}

/* Microsoft Word style toolbar groups */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    padding-right: 0.5rem;
    border-right: 1px solid #d0d0d0;
    position: relative;
    overflow: visible;
}

.toolbar-group:last-child {
    border-right: none;
    padding-right: 0;
    margin-left: auto;
    overflow: visible;
}

/* Remove border from new toolbar groups - they use dividers instead */
.new-toolbar {
    border-right: none !important;
    padding-right: 0 !important;
}

/* Bullet List Dropdown */
.bullet-list-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 2px;
}

.bullet-list-btn {
    display: flex;
    align-items: center;
    gap: 0;
    width: auto;
    min-width: 40px;
    padding: 0 4px !important;
}

.bullet-list-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 180px;
    flex-direction: column;
}

.bullet-list-dropdown.show {
    display: flex !important;
}

.bullet-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.bullet-list-item:hover {
    background: #f5f5f5;
}

.bullet-list-item span {
    color: #333;
}

.bullet-list-icon-slot {
    width: 26px;
    min-width: 26px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.bullet-list-item[data-action="header"] .bullet-list-icon-slot {
    font-weight: 600;
}

.bullet-list-item-icon {
    flex-shrink: 0;
    color: inherit;
}

.bullet-list-item-icon-code {
    width: 24px;
    height: 24px;
}

/* Format style dropdown: B + Bold, Italic, Underline, Strikethrough */
.format-style-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 2px;
}

.format-style-btn,
.math-btn {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 4px !important;
}

.format-style-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 140px;
    flex-direction: column;
}

.format-style-dropdown.show {
    display: flex !important;
}

.format-style-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.format-style-item:hover {
    background: #f5f5f5;
}

/* Math dropdown: ∑ + Superscript, Subscript, Square root, symbols */
.math-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 2px;
}

.math-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 160px;
    max-height: 70vh;
    overflow-y: auto;
    flex-direction: column;
}

.math-dropdown.show {
    display: flex !important;
}

.math-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.math-item:hover {
    background: #f5f5f5;
}

.math-dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 0.25rem 0.5rem;
}

/* Image dropdown: Image from http, Image from upload */
.image-wrapper {
    position: relative;
    display: inline-block;
    margin-right: 2px;
}

.image-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 160px;
    flex-direction: column;
}

.image-dropdown.show {
    display: flex !important;
}

.image-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.image-item:hover {
    background: #f5f5f5;
}

/* Highlight dropdown: color swatches */
.highlight-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.35rem;
    z-index: 10000;
    min-width: 140px;
    flex-direction: column;
}

.highlight-dropdown.show {
    display: flex !important;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 8px 0.35rem 0.5rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.highlight-item:hover {
    background: #f5f5f5;
}

.highlight-swatch {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}

/* Table picker: grid to choose columns × rows, header checkbox */
.table-picker {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    z-index: 10000;
    flex-direction: column;
    gap: 0.35rem;
}
.table-picker.show {
    display: flex !important;
}
.table-picker-header-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.8125rem;
    color: #333;
    cursor: pointer;
    user-select: none;
}
.table-picker-header-row input { margin: 0; }
.table-picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 17px);
    grid-template-rows: repeat(5, 17px);
    gap: 1px;
}
.table-picker-cell {
    width: 17px;
    height: 17px;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #e0e0e0; /* grey: buffer/unselected */
    pointer-events: auto;
}
.table-picker-cell.selected {
    background: #b3e5fc; /* blue: body / all when no header */
}
.table-picker-cell.selected.header {
    background: #FFF59D; /* yellow: header row when "Header row" checked */
}
.table-picker-size {
    font-size: 0.75rem;
    color: #666;
}
.table-picker-cancel {
    margin-top: 0.2rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #f5f5f5;
    color: #333;
    cursor: pointer;
}
.table-picker-cancel:hover {
    background: #eee;
}

/* Highlight icon: scale up without changing button size (transform doesn't affect layout) */
.highlight-btn {
    overflow: visible;
}
.highlight-btn svg {
    transform: scale(1.25);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: #d0d0d0;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.header-buttons-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    position: relative;
}

.pane-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Topics/Search Tabs */
.topics-tabs {
    display: flex;
    gap: 0.25rem;
}

.topics-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: calc(3px + 0.25rem) 0.65rem 0.25rem calc(0.65rem + 0px);
    font-size: 0.875rem;
    font-weight: 500;
    color: #000;
    cursor: pointer;
    border-bottom: 5px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: -5px;
    position: relative;
}

.topics-tab.active {
    color: #000;
    font-weight: 500;
    background-color: #d0d0d0;
    border-radius: 6px 6px 0 0;
    padding: calc(3px + 0.25rem) 0.65rem 0.25rem calc(0.65rem + 0px);
    border-bottom-color: transparent;
}

.topics-tab.active::after {
    display: none;
}

.topics-tab:hover {
    opacity: 0.7;
}

.topics-tab-home-icon {
    width: 1.05rem;
    height: 1.05rem;
    display: block;
}

/* Actions Dropdown */
.actions-dropdown {
    position: relative;
}

/* + Create button: match doc toolbar dropdowns (B, ∑, list) */
.actions-btn-wrapper {
    position: relative;
    display: inline-block;
}

.actions-btn {
    background: #4CAF50;
    border: 1px solid transparent;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 4px;
    min-width: 40px;
    height: 28px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    color: white;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.actions-btn-plus {
    line-height: 1;
    flex-shrink: 0;
    padding-left: 2px;
    padding-right: 6px;
    position: relative;
    top: -1px;
}

.actions-btn-divider {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
    margin: 0 2px;
}

.actions-btn-caret {
    flex-shrink: 0;
    margin-left: 0;
    opacity: 0.95;
}

.actions-btn:hover {
    background: #45a049;
}

.actions-btn:active {
    background: #3d8b40;
}

/* Dropdown: match format-style-dropdown, math-dropdown, bullet-list-dropdown */
.create-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0;
    z-index: 10000;
    min-width: 160px;
    width: max-content;
    max-width: 200px;
    flex-direction: column;
}

.create-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 8px 0.4rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    color: #333;
    transition: background-color 0.15s ease;
}

.create-dropdown .dropdown-item:hover {
    background: #f5f5f5;
}

.create-dropdown .dropdown-item:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.create-dropdown .dropdown-item:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}


/* Icon slot for create dropdown items (match bullet-list-icon-slot) */
.create-dropdown-icon-slot {
    width: 26px;
    min-width: 26px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.create-dropdown-item-icon {
    flex-shrink: 0;
    color: inherit;
}

/* Folder tree items - same font and padding as .topic-item for unified list */
.folder-tree-item {
    display: flex;
    align-items: center;
    padding: 2px 12px 2px 8px;
    margin-bottom: 0.0625rem;
    font-family: var(--active-font-family);
    font-size: 14px;
    font-weight: 500;
    color: #1f1f1f;
    line-height: 1.75rem;
    letter-spacing: 0;
    cursor: pointer;
    position: relative;
    background: white;
    border: none;
    border-radius: 0;
    transition: background 0.3s, border-radius 0.3s;
    overflow: hidden;
}

/* Indent: +20px per level so subfolder +/- aligns with parent's folder icon (20px slot) */
.folder-tree-item.indent-1 { padding-left: 28px; }
.folder-tree-item.indent-2 { padding-left: 48px; }
.folder-tree-item.indent-3 { padding-left: 68px; }

.topic-item.indent-1 { padding-left: 28px; }
.topic-item.indent-2 { padding-left: 48px; }
.topic-item.indent-3 { padding-left: 68px; }

.folder-tree-item:hover {
    background: #f0f0f0;
}

/* +/- slot: 20px so folder icon and doc icon align. Same width for expand or spacer. */
.folder-expand-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    flex-shrink: 0;
    cursor: pointer;
    /* Ensure expand receives clicks (e.g. if a parent ever uses pointer-events) */
    pointer-events: auto;
}

/* Same effective width as .folder-expand-icon (16px + 4px margin) so icons/text align */
.folder-expand-spacer {
    flex: 0 0 20px;
}

.folder-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    flex-shrink: 0;
    display: block; /* avoid inline SVG extra space so trash aligns with folder/draft */
}

/* Shared topic icon (message/shield) in Shared folder - same size as .doc-icon for alignment */
.topic-item .shared-topic-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.topic-item .shared-topic-icon svg {
    width: 100%;
    height: 100%;
}

/* Document icon for topic/documents list - same size and spacing as .folder-icon for alignment */
.topic-item .doc-icon {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    flex-shrink: 0;
    display: block;
}

/* Default doc icon (overrides inline SVG attributes so sticky/shared can override) */
.topic-item .doc-icon rect {
    fill: #E0E0E0 !important;
    stroke: #999 !important;
}
.topic-item .doc-icon line {
    stroke: #999 !important;
}

/* Sticky: yellow doc icon – designate sticky (Y5 Cream) */
.topic-item.sticky-topic .doc-icon rect {
    fill: #FFECB3 !important;
    stroke: #FF8F00 !important;
}
.topic-item.sticky-topic .doc-icon line {
    stroke: #FF8F00 !important;
}

/* Shared: blue doc icon – designate shared doc (B2 Light) */
.topic-item.shared-topic:not(.admin-shared-topic) .doc-icon rect {
    fill: #BBDEFB !important;
    stroke: #0D47A1 !important;
}
.topic-item.shared-topic:not(.admin-shared-topic) .doc-icon line {
    stroke: #0D47A1 !important;
}

/* Admin-shared: purple doc icon (replaces left bar) */
.topic-item.shared-topic.admin-shared-topic .doc-icon rect {
    fill: #9C27B0 !important;
    stroke: #7B1FA2 !important;
}
.topic-item.shared-topic.admin-shared-topic .doc-icon line {
    stroke: #7B1FA2 !important;
}

.folder-name {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink so ellipsis follows available panel width */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-item-count {
    color: #888;
    font-size: 0.9em;
}

.folder-tree-item.selected {
    background: #e3f2fd;
}

.folder-tree-item.draggable {
    cursor: default;
    position: relative;
}

/* No padding-right on .folder-name: drag-handle is in flex flow, so no "… + white space" gap */

.folder-tree-item.draggable .drag-handle {
    flex-shrink: 0;
    min-width: 1rem;
    padding: 0 4px;
    font-size: 0.7rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    cursor: grab;
    color: #888;
    user-select: none;
}
.folder-tree-item.draggable:hover .drag-handle {
    opacity: 1;
    pointer-events: auto;
}

.folder-tree-item.draggable.dragging {
    opacity: 0.5;
}

/* Line above: insert-before (folder reorder among siblings) */
.folder-tree-item.drag-over {
    border-top: 2px solid #0B57D0;
}

/* Highlight whole row: drop document inside this folder */
.folder-tree-item.drag-over-inside {
    background: rgba(11, 87, 208, 0.1);
    box-shadow: inset 0 0 0 2px #0B57D0;
    border-radius: 4px;
}

.toggle-subtopics-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 0;
    transition: all 0.1s;
    color: #333;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: calc(0.15rem + 1px);
    padding-bottom: calc(0.2rem + 1px);
}

.toggle-subtopics-btn svg {
    width: 14px;
    height: 18px;
    transform: translateY(1px);
    stroke: #333;
}

.toggle-subtopics-btn:hover {
    background: #e1e1e1;
    border-color: #b8b8b8;
}

.toggle-subtopics-btn.active {
    background: transparent;
    border-color: transparent;
    color: #333;
}

.toggle-subtopics-btn.active:hover {
    background: #e1e1e1;
    border-color: #b8b8b8;
}

.toggle-subtopics-btn.active svg {
    stroke: #333;
}

/* Hamburger menu button (YouTube style) */
.hamburger-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
    color: #030303;
}

.hamburger-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.hamburger-menu-btn:active {
    background: rgba(0, 0, 0, 0.1);
}

/* Doc icon buttons (same style as actions-btn) */
.doc-icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 9999px;
    transition: background 0.3s;
    color: #555;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.doc-icon-btn:hover:not(:disabled) {
    background: #e9ecef;
}

.doc-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.doc-icon-btn.active {
    background: #d0d7de;
}

.actions-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
}

.actions-menu.show {
    display: block;
}

.action-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.2s;
}

.action-item:hover {
    background: #f5f5f5;
}

.action-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.action-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.edit-btn {
    padding: 0.35rem 0.875rem;
    border: 1px solid #ddd;
    border-radius: 9999px;
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #001d35;
    display: flex;
    align-items: center;
    justify-content: center;
}

.images-btn,
.mono-btn,
/* New Toolbar Format Buttons */
.new-toolbar .format-btn {
    padding: 0;
    border: 1px solid transparent !important;
    border-radius: 4px;
    font-family: 'Google Sans', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #333;
    transition: background-color 0.15s ease;
    background: transparent;
    cursor: pointer;
    position: relative;
    box-shadow: none !important;
}

.new-toolbar .format-btn.bullet-list-btn {
    width: auto;
    min-width: 40px;
    padding: 0 1px 0 4px !important;
}

.new-toolbar .format-btn.format-style-btn,
.new-toolbar .format-btn.math-btn {
    width: auto;
    min-width: 40px;
}

.new-toolbar .format-btn:hover:not(:disabled) {
    background: #f0f0f0;
    box-shadow: none;
    border-color: transparent !important;
}

.new-toolbar .format-btn:active:not(:disabled) {
    background: #e0e0e0;
    box-shadow: none;
    border-color: transparent !important;
}

.new-toolbar .format-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent !important;
}

.new-toolbar .format-btn svg {
    width: 18px;
    height: 18px;
}

.new-toolbar .format-btn.format-style-btn > svg:first-of-type {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

.new-toolbar .format-btn.format-style-btn > svg:last-of-type,
.new-toolbar .format-btn.math-btn > svg:last-of-type,
.new-toolbar .format-btn.image-btn > svg:last-of-type {
    width: 10px;
    height: 10px;
    stroke: currentColor;
}

/* Legacy button styles (kept for compatibility) */
.format-style-btn,
.math-btn,
.url-btn,
.table-btn,
.image-btn,
.emoji-btn,
/* Save and Cancel buttons - match new toolbar style */
.save-btn {
    padding: 0;
    border: 1px solid transparent !important;
    border-radius: 4px;
    font-family: 'Google Sans', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #333;
    transition: background-color 0.15s ease;
    background: transparent;
    cursor: pointer;
    position: relative;
    box-shadow: none !important;
}

.cancel-btn {
    padding: 0;
    border: 1px solid transparent !important;
    border-radius: 4px;
    font-family: 'Google Sans', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #333;
    transition: background-color 0.15s ease;
    background: transparent;
    cursor: pointer;
    position: relative;
    box-shadow: none !important;
    font-size: 12px;
    font-weight: 500;
}

/* Legacy button styles (kept for compatibility) */
.fullpage-btn,
.unformat-btn,
.header-btn,
.bullet-list-btn {
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0;
    font-family: 'Google Sans', Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    cursor: pointer;
    transition: all 0.1s;
    background: transparent;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
}


.view-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 9999px;
    font-family: 'Google Sans', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: #333;
    transition: all 0.1s;
    background: transparent;
    cursor: pointer;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #001d35;
    white-space: nowrap;
}

/* Save and Cancel buttons - match new toolbar style */
.save-btn:hover:not(:disabled),
.cancel-btn:hover:not(:disabled) {
    background: #f0f0f0;
    box-shadow: none;
    border-color: transparent !important;
}

/* Legacy hover styles (kept for compatibility) */
.images-btn:hover,
.edit-btn:hover:not(:disabled),
.mono-btn:hover:not(:disabled),
.format-style-btn:hover:not(:disabled),
.math-btn:hover:not(:disabled),
.url-btn:hover:not(:disabled),
.table-btn:hover:not(:disabled),
.image-btn:hover:not(:disabled),
.emoji-btn:hover:not(:disabled),
.fullpage-btn:hover:not(:disabled),
.unformat-btn:hover:not(:disabled),
.header-btn:hover:not(:disabled),
.bullet-list-btn:hover:not(:disabled) {
    background: #e1e1e1;
    border-color: #b8b8b8;
}

/* Tooltip Styles */
.format-btn[data-tooltip],
.save-btn[data-tooltip],
.cancel-btn[data-tooltip] {
    position: relative;
    overflow: visible;
}

/* Tooltip display - no shadow, clean style */
.format-btn[data-tooltip]:hover::after,
.new-toolbar .format-btn[data-tooltip]:hover::after,
.save-btn[data-tooltip]:hover::after,
.cancel-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip) !important;
    position: absolute !important;
    bottom: calc(100% + 8px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #333 !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    z-index: 10000 !important;
    pointer-events: none !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tooltip arrow - optional, can be removed if not needed */
.format-btn[data-tooltip]:hover::before,
.new-toolbar .format-btn[data-tooltip]:hover::before,
.save-btn[data-tooltip]:hover::before,
.cancel-btn[data-tooltip]:hover::before {
    content: '' !important;
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border: 4px solid transparent !important;
    border-top-color: #333 !important;
    z-index: 10001 !important;
    pointer-events: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Tooltip for truncated folder/doc names - ensure overflow visible on all parent elements */
#fancytree ul.fancytree-container,
#fancytree ul.fancytree-container li,
#fancytree span.fancytree-title,
#fancytree span.fancytree-node,
#fancytree span.fancytree-node.fancytree-active,
#fancytree span.fancytree-node.fancytree-active span.fancytree-title {
    overflow: visible !important;
}

.fancytree-title-text[data-tooltip] {
    position: relative;
    overflow: visible !important;
}

.fancytree-title-text[data-tooltip]:hover::after {
    content: attr(data-tooltip) !important;
    position: absolute !important;
    bottom: calc(100% + 8px) !important;
    left: 0 !important;
    background: #333 !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    z-index: 99999 !important;
    pointer-events: none !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.fancytree-title-text[data-tooltip]:hover::before {
    content: '' !important;
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    left: 8px !important;
    border: 4px solid transparent !important;
    border-top-color: #333 !important;
    z-index: 100000 !important;
    pointer-events: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Show tooltip below when item is near top */
.fancytree-title-text.tooltip-below[data-tooltip]:hover::after {
    bottom: auto !important;
    top: calc(100% + 8px) !important;
}

.fancytree-title-text.tooltip-below[data-tooltip]:hover::before {
    bottom: auto !important;
    top: calc(100% + 4px) !important;
    border-top-color: transparent !important;
    border-bottom-color: #333 !important;
}

/* Emoji picker: JS-driven fixed tooltip (not clipped by overflow) */
.emoji-picker-tooltip {
    display: none;
    position: fixed;
    left: 0;
    bottom: 0;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10050;
    pointer-events: none;
}
.emoji-picker-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
}

.images-btn:active,
.mono-btn:active:not(:disabled),
.format-style-btn:active:not(:disabled),
.math-btn:active:not(:disabled),
.url-btn:active:not(:disabled),
.table-btn:active:not(:disabled),
.highlight-btn:active:not(:disabled),
.image-btn:active:not(:disabled),
.emoji-btn:active:not(:disabled),
/* Save and Cancel buttons - match new toolbar style */
.save-btn:active:not(:disabled),
.cancel-btn:active:not(:disabled) {
    background: #e0e0e0;
    box-shadow: none;
    border-color: transparent !important;
}

.fullpage-btn:active:not(:disabled),
.unformat-btn:active:not(:disabled),
.header-btn:active:not(:disabled) {
    background: #d0d0d0;
}

.view-btn:hover:not(:disabled) {
    background: #f8f9fa;
}

.view-btn.active {
    background: white;
    color: #001d35;
    border-color: #ddd;
}

.view-btn svg,
.url-btn svg,
.image-btn svg,
.table-btn svg,
.save-btn svg:not(#saveCheckmarkIcon),
.cancel-btn svg {
    width: 18px;
    height: 18px;
}

/* Checkmark icon should be larger and not affected by the general rule */
#saveCheckmarkIcon {
    width: 24px !important;
    height: 24px !important;
}
.emoji-btn .emoji-toolbar-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    display: block;
}

.mono-btn svg,
.fullpage-btn svg,
.unformat-btn svg,
.header-btn svg,
.bullet-list-btn svg {
    width: 14px;
    height: 14px;
    stroke: #2c2c2c;
    fill: none;
}
/* format-style B uses 19px and flex-shrink:0; excluded from 14px above */

.bullet-list-btn svg circle {
    fill: #2c2c2c;
}

.bullet-list-btn svg:last-child {
    width: 10px;
    height: 10px;
    stroke: #333 !important;
}

.edit-btn.active {
    background: #A3C5FF;
    color: #001d35;
    border-color: #A3C5FF;
}

/* Doc Mode Buttons (View/Edit) */
.doc-mode-buttons-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 0.5rem;
    padding-left: 0.5rem;
}

.doc-mode-btn {
    background: #5A9FD4;
    border: none;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0 0.5rem;
    border-radius: 4px;
    transition: background 0.3s;
    color: white;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-family: 'Google Sans', Arial, sans-serif;
    font-weight: 500;
    height: 28px;
    min-width: 28px;
}

.doc-mode-btn:hover {
    background: #4A8FC4;
}

.doc-mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #7AB5DD;
}

.doc-mode-btn.active {
    background: #3A7FB4;
}

.doc-mode-btn.active:hover {
    background: #2A6FA4;
}

/* Cloud icon states (Google Docs style) - for autoSaveIcon next to cancel button */
#autoSaveIcon.saving {
    stroke: #1a73e8 !important; /* Google blue */
    animation: pulse 1.5s ease-in-out infinite;
}

#autoSaveIcon.saved {
    stroke: #34a853 !important; /* Google green */
}

#autoSaveIcon.error {
    stroke: #ea4335 !important; /* Google red */
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.mode-btn-label {
    display: inline;
}

.mode-btn-separator {
    display: inline;
    margin: 0 0.15rem;
    opacity: 0.8;
}


.view-btn:disabled,
.save-btn:disabled,
.cancel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.edit-btn:disabled,
.mono-btn:disabled,
.images-btn:disabled,
.format-style-btn:disabled,
.math-btn:disabled,
.url-btn:disabled,
.table-btn:disabled,
.image-btn:disabled,
.emoji-btn:disabled,
.fullpage-btn:disabled,
.unformat-btn:disabled,
.header-btn:disabled,
.bullet-list-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent !important;
    color: #6c757d;
}

/* Image Gallery Dialog */
.image-gallery-dialog {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 900px;
    height: 85vh;
    max-height: 85vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    animation: fadeIn 0.3s ease-out;
    overflow: hidden;
}

.image-gallery-dialog.show {
    display: block;
}

.gallery-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 85vh;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #ddd;
}

.gallery-header h2 {
    margin: 0;
    color: #2c3e50;
}

.gallery-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Gallery Tabs */
.gallery-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
}

.gallery-tab {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
}

.gallery-tab:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.gallery-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: white;
}

.gallery-tab-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.close-gallery-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 2rem;
    height: 2rem;
    line-height: 1;
    transition: color 0.3s;
}

.close-gallery-btn:hover {
    color: #333;
}

/* Emoji Picker Dialog */
.emoji-picker-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1002;
    align-items: center;
    justify-content: center;
}
.emoji-picker-dialog.show {
    display: flex;
}
.emoji-picker-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 640px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e0e0e0;
}
.emoji-picker-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2c3e50;
}
.emoji-picker-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 2rem;
    height: 2rem;
    line-height: 1;
}
.emoji-picker-close:hover {
    color: #333;
}
.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(44px, 1fr));
    gap: 4px;
    padding: 1rem;
    overflow-y: auto;
    max-height: 50vh;
}
.emoji-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.emoji-picker-item:hover {
    background: #f0f0f0;
}
.emoji-picker-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.gallery-upload-section {
    padding: 1rem;
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    min-height: 0;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #3498db;
    background: #e3f2fd;
}

.upload-area.drag-over {
    border-color: #27ae60;
    background: #d4edda;
    border-style: solid;
}

.upload-area.upload-success {
    border-color: #27ae60;
    background: #d4edda;
    border-style: solid;
}

.upload-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    text-align: center;
}

.upload-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.upload-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.upload-text {
    margin: 0.5rem 0;
    color: #666;
    font-size: 0.95rem;
}

.upload-text-small {
    margin: 0.25rem 0;
    color: #999;
    font-size: 0.85rem;
}

.upload-btn {
    margin-top: 0.5rem;
    padding: 0.5rem 1.5rem;
    border: 1px solid #3498db;
    border-radius: 9999px;
    background: #3498db;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    pointer-events: auto;
}

.upload-btn:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.gallery-grid {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    min-height: 0;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    aspect-ratio: 1;
}

.gallery-item:hover {
    border-color: #3498db;
    transform: scale(1.05);
}

.gallery-item-checkbox {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    z-index: 10;
    cursor: pointer;
    accent-color: #3498db;
}

.gallery-item.selected {
    border-color: #3498db;
    border-width: 3px;
}

.delete-selected-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e74c3c;
    border-radius: 4px;
    background: #e74c3c;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.delete-selected-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
}

.back-to-gallery-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #2c3e50;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.back-to-gallery-btn:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

.preview-image-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    min-height: 300px;
}

.preview-image-container img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preview-code {
    border-top: 1px solid #ddd;
    padding-top: 1rem;
}

.preview-code label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.code-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.code-container code {
    flex: 1;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #2c3e50;
    word-break: break-all;
}

/* Image gallery code buttons - standard blue button style */
.copy-code-btn,
.insert-code-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #1A73E8;
    border-radius: 4px;
    background: #1A73E8;
    color: white;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Google Sans', Arial, sans-serif;
    white-space: nowrap;
}

.copy-code-btn:hover:not(:disabled),
.insert-code-btn:hover:not(:disabled) {
    background: #1557b0;
    border-color: #1557b0;
}

.copy-code-btn:active:not(:disabled),
.insert-code-btn:active:not(:disabled) {
    background: #0d47a1;
    border-color: #0d47a1;
}


/* Gallery Pagination */
.gallery-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid #ddd;
    background: #f8f9fa;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 9999px;
    background: white;
    color: #2c3e50;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #3498db;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.pane-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.125rem 0.5rem;
    margin-top: 5px;
    background: white;
    border-radius: 0 0 2px 2px;
}


/* Add padding to main pane content to accommodate editor focus outline */
.main-pane .pane-content {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    background: transparent; /* Override white background from base .pane-content */
    box-shadow: none; /* Remove shadow from main pane content */
    display: flex;
    flex-direction: column;
    position: relative;
}

.docs-content-wrapper {
    flex: 1;
    overflow-y: hidden;
    background-color: #f0f0f0; /* Grey background like Word/WordPad */
    padding: 1.5rem 1rem 0 1rem;
    display: flex;
    justify-content: center;
    align-items: stretch;
    position: relative;
}

.main-pane .docs-content-wrapper.no-padding,
.pane-content .docs-content-wrapper.no-padding,
#docsContent .docs-content-wrapper.no-padding,
.docs-content-wrapper.no-padding {
    background-color: transparent !important;
    padding: 0 !important;
    padding-top: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
}

/* Add more top padding to left and middle panes */
.left-pane .pane-content,
.middle-pane .pane-content {
    padding-top: 0.25rem;
    min-height: 0;
    min-width: 0; /* allow flex child to size to pane width */
    /* do not use contain: layout — it can make the list (and thus text) size too narrow, causing early ellipsis */
}

/* Constrain left-pane list to panel width so folder/doc names truncate at panel edge */
.left-pane .pane-content {
    overflow-x: hidden;
    padding-left: 0.25rem;
}

/* Topic list items */
.topic-item {
    padding: 2px 12px 2px 8px; /* left 8px, same as folder-tree-item; ::before 20px = expand slot */
    margin-bottom: 0.0625rem;
    background: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.3s, border-radius 0.3s;
    line-height: 1.75rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #1f1f1f;
    font-weight: 500;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

/* Lead slot: 20px, same as folder expand/spacer; icon and name align (folder: 8+20; topic: 8+20) */
.topic-item::before {
    content: '';
    display: block;
    width: 20px;
    flex-shrink: 0;
}

.topic-item:hover {
    background: #f0f0f0;
}

/* Regular topics - green active background */
.topic-item.active {
    background: #D4EDDA !important; /* Green background */
    color: #2c3e50 !important;
    border: none !important;
    border-radius: 12px !important;
}

/* Sticky topics - yellow active background (doc icon colored via .topic-item.sticky-topic .doc-icon) */
.topic-item.sticky-topic.active {
    background: #FFF9C4 !important; /* Light yellow background */
    color: #2c3e50 !important;
    border: none !important; /* Reset border from .topic-item.active */
    border-radius: 12px !important;
}

/* Shared topics - light blue active background (doc icon colored via .topic-item.shared-topic .doc-icon) */
.topic-item.shared-topic.active {
    background: #E8F0FE !important; /* Light blue background */
    color: #2c3e50 !important;
    border: none !important; /* Reset border from .topic-item.active */
    border-radius: 12px !important;
}

.topic-item.draggable {
    cursor: move;
    position: relative;
    display: flex;
    align-items: center;
}

/* Fancytree active node styling - green background for selected document in panel 1 */
span.fancytree-node.fancytree-active span.fancytree-title {
    background: #D4EDDA !important;
    color: #2c3e50 !important;
    border-radius: 12px !important;
    margin-left: -8px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
}

/* Fancytree hover styling */
span.fancytree-node:hover span.fancytree-title {
    background: #f0f0f0;
    border-radius: 12px;
    margin-left: -8px;
    padding-left: 8px;
    padding-right: 8px;
}

/* Active sticky doc: yellow background, no indent (overrides green above) */
#fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node,
#fancytree span.fancytree-node.fancytree-active.sticky-doc-node,
#fancytree span.fancytree-node[data-sticky="true"].fancytree-active {
    background: #FFF9C4 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node span.fancytree-title,
#fancytree span.fancytree-node.fancytree-active.sticky-doc-node span.fancytree-title,
#fancytree span.fancytree-node[data-sticky="true"].fancytree-active span.fancytree-title {
    background: #FFF9C4 !important;
    color: #2c3e50 !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Active shared doc: blue background, no indent (overrides green above) */
#fancytree li.fancytree-active > span.fancytree-node.shared-doc-node,
#fancytree span.fancytree-node.fancytree-active.shared-doc-node,
#fancytree span.fancytree-node[data-shared="true"].fancytree-active {
    background: #E8F0FE !important;
}
#fancytree li.fancytree-active > span.fancytree-node.shared-doc-node span.fancytree-title,
#fancytree span.fancytree-node.fancytree-active.shared-doc-node span.fancytree-title,
#fancytree span.fancytree-node[data-shared="true"].fancytree-active span.fancytree-title {
    background: #E8F0FE !important;
    color: #2c3e50 !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Active admin-shared doc: purple tint, no indent (overrides green above) */
#fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node,
#fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node {
    background: #F3E5F5 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node span.fancytree-title,
#fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node span.fancytree-title {
    background: #F3E5F5 !important;
    color: #2c3e50 !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Active sticky/shared/admin doc: keep doc icon colored (override Fancytree active icon styling) */
#fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node .doc-icon rect,
#fancytree span.fancytree-node.fancytree-active.sticky-doc-node .doc-icon rect {
    fill: #FFECB3 !important;
    stroke: #FF8F00 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.sticky-doc-node .doc-icon line,
#fancytree span.fancytree-node.fancytree-active.sticky-doc-node .doc-icon line {
    stroke: #FF8F00 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.shared-doc-node .doc-icon rect,
#fancytree span.fancytree-node.fancytree-active.shared-doc-node .doc-icon rect {
    fill: #BBDEFB !important;
    stroke: #0D47A1 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.shared-doc-node .doc-icon line,
#fancytree span.fancytree-node.fancytree-active.shared-doc-node .doc-icon line {
    stroke: #0D47A1 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node .doc-icon rect,
#fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node .doc-icon rect {
    fill: #E1BEE7 !important;
    stroke: #7B1FA2 !important;
}
#fancytree li.fancytree-active > span.fancytree-node.admin-shared-doc-node .doc-icon line,
#fancytree span.fancytree-node.fancytree-active.admin-shared-doc-node .doc-icon line {
    stroke: #7B1FA2 !important;
}

/* Hover sticky/shared: no indent (overrides default hover above) */
#fancytree span.fancytree-node.sticky-doc-node:hover span.fancytree-title,
#fancytree span.fancytree-node.shared-doc-node:hover span.fancytree-title,
#fancytree span.fancytree-node.admin-shared-doc-node:hover span.fancytree-title {
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-radius: 0 !important;
}

.topic-item-text {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Required for flex items to allow shrinking */
}

.sticky-star {
    flex-shrink: 0; /* Prevent star from shrinking */
    margin-right: 0.25rem;
}

.topic-item.draggable .topic-item-text {
    flex: 1;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Required for flex items to allow shrinking */
    /* No padding-right: drag-handle is in flex flow, so no "… + white space" gap */
}

.topic-item.draggable .drag-handle {
    flex-shrink: 0;
    min-width: 1rem;
    padding: 0 4px;
    font-size: 0.7rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    color: #000;
    cursor: grab;
    user-select: none;
}
.topic-item.draggable:hover .drag-handle {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile menu icon (3 dots) for topic context menu */
.topic-mobile-menu-icon {
    display: none; /* Hidden by default (desktop) */
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0.5rem;
    margin-left: auto;
    margin-right: 0.25rem;
    cursor: pointer;
    color: #666;
    font-size: 1.25rem;
    line-height: 1;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.topic-mobile-menu-icon:active {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

/* Disabled - using breakpoint classes instead */
/* @media (max-width: 768px) {
    .topic-mobile-menu-icon {
        display: flex;
    }
    
    /* Ensure topic text doesn't overlap with icon */
    /* .topic-item:has(.topic-mobile-menu-icon) .topic-item-text {
        padding-right: 0.5rem;
    }
} */

/* Show 3-dot icons only in mobile breakpoint */
body.app-page.breakpoint-mobile .topic-mobile-menu-icon {
    display: flex !important;
}

body.app-page.breakpoint-mobile .topic-item:has(.topic-mobile-menu-icon) .topic-item-text {
    padding-right: 0.5rem;
}

.topic-item.draggable.dragging {
    opacity: 0.5;
    pointer-events: none; /* Allow drag events to pass through to folders underneath */
}

.topic-item.drag-over {
    border-top: 2px solid #0B57D0;
}

.topic-item.drag-invalid {
    opacity: 0.5;
    border-top: 2px solid #dc3545;
    background: #f8d7da;
}

.topic-item.shared-topic {
    margin-top: 0.25rem;
}

.topic-item.shared-topic:hover {
    background: #e0efff;
}

/* Note: Main .topic-item.shared-topic.active rule is defined earlier with full styling */

/* Admin shared topics override regular shared topic styles */
.topic-item.shared-topic.admin-shared-topic {
    background: #faf5fc !important; /* Very light purple background - override blue */
    border-top: 1px solid #e0e0e0;
    margin-top: 0.25rem;
}

.topic-item.shared-topic.admin-shared-topic:hover {
    background: #f3e5f5 !important; /* Slightly darker purple on hover */
}

.topic-item.shared-topic.admin-shared-topic.active {
    background: #e1bee7 !important; /* Light purple for active state */
    border-radius: 12px !important; /* Match regular topics active style */
}

.shared-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0B57D0;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: transparent;
}

.shared-icon svg {
    width: 100%;
    height: 100%;
}

/* Animate shared icon to circle when topic is active (but NOT admin shared icons) */
/* Exclude topic-share-icon from this rule */
/* DISABLED: Keep icon as blue outline, no circle background
.topic-item.shared-topic.active .shared-icon:not(.admin-shared-icon):not(.topic-share-icon) {
    background: #0B57D0;
    color: white;
    border-radius: 50%;
}
*/

/* Keep shared icon as blue outline even when active - no background circle */
.topic-item.shared-topic.active .shared-icon:not(.admin-shared-icon) {
    background: transparent !important;
    color: #0B57D0 !important;
    border-radius: 0 !important;
}

.topic-item.shared-topic.active .shared-icon:not(.admin-shared-icon) svg {
    color: #0B57D0 !important;
    stroke: #0B57D0 !important;
    fill: none !important;
}

/* Admin shared icon - purple color (must override .shared-icon) */
.topic-item.admin-shared-topic .admin-shared-icon,
.admin-shared-icon {
    color: #9C27B0 !important; /* Purple color for admin shared topics - force override */
    border-radius: 0 !important; /* Keep shield shape, no circle */
    transition: color 0.3s ease; /* Only transition color, not shape */
    background: transparent !important; /* No background, keep original shield */
}

.topic-item.admin-shared-topic .admin-shared-icon svg,
.admin-shared-icon svg {
    width: 100%;
    height: 100%;
    color: #9C27B0 !important; /* Ensure SVG inherits purple */
}

/* Admin shared icon should NOT animate to circle when active - keep it as shield */
/* Removed circle animation for admin shared topics */

/* Admin topics label - purple border */
.admin-topics-label {
    border-top-color: #9C27B0;
}

/* Admin shared topic item styling */
.admin-shared-topic {
    border-left: 2px solid #9C27B0;
    background: #f3e5f5; /* Light purple background */
}

.admin-shared-topic:hover {
    background: #e1bee7; /* Slightly darker purple on hover */
}

.admin-shared-topic.active {
    background: #ce93d8; /* Medium purple for active state */
    border-left: 2px solid #9C27B0;
}

.topics-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 0.75rem 0 0.5rem 0;
    border: none;
}

.shared-topics-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    padding: 0.25rem 0.75rem 0.15rem 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: auto;
    display: block; /* Ensure label is always visible */
    font-family: 'Google Reg Sans', Arial, sans-serif; /* Match font used in admin topics */
}

/* Sticky topics section label (at top, no margin-top: auto) */
.sticky-topics-label {
    margin-top: 0.25rem; /* Add small top margin for spacing */
    margin-bottom: 0.25rem;
    border-top: none !important; /* Remove top border */
    /* Ensure font styles match admin-topics-label exactly */
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    padding: 0.25rem 0.75rem 0.15rem 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Google Reg Sans', Arial, sans-serif; /* Match font used in admin topics */
}

/* Separator line after sticky topics section, before regular topics */
.topic-item.sticky-topic:last-of-type {
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Alternative: separator line before first regular topic */
.topic-item.sticky-topic:last-of-type + .topic-item:not(.sticky-topic) {
    border-top: 1px solid #e0e0e0;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

/* Search results section label */
.search-results-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    padding: 0.25rem 0.75rem 0.15rem 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid #e0e0e0;
    margin-top: 0;
    margin-bottom: 0.25rem;
    display: block;
}

.shared-topics-footer {
    margin-top: auto;
    padding: 0.25rem 0.5rem; /* Match .pane-content left/right padding (0.5rem) */
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    min-height: 0; /* No minimum height - only show when there's content */
}

.shared-topics-container {
    display: flex;
    flex-direction: column;
}

.left-pane {
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow flex children to shrink */
}

.left-pane .pane-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* System folders (Shared, Draft, Trash) fixed at bottom of left panel; background #eeeeee */
.system-folders-bar {
    flex-shrink: 0;
    background: #eeeeee;
    border-top: 1px solid #e0e0e0;
    overflow-y: auto;
    max-height: 35vh;
    padding: 0.25rem 0.5rem;
}
.system-folders-bar .folder-tree-item,
.system-folders-bar .topic-item {
    background: #eeeeee;
}
.system-folders-bar .folder-tree-item:hover,
.system-folders-bar .topic-item:hover {
    background: #e2e2e2;
}

/* Slightly darker count on #eee background for better contrast */
.system-folders-bar .folder-item-count {
    color: #666;
}

/* Shared folder docs: same look as regular docs (doc icon + name, no blue/purple left indicator) */
#systemFoldersBar .topic-item.shared-topic,
#systemFoldersBar .topic-item.shared-topic.admin-shared-topic {
    border-left: none !important;
    box-shadow: none !important;
    margin-top: 0;
    background: #eeeeee !important;
}
#systemFoldersBar .topic-item.shared-topic:hover,
#systemFoldersBar .topic-item.shared-topic.admin-shared-topic:hover {
    background: #e2e2e2 !important;
}
#systemFoldersBar .topic-item.shared-topic.active,
#systemFoldersBar .topic-item.shared-topic.admin-shared-topic.active {
    background: #D4EDDA !important;
    border-left: none !important;
    box-shadow: none !important;
}

.custom-sort-info {
    margin: 0.5rem 0 0 0;
    padding: 0.75rem;
    background-color: #f0f7ff;
    border-left: 3px solid #0B57D0;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    border-radius: 4px;
}

/* Sub-topic list items */
.subtopic-item {
    padding: 2px 12px 2px 8px; /* Match .topic-item padding exactly */
    margin-bottom: 0.0625rem; /* Match .topic-item spacing */
    background: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.3s, border-radius 0.3s;
    line-height: 1.75rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    color: #1f1f1f;
    font-weight: 500;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Link inside subtopic-item needs ellipsis too */
.subtopic-item a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.subtopic-item:hover {
    background: #f0f0f0;
}

.subtopic-item.active {
    background: #D4EDDA; /* Default green for regular topics */
    border: none;
    border-radius: 12px;
    font-weight: 500;
}

/* Active subtopic when parent is sticky topic (yellow) – override default green */
.subtopic-item.subtopic-sticky-parent.active {
    background: #FFF9C4 !important; /* Light yellow to match sticky topic active */
}

/* Tooltip for truncated subtopic names */
.middle-pane .pane-content {
    overflow-y: auto !important;
    overflow-x: visible !important;
}

.subtopic-item[data-tooltip] {
    position: relative;
    overflow: visible !important;
}

.subtopic-item[data-tooltip]:hover::after {
    content: attr(data-tooltip) !important;
    position: absolute !important;
    bottom: calc(100% + 8px) !important;
    left: 0 !important;
    background: #333 !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
    z-index: 99999 !important;
    pointer-events: none !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.subtopic-item[data-tooltip]:hover::before {
    content: '' !important;
    position: absolute !important;
    bottom: calc(100% + 4px) !important;
    left: 8px !important;
    border: 4px solid transparent !important;
    border-top-color: #333 !important;
    z-index: 100000 !important;
    pointer-events: none !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Show tooltip below when item is near top */
.subtopic-item.tooltip-below[data-tooltip]:hover::after {
    bottom: auto !important;
    top: calc(100% + 8px) !important;
}

.subtopic-item.tooltip-below[data-tooltip]:hover::before {
    bottom: auto !important;
    top: calc(100% + 4px) !important;
    border-top-color: transparent !important;
    border-bottom-color: #333 !important;
}

/* Active subtopic when parent is shared topic (light blue) */
.subtopic-item.subtopic-shared-parent.active {
    background: #E8F0FE !important; /* Light blue to match shared topic active */
}

/* Active subtopic when parent is admin shared topic (purple) */
.subtopic-item.subtopic-admin-shared-parent.active {
    background: #ce93d8 !important; /* Medium purple to match admin shared topic active */
}

/* Subtopic anchors in documents - bold and bigger font */
.subtopic-anchor {
    display: block;
    font-weight: bold;
    font-size: 18px;
    margin-top: 3px;
    margin-bottom: 0px;
    font-family: "Google Sans", "Product Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.7;
    color: #1f1f1f;
    letter-spacing: 0;
}

/* Mono text styling ([mono], [code]) – Consolas smaller than body */
.mono-text {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.90rem;
}

/* Comment block: [comment]...[/comment] – indent, left bar, lighter color */
.view-comment {
    padding-left: 1rem;
    margin: 0.5rem 0;
    border-left: 3px solid #b0b0b0;
    color: #888;
}

/* Code boxed: [codebox]...[/codebox] – rounded grey box, monospace */
.view-codebox {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.90rem;
    background: #e8e8e8;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
}

/* View-mode checkboxes: rounded square, subtle shadow, white check (see checkboxes.jpeg) */
.view-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    margin: 0.35rem 0;
}

.view-checkbox-label input[type="checkbox"] {
    display: none;
}

.view-checkbox-mark {
    display: inline-block;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background-color: #f5f5f5;
    border: 1.5px solid #d0d0d0;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.view-checkbox-label:hover .view-checkbox-mark {
    background-color: #ebebeb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

/* Checkmark when checked: L-shape, white on colored background */
.view-checkbox-label input:checked + .view-checkbox-mark::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Checked: solid fill + same subtle shadow */
.view-checkbox-label input:checked + .view-checkbox-mark {
    border-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Default (no color): blue, white check */
.view-checkbox-label input:checked + .view-checkbox-mark {
    background-color: #2196F3;
}

/* Color variants: -[x=color] / -[=color]. Checkmark white unless white/yellow. */
.view-checkbox-black input:checked + .view-checkbox-mark { background-color: #2c2c2c; }
.view-checkbox-black input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-grey input:checked + .view-checkbox-mark { background-color: #6b6b6b; }
.view-checkbox-grey input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-white input:checked + .view-checkbox-mark { background-color: #fff; border-color: #d0d0d0; }
.view-checkbox-white input:checked + .view-checkbox-mark::after { border-color: #2c2c2c; }

.view-checkbox-blue input:checked + .view-checkbox-mark { background-color: #2196F3; }
.view-checkbox-blue input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-green input:checked + .view-checkbox-mark { background-color: #4CAF50; }
.view-checkbox-green input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-red input:checked + .view-checkbox-mark { background-color: #f44336; }
.view-checkbox-red input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-orange input:checked + .view-checkbox-mark { background-color: #ff9800; }
.view-checkbox-orange input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-yellow input:checked + .view-checkbox-mark { background-color: #ffeb3b; border-color: #e6d32a; }
.view-checkbox-yellow input:checked + .view-checkbox-mark::after { border-color: #333; }

.view-checkbox-purple input:checked + .view-checkbox-mark { background-color: #9c27b0; }
.view-checkbox-purple input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-aqua input:checked + .view-checkbox-mark { background-color: #00bcd4; }
.view-checkbox-aqua input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-cyan input:checked + .view-checkbox-mark { background-color: #00bcd4; }
.view-checkbox-cyan input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-pink input:checked + .view-checkbox-mark { background-color: #e91e63; }
.view-checkbox-pink input:checked + .view-checkbox-mark::after { border-color: #fff; }

.view-checkbox-brown input:checked + .view-checkbox-mark { background-color: #795548; }
.view-checkbox-brown input:checked + .view-checkbox-mark::after { border-color: #fff; }

/* BBCode table styling */
.bbcode-table {
    width: auto;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 1rem 0;
}

.bbcode-table-auto {
    width: 100%;
    table-layout: auto;
}

.bbcode-table-consolas {
    font-family: Consolas, 'Courier New', monospace;
}

.bbcode-table-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-align: left;
    color: #1f1f1f;
}

.bbcode-table thead {
    background-color: #f5f5f5;
}

.bbcode-table th {
    padding: 0.25rem 0.75rem;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid #bbb;
}

.bbcode-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #ccc;
}

.bbcode-table tbody tr:hover {
    background-color: #f9f9f9;
}

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

/* Docs viewer and editor */
.docs-viewer {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.75rem;
    font-size: 14px;
    color: #1f1f1f;
    font-weight: 500;
    letter-spacing: 0;
    padding: 0.25rem 1rem 1rem 1rem;
    background-color: white;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 95%;
    margin: 0 auto 0 auto;
    min-height: auto;
    padding-bottom: 1.5rem;
}

.docs-viewer h3 {
    font-size: 18px;
    font-weight: 500;
    margin: 1.5rem 0 0.75rem 0;
    color: #202124;
    line-height: 1.4;
}

.docs-viewer h3:first-child {
    margin-top: 0;
}

.docs-editor {
    width: 100%;
    min-height: auto;
    padding: 1rem;
    padding-bottom: 1.5rem;
    border: none;
    border-radius: 0;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.75rem;
    font-weight: 500;
    letter-spacing: 0;
    resize: none;
    color: #1f1f1f;
    background-color: #f5e6d3;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    max-width: 95%;
    margin: 0 auto 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.docs-editor:focus {
    outline: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 2px #0B57D0;
}


/* Find Controls */
.find-controls {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the buttons in the middle of the doc panel */
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    position: sticky;
    bottom: 0;
    z-index: 10;
    flex-shrink: 0;
}

.find-btn {
    background: #1A73E8;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    font-family: 'Google Sans', Arial, sans-serif;
}

.find-btn:hover {
    background: #1557b0;
}

.find-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.find-counter {
    font-size: 0.875rem;
    color: #666;
    font-family: 'Google Sans', Arial, sans-serif;
}

/* Search highlight */
.search-highlight {
    background-color: #FFF3C2;
    padding: 2px 0;
    border-radius: 2px;
}

.search-highlight.active {
    background-color: #D4C4FB;
    color: #1a1a1a;
    padding: 2px 0;
    border-radius: 2px;
}

/* Default pane widths (will be overridden by JavaScript) */
.left-pane {
    width: 18%;
    min-width: 240px;
}

.middle-pane {
    width: 12%;
    min-width: 200px;
}

.main-pane {
    width: 70%;
    min-width: 300px;
    /* No transition - expands instantly when side panels hide */
}

/* Context Menu */
.context-menu {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    min-width: 120px;
    overflow: hidden;
    font-family: 'Google Reg Sans', Arial, sans-serif;
}

/* Folder tree context menu (Fancytree) - compact like topic menu */
.folder-context-menu.context-menu {
    padding: 0.2rem 0;
}

/* Black pencil icon for Rename (all context menus: topic, folder, Fancytree) */
.context-menu .ctx-icon-pencil,
.folder-context-menu .ctx-icon-pencil {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    vertical-align: middle;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231f1f1f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.context-menu.show {
    display: block;
}

.context-menu .context-menu-item {
    display: block;
    width: 100%;
    padding: 0.4rem 1rem;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #2c3e50;
    transition: background 0.2s;
}

.context-menu .context-menu-item:hover {
    background: #f8f9fa;
}

.context-menu .context-menu-item:disabled {
    color: #888;
    cursor: not-allowed;
    opacity: 0.85;
}

.context-menu .context-menu-item:disabled:hover {
    background: white;
    cursor: not-allowed;
}

.context-menu .context-menu-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.context-menu .context-menu-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Yellow ball indicator for context menu items */
.context-menu-item .yellow-ball,
.context-menu-item span.yellow-ball,
#toggleStickyContext .yellow-ball,
#ctxSticky .yellow-ball,
button.context-menu-item .yellow-ball,
button#toggleStickyContext .yellow-ball,
button#ctxSticky .yellow-ball,
#toggleStickyContext span.yellow-ball,
#ctxSticky span.yellow-ball,
button#toggleStickyContext span.yellow-ball,
button#ctxSticky span.yellow-ball {
    display: inline-block !important;
    width: 8px !important;
    height: 8px !important;
    min-width: 8px !important;
    min-height: 8px !important;
    background-color: #FFC107 !important;
    background: #FFC107 !important;
    border-radius: 50% !important;
    margin-right: 6px !important;
    vertical-align: middle !important;
    border: none !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
    color: transparent !important;
    opacity: 1 !important;
}

/* Blue ball indicator for Share It */
.context-menu-item .blue-ball,
.context-menu-item span.blue-ball,
#shareTopicContext .blue-ball,
#ctxShare .blue-ball,
button.context-menu-item .blue-ball,
button#shareTopicContext .blue-ball,
button#ctxShare .blue-ball {
    display: inline-block !important;
    width: 8px !important;
    height: 8px !important;
    background-color: #0B57D0 !important;
    background: #0B57D0 !important;
    border-radius: 50% !important;
    margin-right: 6px !important;
    vertical-align: middle !important;
    border: none !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
    color: transparent !important;
    opacity: 1 !important;
}

/* Create Topic Dialog */
/* Light toast message (folder delete, etc.) - like docs, non-intrusive */
.app-light-message {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 18px;
    font-size: 14px;
    color: #fff;
    background: rgba(50, 50, 50, 0.92);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    max-width: 90vw;
}
.app-light-message.show {
    opacity: 1;
    visibility: visible;
}

.create-dialog,
.delete-dialog,
.rename-dialog,
.archive-dialog,
.dialog {
    display: none;
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 320px;
    max-width: 90vw;
    background: white !important;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    animation: fadeIn 0.3s ease-out;
    bottom: auto !important;
    right: auto !important;
    overflow: hidden;
}

/* Confirm, Alert, Delete dialogs – slightly wider for comfortable button spacing */
.delete-dialog {
    width: 360px;
}

/* Share List Dialog - larger size */
#shareListDialog {
    width: 550px;
    max-width: 90vw;
}

.create-dialog.show,
.delete-dialog.show,
.archive-dialog.show,
.rename-dialog.show,
.dialog.show {
    display: block;
}

/* Dialog backdrop overlay */
.create-dialog::before,
.delete-dialog::before,
.rename-dialog::before,
.archive-dialog::before,
.dialog::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    display: none;
}

.create-dialog.show::before,
.delete-dialog.show::before,
.rename-dialog.show::before,
.archive-dialog.show::before,
.dialog.show::before {
    display: block;
}

.dialog-content {
    padding: 0;
    background: white !important;
}

.dialog-content h2 {
    margin: 0;
    padding: 0.75rem 1rem;
    background-color: #F2F2F2;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
}

.dialog-content form {
    padding: 0.5rem 1rem 1rem;
}

.dialog-content p {
    padding: 0.75rem 1rem 0;
}

.dialog-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0;
    justify-content: flex-end;
}

#draftChoiceDialog .dialog-content {
    padding: 1.5rem;
}

#draftChoiceDialog .dialog-buttons {
    margin-left: 0;
    margin-right: 0;
}

.dialog-buttons-stack {
    flex-direction: column;
    align-items: stretch;
    margin-top: 0;
}

.dialog-buttons button {
    padding: 0.65rem 0.875rem;
    border: 1px solid #ddd;
    border-radius: 9999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #2c3e50;
    font-weight: 500;
}

.dialog-buttons button.btn-primary {
    background: #1a73e8;
    color: white;
    border: 1px solid #1a73e8;
}

.dialog-buttons button.btn-primary:hover {
    background: #1557b0;
    border-color: #1557b0;
}

.dialog-buttons button.btn-destructive {
    background: #c5221f;
    color: white;
    border: 1px solid #c5221f;
}

.dialog-buttons button.btn-destructive:hover {
    background: #a91c1a;
    border-color: #a91c1a;
}

/* Draft choice link style */
.draft-choice-link {
    padding: 0.5rem 0;
    text-align: center;
    color: #1a73e8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
    transition: color 0.2s;
}

.draft-choice-link:hover {
    color: #1557b0;
    text-decoration: underline;
}

#deleteConfirmBtn,
#deleteFolderConfirmBtn,
#confirmDialogConfirmBtn {
    background: #c5221f !important;
    color: white !important;
    border: 1px solid #c5221f !important;
}

#deleteConfirmBtn:hover,
#deleteFolderConfirmBtn:hover,
#confirmDialogConfirmBtn:hover {
    background: #a91c1a !important;
    border-color: #a91c1a !important;
}

#createCancelBtn {
    background: white;
    border: 1px solid #ddd;
    color: #2c3e50;
}

#createCancelBtn:hover {
    background: #f8f9fa;
}

#createSaveBtn,
#renameSaveBtn,
#createFolderSaveBtn {
    background: #1A73E8;
    border: 1px solid #1A73E8;
    color: white;
}

#createSaveBtn:hover,
#renameSaveBtn:hover,
#createFolderSaveBtn:hover {
    background: #1557b0;
    border-color: #1557b0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Settings Dialog */
.settings-dialog {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    max-width: 95vw;
    background: white;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.settings-dialog.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.settings-content {
    padding: 0;
    height: auto; /* Let it size based on content */
    display: flex;
    flex-direction: column;
}

.settings-content h2 {
    margin: 0;
    padding: 0.75rem 1rem;
    background-color: #F2F2F2;
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px 6px 0 0;
}

.settings-content .settings-tabs {
    padding: 1rem 1rem 0 1rem;
    flex-shrink: 0;
}

.settings-content form {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow flex shrinking */
    /* Form height = tab content (400px) + buttons area */
    min-height: calc(400px + 4rem); /* 400px content + ~4rem for buttons and padding */
}

.settings-content form {
    display: flex;
    flex-direction: column;
    min-height: 500px; /* Ensure form has minimum height for tab content + buttons */
}

.settings-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}

.settings-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.3s;
}

.settings-tab:hover {
    color: #2c3e50;
}

.settings-tab.active {
    color: #0B57D0;
    border-bottom-color: #0B57D0;
    font-weight: 500;
}

.settings-tab-content {
    display: block;
    height: 400px; /* Fixed height matching Fonts tab - prevents dialog size changes */
    overflow-y: auto; /* Allow scrolling if content exceeds height */
    overflow-x: hidden;
    flex-shrink: 0; /* Prevent shrinking */
}

.settings-tab-content:not(.active) {
    display: none;
}

/* Ensure Pane Widths and Topic Order content can scroll if needed */
#paneWidthsContent,
#topicOrderContent {
    height: 400px; /* Match Fonts tab height */
    overflow-y: auto;
}

.settings-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Google Sans', Arial, sans-serif;
}

.settings-group select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.settings-group {
    margin-bottom: 0.75rem; /* Reduced spacing to fit more content in fixed height */
}

.settings-group label {
    display: block;
    margin-bottom: 0.4rem; /* Reduced spacing */
    font-weight: 500;
    color: #555;
    font-size: 0.9rem; /* Slightly smaller */
}

.settings-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 0 !important;
    font-weight: 400;
    color: #333;
}

.settings-checkbox-label input[type="checkbox"] {
    width: auto !important;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.settings-checkbox-label span {
    flex: 1;
    user-select: none;
}

.settings-group input {
    width: 100%;
    padding: 0.4rem 0.5rem; /* Slightly reduced vertical padding */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem; /* Slightly smaller font */
    transition: border-color 0.3s, background-color 0.3s;
    box-sizing: border-box; /* Ensure padding is included in width */
}

.settings-group input:focus {
    outline: none;
    border: 2px solid #1a73e8;
    padding: calc(0.4rem - 1px) calc(0.5rem - 1px); /* Adjust padding to maintain size when border increases */
}

.settings-group input.error {
    border-color: #e74c3c;
    background-color: #ffeaea;
}

.input-with-auto {
    display: flex;
    gap: 0.4rem; /* Slightly reduced gap */
    align-items: center;
    overflow: visible; /* Ensure focus outline is not clipped */
}

.input-with-auto input {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    box-sizing: border-box; /* Ensure padding is included in width */
}

.input-with-auto input:focus {
    outline: none;
    border: 2px solid #1a73e8;
    padding: calc(0.4rem - 1px) calc(0.5rem - 1px); /* Adjust padding to maintain size when border increases */
}

.auto-btn {
    padding: 0.35rem 0.875rem;
    border: 1px solid #ddd;
    border-radius: 9999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #2c3e50;
    font-weight: 500;
    white-space: nowrap;
}

.auto-btn:hover:not(:disabled) {
    background: #f8f9fa;
}

.auto-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #e9ecef;
    color: #6c757d;
}

.settings-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.settings-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    flex-shrink: 0; /* Prevent button area from shrinking */
}

.settings-buttons button {
    padding: 0.35rem 0.875rem;
    border: 1px solid #ddd;
    border-radius: 9999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    color: #2c3e50;
    font-weight: 500;
}

.settings-buttons button:hover:not(:disabled) {
    background: #f8f9fa;
}

#saveCloseBtn {
    padding: 0.65rem 0.875rem;
    background: #1A73E8;
    border: 1px solid #1A73E8;
    color: white;
}

#saveCloseBtn:hover:not(:disabled) {
    background: #1557b0;
    border-color: #1557b0;
}


.settings-buttons button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #e9ecef;
    color: #6c757d;
}

/* ============================================
   HOMEPAGE STYLES
   ============================================ */

.homepage {
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
}

body.homepage {
    background: #ffffff !important;
    height: auto !important;
    display: block !important;
    justify-content: normal !important;
}

/* Navigation */
.homepage-nav {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: flex-end;
    text-decoration: none;
}

.nav-logo-text {
    font-size: 2rem !important;
    font-weight: 500 !important;
    color: #1f1f1f !important;
    letter-spacing: 2px !important;
    font-family: 'Roboto', sans-serif !important;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: #5e5e5e;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
    padding: 0.5rem 0;
}

.nav-link:hover {
    color: #2c3e50;
}

.nav-link-active {
    color: #0B57D0;
}

.nav-link-secondary {
    color: #5e5e5e;
}

.nav-link-primary {
    background: #1a73e8;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    font-weight: 500;
}

.nav-link-primary:hover {
    background: #1557b0;
    color: white;
}

/* Homepage Main */
.homepage-main {
    margin-top: 0;
    padding-top: 0;
}

/* Hero Section */
.hero {
    padding: 2rem 2rem 4rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #E5EDFF 0%, #f8f9ff 100%) !important;
    margin-top: 0;
}

.hero-section {
    padding: 4rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #E5EDFF 0%, #f8f9ff 100%) !important;
    margin-top: 0;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

/* Announcement Banner */
.announcement-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    color: #0c4a6e;
}

/* Announce Box */
.announce-box {
    background-color: #FCEAC5 !important;
    border: 2px solid #2E1D00 !important;
    border-radius: 8px !important;
    padding: 1.5rem !important;
    margin: 2rem auto !important;
    max-width: 800px !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 1rem !important;
    text-align: left !important;
}

.announce-icon {
    flex-shrink: 0 !important;
    margin-top: 0.125rem !important;
    color: #2E1D00 !important;
    stroke: #2E1D00 !important;
}

.announce-content {
    flex: 1;
}

.announce-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2E1D00;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.announce-text {
    font-size: 0.95rem;
    color: #2E1D00;
    margin: 0;
    line-height: 1.6;
}

.announcement-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: #0284c7;
}

.announcement-content {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
}

.announcement-content strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #0c4a6e;
}

.announcement-content p {
    margin: 0;
    color: #075985;
}

html[data-theme="dark"] .announcement-banner {
    background-color: #0c1e2e;
    border-color: #1e3a52;
    color: #7dd3fc;
}

html[data-theme="dark"] .announcement-icon {
    color: #38bdf8;
}

html[data-theme="dark"] .announcement-content strong {
    color: #7dd3fc;
}

html[data-theme="dark"] .announcement-content p {
    color: #7dd3fc;
}

.hero-title {
    font-size: 3rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #5e5e5e;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Features Section */
.features-section {
    padding: 5rem 2rem;
    background: #ffffff;
}

.features-container {
    max-width: 1200px;
    margin: 0 auto;
}

.features-title {
    font-size: 2.5rem;
    font-weight: 600;
    text-align: center;
    color: #1f1f1f;
    margin-bottom: 3rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 0.75rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.feature-description {
    color: #5e5e5e;
    line-height: 1.6;
}

/* CTA Section */
.cta-section {
    padding: 5rem 2rem;
    background: linear-gradient(135deg, #E5EDFF 0%, #f8f9ff 100%) !important;
    text-align: center;
}

.cta-content {
    max-width: 600px;
    margin: 0 auto;
}

.cta-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 1rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.cta-subtitle {
    font-size: 1.125rem;
    color: #5e5e5e;
    margin-bottom: 2rem;
}

/* Footer */
.homepage-footer {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    padding: 2rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-link {
    text-decoration: none;
    color: #5e5e5e;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #2c3e50;
}

.footer-copyright {
    color: #5e5e5e;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.btn-primary {
    background: #1a73e8;
    color: white;
}

.btn-primary:hover {
    background: #1557b0;
}

.btn-secondary {
    background: white;
    color: #0B57D0;
    border: 1px solid #0B57D0;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-full {
    width: 100%;
}

/* ============================================
   AUTH PAGES (SIGNIN/REGISTER)
   ============================================ */

.auth-page {
    min-height: 100vh;
    background: #E5EDFF;
    display: flex;
    flex-direction: column;
}

.auth-nav {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
}

.auth-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.auth-nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #2c3e50;
    font-size: 1.125rem;
    font-weight: 600;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-title {
    font-size: 2rem;
    font-weight: 600;
    color: #1f1f1f;
    margin-bottom: 0.5rem;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.auth-subtitle {
    font-size: 1rem;
    color: #5e5e5e;
    line-height: 1.5;
}

.auth-form {
    margin-bottom: 2rem;
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
}

.auth-form .form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: #0B57D0;
    box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.1);
}

.form-group-checkbox {
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: #5e5e5e;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #5e5e5e;
}

.auth-footer {
    text-align: center;
}

.auth-footer-text {
    margin: 0.5rem 0;
    color: #5e5e5e;
    font-size: 0.95rem;
}

.auth-link {
    color: #0B57D0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-link:hover {
    color: #0a4db8;
    text-decoration: underline;
}

/* ============================================
   ABOUT PAGE
   ============================================ */

.about-page {
    min-height: 100vh;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    justify-content: normal !important;
}

.about-page .homepage-nav {
    position: static !important;
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    opacity: 1 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e0e0e0 !important;
    padding: 1rem 0 !important;
}

.about-page .homepage-nav .nav-container {
    display: flex !important;
    visibility: visible !important;
}

.about-main {
    flex: 1;
    padding: 3rem 2rem;
}

.about-container {
    max-width: 900px;
    margin: 0 auto;
}

.about-hero {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2rem 0;
    margin-top: 0;
}

.about-title {
    font-family: 'Product Sans', 'Google Reg Sans', Arial;
    font-size: 26px;
    line-height: 1.2;
    color: #333;
    font-weight: 600;
    margin-bottom: 1rem;
}

.about-lead {
    font-size: 1.25rem;
    color: #5e5e5e;
    line-height: 1.6;
}

.about-content {
    line-height: 1.8;
}

.about-section {
    margin-bottom: 3rem;
}

.about-section-title {
    font-family: 'Product Sans', 'Google Reg Sans', Arial;
    font-size: 26px;
    line-height: 1.2;
    color: #333;
    font-weight: 600;
    margin-bottom: 1rem;
}

.about-text {
    font-size: 1.0625rem;
    color: #5e5e5e;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.about-features-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.about-features-list li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #5e5e5e;
    font-size: 1.0625rem;
    line-height: 1.8;
}

.about-features-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #0B57D0;
    font-weight: 600;
}

.about-features-list li strong {
    color: #2c3e50;
}

.about-cta {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ============================================
   REGISTER PAGE (SLASH2 STYLE) - FROM REFERENCE
   ============================================ */

/* Only apply these styles when NOT on homepage */
body:not(.homepage):not(.about-page) {
    padding: 0;
    margin: 0;
    background: #F7F7F5;
    height: 100vh;
    display: flex;
    justify-content: center;
    font-family: 'Google Reg Sans', Arial;
}

.box {
    width: 370px;
    min-width: 270px;
    height: 520px;
    background-color: #fff;
    border-radius: 24px;
    margin-top: 110px;
    padding: 35px;
}

.title {
    font-size: 26px;
    line-height: 1.2;
    padding-top: 10px;
    color: #333;
    padding-bottom: 5px;
}

.title2 {
    font-size: 16px;
    color: #666;
}

.pane {
    width: 50%;
    height: 100%;
    float: left;
}

.account-input-wrapper.active {
    height: 32px;
    width: 300px;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    position: relative;
    padding: 0px;
}

.account-input-wrapper {
    width: 302px;
    border: 1px solid #aaa;
    border-radius: 4px;
    position: relative;
    padding: 2px 1px;
}

.account-input-wrapper input {
    border: none;
    outline: 0;
    font-size: 15px;
    color: #202124;
    height: 32px;
    width: 279px;
    padding: 0px 10px;
    border-radius: 4px;
}

.account-input-wrapper2.active {
    height: 32px;
    width: 300px;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    position: relative;
    padding: 0px;
}

.account-input-wrapper2 {
    width: 302px;
    border: 1px solid #aaa;
    border-radius: 4px;
    position: relative;
    padding: 2px 1px;
    display: inline-block;
}

.account-input-wrapper2 input {
    border: none;
    outline: 0;
    font-size: 15px;
    color: #202124;
    height: 32px;
    width: 279px;
    padding: 0px 10px;
    border-radius: 4px;
}

.account-input-wrapper3.active {
    height: 32px;
    width: 300px;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    position: relative;
    padding: 0px;
}

.account-input-wrapper3 {
    width: 302px;
    border: 1px solid #aaa;
    border-radius: 4px;
    position: relative;
    padding: 2px 1px;
    display: inline-block;
}

.account-input-wrapper3 input {
    border: none;
    outline: 0;
    font-size: 15px;
    color: #202124;
    height: 32px;
    width: 279px;
    padding: 0px 10px;
    border-radius: 4px;
}

label.reg-label {
    position: absolute;
    transform-origin: top left;
    padding: 0px;
    transform: translate(0, 16px) scale(1);
    transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Roboto Reg';
    font-size: 15px;
    color: #797E84;
    top: -8px;
    left: 10px;
    pointer-events: none;
    cursor: text;
}

.account-input-wrapper.active label {
    transform: translate(-6px, 1px) scale(.80);
    color: #1973e8;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper.done label {
    transform: translate(-6px, 1px) scale(.80);
    color: #5f6368;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper2.active label {
    transform: translate(-6px, 1px) scale(.80);
    color: #1973e8;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper2.done label {
    transform: translate(-6px, 1px) scale(.80);
    color: #5f6368;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper3.active label {
    transform: translate(-6px, 1px) scale(.80);
    color: #1973e8;
    background: #fff;
    padding: 0px 5px;
}

.account-input-wrapper3.done label {
    transform: translate(-6px, 1px) scale(.80);
    color: #5f6368;
    background: #fff;
    padding: 0px 5px;
}

.account-register-check-availability {
    color: #1a73e8;
    cursor: pointer;
}

.google-button {
    cursor: pointer;
    border: #B0B9C1 1px solid;
    border-radius: 40px;
    color: #232a31;
    font-size: 17px;
    font-weight: 500;
    padding: 8px;
    text-align: center;
}

.google-button:hover {
    border: #5B636A 1px solid;
}

/* Form group styles for our labels and inputs */
.box .form-group {
    margin-bottom: 1rem;
}

.box .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
}

.box .form-group input {
    width: 100%;
    height: 32px;
    padding: 0px 10px;
    border: 1px solid #aaa;
    border-radius: 4px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Google Sans Flex', 'Google Sans', 'Helvetica Neue', sans-serif;
    color: #202124;
    box-sizing: border-box;
}

.box .form-group input:focus {
    outline: none;
    border: 2px solid #1a73e8;
    padding: 0px 9px;
}

.box .form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #555;
}

.reg-blue-text {
    color: #333;
}

.reg-blue-text a {
    color: #1a73e8;
    text-decoration: none;
}

.reg-blue-text a:hover {
    text-decoration: underline;
}

.btn-blue {
    background: #1a73e8;
    box-shadow: none;
    border-radius: 40px;
    font-size: 17px;
    line-height: 20px;
    min-width: 88px;
    transition: box-shadow .28s cubic-bezier(0.4,0.0,0.2,1);
    border: 0;
    display: inline-block;
    cursor: pointer;
    outline: none;
    text-align: center;
    color: #fff;
    padding: 11px 8px;
    position: relative;
    box-sizing: content-box;
}

.btn-blue:hover {
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.right {
    float: right;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .features-title,
    .cta-title {
        font-size: 2rem;
    }

    .about-title {
        font-size: 2rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-link-primary {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .auth-container {
        padding: 2rem;
    }

    .auth-title {
        font-size: 1.75rem;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .register-box {
        width: 90%;
        max-width: 370px;
        margin: 0 1rem;
    }

    .register-main {
        padding-top: 50px;
    }
}

/* Font Settings Menu Button */
.font-settings-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    color: #2c3e50;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
}

.font-settings-menu-btn:hover {
    background: #f5f5f5;
}

.font-settings-menu-btn svg {
    width: 14px;
    height: 14px;
}

/* Font Settings Menu Dropdown */
.font-settings-menu-dropdown {
    display: none !important;
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    z-index: 10000;
    min-width: 200px;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0;
}

.font-settings-menu-dropdown.show {
    display: flex !important;
}

.font-settings-menu-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.font-settings-menu-item label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
}

/* Toolbar menu items in hamburger dropdown (tablet breakpoint) */
.doc-toolbar-hamburger-dropdown .toolbar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s ease;
}

.doc-toolbar-hamburger-dropdown .toolbar-menu-item:hover {
    background: #f5f5f5;
}

.doc-toolbar-hamburger-dropdown .toolbar-menu-item span:first-child {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
}

.font-settings-menu-item .font-select-dropdown {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

/* Doc Toolbar Hamburger Button (always visible, to the right of Full Doc button) */
.doc-toolbar-hamburger-wrapper {
    position: relative;
    display: inline-block;
}

/* Hamburger button should match format-btn style when inside new-toolbar */
.new-toolbar .doc-toolbar-hamburger-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    margin-left: 0;
}

.doc-toolbar-hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    margin-left: 0;
    transition: background-color 0.15s ease;
}

.doc-toolbar-hamburger-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.doc-toolbar-hamburger-btn:active:not(:disabled) {
    background: #e0e0e0;
}

.doc-toolbar-hamburger-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.doc-toolbar-hamburger-btn svg {
    width: 16px;
    height: 16px;
}

/* Doc Toolbar Hamburger Dropdown */
.doc-toolbar-hamburger-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    z-index: 10000;
    min-width: 250px;
    flex-direction: column;
    gap: 0.75rem;
    white-space: nowrap;
}

.doc-toolbar-hamburger-dropdown.show {
    display: flex !important;
}

.doc-toolbar-hamburger-dropdown .font-settings-menu-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.doc-toolbar-hamburger-dropdown .font-settings-menu-item label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
}

.doc-toolbar-hamburger-dropdown .font-select-dropdown {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
}

/* Hide mobile menu by default (desktop) */
.mobile-menu-btn {
    display: none !important;
}

.mobile-menu-dropdown {
    display: none !important;
}

/* Allow dropdown to show when .show class is added (mobile only) */
@media (max-width: 768px) {
    /* Hide font settings hamburger on mobile - use mobile menu instead */
    .font-settings-menu-btn {
        display: none !important;
    }
    
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.25rem;
        background: transparent;
        border: 1px solid #ddd;
        border-radius: 4px;
        cursor: pointer;
        color: #2c3e50;
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }
    
    .mobile-menu-btn:hover {
        background: #f5f5f5;
    }
    
    .mobile-menu-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .mobile-menu-dropdown.show {
        display: flex !important;
    }
    
    .mobile-menu-divider {
        height: 1px;
        background: #e0e0e0;
        margin: 0.5rem 0;
    }
    
    .mobile-menu-section {
        display: flex;
        flex-direction: column;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }
    
    .mobile-menu-section label {
        font-size: 12px;
        font-weight: 500;
        color: #666;
    }
    
    .mobile-menu-select {
        padding: 0.5rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
        font-family: 'Google Sans', Arial, sans-serif;
        background: white;
        color: #1f1f1f;
        cursor: pointer;
    }
    
    .mobile-menu-select:hover {
        border-color: #bbb;
    }
    
    .mobile-menu-select:focus {
        outline: none;
        border-color: #5A9FD4;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Header adjustments */
    .app-title {
        font-size: 1.15rem !important;
    }
    
    /* Hide "FOLDER 2" text, show only "F2" */
    .logo h1 {
        font-size: 1.15rem !important;
    }
    
    /* Make search bar stretch to available space */
    .header-search-wrapper {
        flex: 1;
        max-width: none;
        margin-left: 0.5rem;
        margin-right: 0.5rem;
    }
    
    .header-search {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 0.85rem;
        padding: 0.6rem 3.5rem 0.6rem 0.65rem;
    }
    
    .header-search:focus {
        padding: calc(0.6rem - 1px) 3.5rem calc(0.6rem - 1px) calc(0.65rem - 1px);
    }
    
    .header-left {
        gap: 0.5rem;
        flex: 1;
        min-width: 0;
    }
    
    .app-header {
        padding: 0.5rem 1rem 0.5rem 0.75rem;
    }
    
    /* Hide middle pane on mobile - DISABLED TO PREVENT LAYOUT SHIFT */
    /* .middle-pane {
        display: none !important;
    }
    
    /* Make panes full width when visible */
    /* .left-pane {
        width: 100% !important;
        min-width: 0 !important;
    }
    
    /* .main-pane {
        width: 100% !important;
        min-width: 0 !important;
        display: none;
    }
    
    /* Show left pane by default on mobile */
    /* .left-pane {
        display: flex !important;
    } */
    
    /* Back to topics button - DISABLED TO PREVENT LAYOUT SHIFT */
    /* .back-to-topics-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0 0.5rem;
        background: white;
        border: 1px solid #ddd;
        border-radius: 4px;
        color: #001d35;
        font-size: 0.875rem;
        font-family: 'Google Sans', Arial, sans-serif;
        font-weight: 500;
        cursor: pointer;
        margin-right: 0.75rem;
        transition: all 0.2s;
        height: 28px;
        min-width: 28px;
    }
    
        min-width: 28px;
    }
    
    .back-to-topics-btn:hover:not(:disabled) {
        background: #f8f9fa;
        border-color: #bbb;
    }
    
    .back-to-topics-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
    
    .back-to-topics-btn svg {
        width: 16px;
        height: 16px;
    } */
    
    /* Sub topics button - show on mobile - DISABLED */
    /* .sub-topics-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.35rem 0.75rem;
        background: white;
        border: 1px solid #ddd;
        border-radius: 9999px;
        color: #2c3e50;
        font-size: 12px;
        font-family: 'Google Sans', Arial, sans-serif;
        font-weight: 500;
        cursor: pointer;
        margin-right: 0.75rem;
        transition: all 0.2s;
    }
    
    .sub-topics-btn:hover:not(:disabled) {
        background: #f5f5f5;
        border-color: #bbb;
    }
    
    .sub-topics-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    } */
    
    /* Sub topics dropdown - below Sub button, flush left, half screen width */
    .sub-topics-dropdown {
        position: absolute;
        top: calc(100% + 0.25rem);
        left: 0;
        width: 50vw;
        max-height: calc(100vh - 120px);
        background: #f5f5f5;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1000;
        display: none;
        flex-direction: column;
        overflow-y: auto;
    }
    
    .sub-topics-dropdown.show {
        display: flex !important;
    }
    
    .sub-topics-dropdown-item {
        padding: 0.4rem 1rem;
        text-align: left;
        background: white;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        color: #2c3e50;
        font-size: 0.9rem;
        cursor: pointer;
        transition: background 0.2s;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .sub-topics-dropdown-item:last-child {
        border-bottom: none;
    }
    
    .sub-topics-dropdown-item:hover {
        background: #f5f5f5;
    }
    
    .sub-topics-dropdown-item:active {
        background: #e0e0e0;
    }
    
    /* Adjust pane header for back button */
    .main-pane .pane-header {
        flex-wrap: wrap;
        gap: 0.5rem;
        position: relative;
    }
    
    .main-pane .header-buttons {
        flex: 1;
        min-width: 0;
    }
    
    /* Make topic items more touch-friendly - DISABLED TO PREVENT SPACING CHANGE */
    /* .topic-item {
        min-height: 44px;
        padding: 0.75rem 0.5rem;
    } */
    
    /* Hide icon buttons on mobile, show hamburger menu */
    .mono-btn,
    .format-style-btn,
    .math-btn,
    .url-btn,
    .image-btn,
    .emoji-btn,
    .table-btn,
    .fullpage-btn,
    .save-btn,
    .cancel-btn,
    .header-btn,
    .unformat-btn,
    .bullet-list-btn {
        display: none !important;
    }
    
    /* Hide toolbar divider and groups after View/Edit buttons in mobile doc view */
    .header-buttons-left .toolbar-divider,
    .header-buttons-left .toolbar-group {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        background: transparent;
        border: 1px solid #ddd;
        border-radius: 4px;
        cursor: pointer;
        color: #2c3e50;
    }
    
    .mobile-menu-btn:hover {
        background: #f5f5f5;
    }
    
    .mobile-menu-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .mobile-menu-dropdown {
        position: absolute;
        top: calc(100% + 0.25rem);
        right: 0;
        left: auto;
        min-width: 180px;
        max-width: 90vw;
        background: white;
        border: 1px solid #ddd;
        border-radius: 4px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1000;
        display: none;
        flex-direction: column;
    }
    
    .mobile-menu-dropdown.show {
        display: flex !important;
    }
    
    .mobile-menu-item {
        padding: 0.4rem 1rem;
        text-align: left;
        background: white;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        color: #2c3e50;
        font-size: 0.9rem;
        cursor: pointer;
        transition: background 0.2s;
    }
    
    .mobile-menu-item:last-child {
        border-bottom: none;
    }
    
    .mobile-menu-item:hover {
        background: #f5f5f5;
    }
    
    .mobile-menu-item:active {
        background: #e0e0e0;
    }
    
    /* Keep View and Edit buttons visible on mobile */
    .view-btn,
    .edit-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Hide Archive option on mobile */
    .archive-btn {
        display: none !important;
    }
    
    /* Make logo clickable on mobile */
    .logo {
        cursor: pointer;
    }
    
    /* Position header buttons relative for dropdown */
    .main-pane .header-buttons-right {
        position: relative;
    }
    
    /* Adjust search icon button position */
    .search-icon-btn {
        right: 0.5rem !important;
    }
    
    .clear-search-btn {
        right: 2.25rem !important;
    }
    
    /* Hide pane widths tab in settings dialog on mobile */
    #paneWidthsTab {
        display: none !important;
    }
    
    #paneWidthsContent {
        display: none !important;
    }
    
    /* Make topic order tab active by default on mobile */
    #topicOrderTab {
        display: block !important;
    }
    
    /* If only one tab is visible, make it full width */
    .settings-tabs {
        justify-content: center;
    }
    
    .settings-tabs button:only-of-type,
    .settings-tabs button:last-of-type:not(:first-of-type) {
        width: 100%;
    }
}

/* Responsive: Hide font dropdowns and show hamburger menu when toolbar wraps */
/* This is now controlled by JavaScript to detect actual wrapping */

/* Share icon styling - blue outline icon, no background, doesn't change on active */
.topic-share-icon {
    color: #0B57D0 !important;
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

.topic-share-icon svg {
    color: #0B57D0 !important;
    fill: none !important;
    stroke: #0B57D0 !important;
    transform: translateY(1px);
}

/* Keep icon blue outline even when topic is active - no background circle */
/* Must override the .shared-icon.active rule which adds blue circle - use same specificity */
.topic-item.shared-topic.active .topic-share-icon:not(.admin-shared-icon),
.topic-item.active.shared-topic .topic-share-icon:not(.admin-shared-icon),
.topic-item.active .topic-share-icon {
    color: #0B57D0 !important;
    background-color: transparent !important;
    background: transparent !important;
    border-radius: 0 !important;
}

.topic-item.shared-topic.active .topic-share-icon:not(.admin-shared-icon) svg,
.topic-item.active.shared-topic .topic-share-icon:not(.admin-shared-icon) svg,
.topic-item.active .topic-share-icon svg {
    color: #0B57D0 !important;
    stroke: #0B57D0 !important;
    fill: none !important;
    transform: translateY(1px);
}

/* Dark mode for home2 page - white title */
html[data-theme="dark"] .site-title {
    color: #ffffff !important;
}

/* User Menu Dropdown for Mobile */
.user-menu-wrapper {
    position: relative;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 10000;
    flex-direction: column;
    padding: 0.25rem 0;
}

.user-menu-dropdown.show {
    display: flex !important;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: #1f1f1f;
    font-size: 14px;
    width: 100%;
    transition: background-color 0.15s;
}

.user-menu-item:hover {
    background-color: #f5f5f5;
}

.user-menu-item svg {
    flex-shrink: 0;
    color: #4a4a4a;
}

.user-menu-item span {
    flex: 1;
}

/* Mobile: Hide desktop buttons, show dropdown */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .user-menu-dropdown {
        display: none;
    }
    
    .user-menu-dropdown.show {
        display: flex !important;
    }
}

/* Desktop: Show dropdown when toggled */
@media (min-width: 769px) {
    .user-menu-dropdown {
        display: none;
    }
    
    .user-menu-dropdown.show {
        display: flex !important;
    }
}

/* Divider in user menu */
.user-menu-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 0.25rem 0;
}

/* Topic Swipe Actions for Mobile */
.topic-item.swipeable {
    position: relative;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.topic-swipe-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: none;
    align-items: center;
    gap: 0;
    background: #f5f5f5;
    padding: 0 0.25rem;
    z-index: 10;
    border-left: 1px solid #e0e0e0;
}

.topic-swipe-actions.visible {
    display: flex;
}

.swipe-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    color: #4a4a4a;
    transition: background-color 0.15s;
}

.swipe-action-btn:hover {
    background-color: #e0e0e0;
}

.swipe-action-btn svg {
    width: 18px;
    height: 18px;
}

.swipe-delete {
    color: #d32f2f;
}

.swipe-edit {
    color: #1976d2;
}

.swipe-share {
    color: #388e3c;
}

.swipe-rename {
    color: #f57c00;
}

.swipe-sticky {
    color: #7b1fa2;
}

.swipe-unshare {
    color: #d32f2f;
}

/* Disable drag on mobile */
@media (max-width: 768px) {
    .topic-item.draggable .drag-handle {
        display: none;
    }
    
    .topic-item.draggable {
        cursor: default;
    }
    
    /* Hide sub-topics button on mobile */
    .sub-topics-btn {
        display: none !important;
    }
}

/* Responsive Breakpoint Styles */

/* Desktop mode (≥ 1030px) - All 3 panes visible */
body.app-page:not(.breakpoint-compact):not(.breakpoint-tablet):not(.breakpoint-mobile) #leftPane,
body.app-page:not(.breakpoint-compact):not(.breakpoint-tablet):not(.breakpoint-mobile) #middlePane,
body.app-page:not(.breakpoint-compact):not(.breakpoint-tablet):not(.breakpoint-mobile) #mainPane {
    display: flex !important;
}

body.app-page:not(.breakpoint-compact):not(.breakpoint-tablet):not(.breakpoint-mobile) .back-to-topics-btn {
    display: none !important;
}

/* Level 1: Compact (< 1030px) - Remove grey padding, hide sub-topics */
body.app-page.breakpoint-compact #middlePane {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
}

body.app-page.breakpoint-compact #mainPane {
    flex: 1 !important;
    width: auto !important;
}

body.app-page.breakpoint-compact .docs-content-wrapper,
body.app-page.breakpoint-compact #docsContent .docs-content-wrapper,
body.app-page.breakpoint-compact .pane-content .docs-content-wrapper {
    background-color: transparent !important;
    padding: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

body.app-page.breakpoint-compact .docs-viewer,
body.app-page.breakpoint-compact .docs-editor {
    max-width: 100% !important;
}

/* Level 2: Tablet (< 900px) - Same as compact */
/* Tablet mode: Ensure proper pane widths and hide mobile elements */
body.app-page.breakpoint-tablet #leftPane {
    width: auto !important; /* Let JavaScript set the width from settings */
    min-width: 200px !important;
}

/* Override any mobile width constraints */
body.app-page.breakpoint-tablet #leftPane[style*="width: 100%"] {
    width: auto !important;
}

/* Hide middle pane (sub-topics) in tablet mode */
body.app-page.breakpoint-tablet #middlePane {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
}

body.app-page.breakpoint-tablet .back-to-topics-btn {
    display: none !important;
}

/* Hide 3-dot icons in tablet mode (only show in mobile) */
body.app-page.breakpoint-tablet .topic-mobile-menu-icon {
    display: none !important;
}

body.app-page.breakpoint-compact .topic-mobile-menu-icon {
    display: none !important;
}

body.app-page.breakpoint-tablet .docs-content-wrapper,
body.app-page.breakpoint-tablet #docsContent .docs-content-wrapper,
body.app-page.breakpoint-tablet .pane-content .docs-content-wrapper {
    background-color: transparent !important;
    padding: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

body.app-page.breakpoint-tablet .docs-viewer,
body.app-page.breakpoint-tablet .docs-editor {
    max-width: 100% !important;
}

/* Tablet: Hide top-right icons, show in profile dropdown */
body.app-page.breakpoint-tablet .editor-icon-btn,
body.app-page.breakpoint-tablet .settings-icon-btn,
body.app-page.breakpoint-tablet .help-icon-btn,
body.app-page.breakpoint-tablet .report-issue-icon-btn {
    display: none !important;
}

body.app-page.breakpoint-tablet .user-menu-item.tablet-only {
    display: flex !important;
}

/* Tablet: Hide toolbar buttons, show in hamburger */
body.app-page.breakpoint-tablet .new-toolbar .format-btn:not(.doc-toolbar-hamburger-btn),
body.app-page.breakpoint-tablet .toolbar-divider {
    display: none !important;
}

body.app-page.breakpoint-tablet .doc-toolbar-hamburger-dropdown .tablet-only {
    display: block !important;
}

body.app-page.breakpoint-tablet .toolbar-menu-item {
    display: flex !important;
}

/* Level 3: Mobile (< 600px) - Full-width topics */
/* Mobile: When showing topics, leftPane is full width */
body.app-page.breakpoint-mobile #leftPane {
    width: 100% !important;
    min-width: 0 !important;
}

/* Mobile: When showing document, leftPane is hidden and mainPane is full width */
body.app-page.breakpoint-mobile #leftPane[style*="display: none"],
body.app-page.breakpoint-mobile #leftPane[style*="display:none"] {
    width: 0 !important;
    min-width: 0 !important;
}

body.app-page.breakpoint-mobile #mainPane[style*="display: flex"],
body.app-page.breakpoint-mobile #mainPane[style*="display:flex"] {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 !important;
}

body.app-page.breakpoint-mobile #middlePane {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
}

/* Hide hamburger menu button in mobile mode */
body.app-page.breakpoint-mobile .hamburger-menu-btn {
    display: none !important;
}

/* Back button styling to match View/Save and Edit buttons */
body.app-page.breakpoint-mobile .back-to-topics-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0 0.5rem;
    background: #5A9FD4;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 0.875rem;
    font-family: 'Google Sans', Arial, sans-serif;
    font-weight: 500;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background 0.3s;
    height: 28px;
    min-width: 28px;
}

body.app-page.breakpoint-mobile .back-to-topics-btn:hover:not(:disabled) {
    background: #4A8FC4;
}

body.app-page.breakpoint-mobile .back-to-topics-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #7AB5DD;
}

body.app-page.breakpoint-mobile .back-to-topics-btn svg {
    width: 16px;
    height: 16px;
    stroke: white;
}

body.app-page.breakpoint-mobile .docs-content-wrapper,
body.app-page.breakpoint-mobile #docsContent .docs-content-wrapper,
body.app-page.breakpoint-mobile .pane-content .docs-content-wrapper {
    background-color: transparent !important;
    padding: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

body.app-page.breakpoint-mobile .docs-viewer,
body.app-page.breakpoint-mobile .docs-editor {
    max-width: 100% !important;
}

/* Toaster Styles */
.toaster-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    pointer-events: none;
}

.toaster {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 500px;
    pointer-events: auto;
    animation: toasterSlideIn 0.3s ease-out;
    font-family: var(--font-family-default);
    font-size: 14px;
    line-height: 1.5;
}

@keyframes toasterSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toaster.toaster-hiding {
    animation: toasterSlideOut 0.3s ease-in forwards;
}

@keyframes toasterSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.toaster-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toaster-message {
    flex: 1;
}

.toaster-dismiss {
    color: #8EB9FF;
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    opacity: 0.9;
    transition: opacity 0.2s;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
}

.toaster-dismiss:hover {
    opacity: 1;
}

/* Toaster Color Variants */
.toaster-red {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-green {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-orange {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-white {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-purple {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}

.toaster-blue {
    background-color: #323232;
    border: 2px solid #000000;
    color: white;
}
