/* =============================================================================
   YWLW Static Site Stylesheet
   Windows Explorer-inspired file manager interface with Google Doc content
   ============================================================================= */

/* -----------------------------------------------------------------------------
   CSS Variables & Reset
   ----------------------------------------------------------------------------- */

:root {
    /* File Manager Colors (Windows Explorer) */
    --bg-primary: #ffffff;
    --bg-sidebar: #f3f3f3;
    --bg-toolbar: #f5f5f5;
    --bg-statusbar: #f0f0f0;
    --border-color: #e0e0e0;
    --hover-color: #e5f3ff;
    --selected-color: #cce8ff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent-color: #0078d4;
    --accent-hover: #106ebe;

    /* Typography */
    --font-system: "Lexend Deca", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    --font-size-base: 14px;
    --line-height-base: 1.5;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Layout */
    --toolbar-height: 48px;
    --statusbar-height: 28px;
    --sidebar-width: 220px;
    --sidebar-width-tablet: 180px;
}

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

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-system);
    font-size: 1rem;
    line-height: var(--line-height-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
}

/* Sidebar collapsed state for desktop */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    width: 0;
    padding: 0;
    border-right: none;
}

body.sidebar-collapsed .main-panel {
    grid-column: 1 / -1;
    width: 100vw;
}

body.sidebar-collapsed .status-bar {
    grid-column: 1 / -1;
}

/* -----------------------------------------------------------------------------
   File Manager Layout
   ----------------------------------------------------------------------------- */

.file-manager {
    display: grid;
    grid-template-areas:
        "toolbar toolbar"
        "sidebar main"
        "statusbar statusbar";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--toolbar-height) 1fr var(--statusbar-height);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    transition: grid-template-columns 0.1s ease;
}

/* Toolbar */
.toolbar {
    grid-area: toolbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    background: var(--bg-toolbar);
    border-bottom: 1px solid var(--border-color);
    gap: var(--spacing-md);
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.toolbar-right {
    justify-content: flex-end;
    min-width: fit-content;
}

.toolbar-center {
    flex: 1;
    justify-content: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.brand:hover {
    color: var(--accent-color);
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

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

.toolbar-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--bg-toolbar);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: var(--spacing-xs);
    margin-right: var(--spacing-sm);
}

.font-size-controls .icon-btn {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
}

.font-size-controls .icon-btn:hover {
    color: var(--text-primary);
    background: var(--hover-color);
}

.font-size-controls .icon-btn:active {
    background: var(--selected-color);
}

.search-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--bg-toolbar);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: var(--spacing-xs);
    transition: all 0.15s ease;
}

.search-container:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.1);
}

#global-search {
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-system);
    font-size: 0.9rem;
    color: var(--text-primary);
    width: 180px;
    transition: width 0.3s ease;
}

#global-search::placeholder {
    color: var(--text-secondary);
}

#global-search:focus {
    width: 240px;
}

/* When search is inside menu, it should take full width */
.menu-dropdown .search-container {
    width: 100%;
}

.menu-dropdown #global-search {
    width: 100%;
}

.menu-dropdown #global-search:focus {
    width: 100%;
}

#search-btn {
    color: var(--text-secondary);
}

#search-btn:hover {
    color: var(--text-primary);
    background: var(--hover-color);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.9rem;
}

.breadcrumb-item {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb-item:hover {
    color: var(--accent-color);
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-muted);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow: hidden; /* No scrollbar on sidebar itself */
    padding: var(--spacing-md);
    position: relative;
    min-width: 180px;
    max-width: 500px;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-right: 8px; /* Space for resize handle */
}

/* Thin scrollbar for sidebar-nav */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Sidebar Resize Handle */
.sidebar-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s ease;
    z-index: 101;
}

.sidebar-resize-handle::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 30px;
    background: var(--border-color);
    border-radius: 1px;
    opacity: 0.5;
    transition: all 0.15s ease;
}

.sidebar-resize-handle:hover::before,
.sidebar-resize-handle.resizing::before {
    background: var(--accent-color);
    opacity: 1;
    height: 40px;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.resizing {
    background: rgba(0, 120, 212, 0.1);
}

.sidebar-resize-handle.resizing {
    cursor: col-resize;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.sidebar-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#sidebar-close {
    display: none;
}

.nav-list {
    list-style: none;
    margin-bottom: var(--spacing-lg);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.nav-link:hover {
    background: var(--hover-color);
}

.nav-link.active {
    background: var(--selected-color);
    font-weight: 500;
}

.volumes-list h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.issue-toc-section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.issue-toc-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-item {
    margin-bottom: var(--spacing-xs);
}

.toc-item.h1 {
    margin-bottom: var(--spacing-xs);
}

.toc-item.h1 .toc-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.toc-item.h1 .toc-link:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.toc-item.h1.collapsed .toc-children {
    display: none;
}

.toc-item.h2 {
    margin-left: var(--spacing-md);
}

.toc-item.h2 .toc-link {
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.toc-item.h2 .toc-link:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.toc-toggle:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.toc-toggle svg {
    transition: transform 0.2s ease;
}

.toc-item.collapsed .toc-toggle svg {
    transform: rotate(-90deg);
}

.toc-children {
    list-style: none;
    margin: 0;
    padding: 0;
    margin-left: var(--spacing-sm);
}

/* Active state for current section */
.toc-item.active .toc-link {
    background: var(--selected-color);
    color: var(--text-primary);
    font-weight: 600;
}

.toc-item.active.h2 {
    background: var(--selected-color);
    border-radius: 4px;
}

/* Ensure ToC section is visible and properly spaced */
.issue-toc-section {
    display: block;
}

.issue-toc-section h4 {
    margin-bottom: var(--spacing-sm);
}

.toc-list {
    max-height: 60vh;
    overflow-y: auto;
}

/* Thin scrollbar for ToC list */
.toc-list::-webkit-scrollbar {
    width: 4px;
}

.toc-list::-webkit-scrollbar-track {
    background: transparent;
}

.toc-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.toc-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .issue-toc-section {
        margin-top: var(--spacing-md);
        padding-top: var(--spacing-sm);
    }
    
    .current-section-nav {
        display: none; /* Hide header nav on mobile to save space */
    }
    
    .toc-item.h2 {
        margin-left: var(--spacing-sm);
    }
    
    .toc-toggle {
        padding: var(--spacing-xs);
    }
}

/* Active state for current section */
.toc-item.active .toc-link {
    background: var(--selected-color);
    color: var(--text-primary);
    font-weight: 600;
}

.toc-item.active.h2 {
    background: var(--selected-color);
    border-radius: 4px;
}

/* Current section navigation in header */
.current-section-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: var(--spacing-md);
}

.nav-section {
    font-weight: 600;
    color: var(--text-primary);
}

.nav-separator {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.nav-subsection {
    color: var(--text-secondary);
    font-weight: 500;
}

.volume-items {
    list-style: none;
}

.volume-item a {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 4px;
}

.volume-item a:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.item-count {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Main Panel */
.main-panel {
    grid-area: main;
    overflow-y: auto;
    padding: var(--spacing-lg);
    background: var(--bg-primary);
}

/* Status Bar */
.status-bar {
    grid-area: statusbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    background: var(--bg-statusbar);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* -----------------------------------------------------------------------------
   Item Grid (Volumes & Issues List)
   ----------------------------------------------------------------------------- */

.content-header {
    margin-bottom: var(--spacing-lg);
}

.content-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.subtitle {
    color: var(--text-secondary);
}

.content-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.section-divider {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: var(--spacing-xl) 0;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--spacing-md);
}

.item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.item:hover {
    background: var(--hover-color);
    border-color: var(--accent-color);
}

.item-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-sm);
}

.item-icon svg {
    width: 48px;
    height: 48px;
    color: #ffc107;
}

.file-item .item-icon svg {
    color: var(--accent-color);
}

.cover-image {
    width: 100px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.item-name {
    font-weight: 500;
    text-align: center;
    margin-bottom: var(--spacing-xs);
}

.item-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

/* -----------------------------------------------------------------------------
   Issue Article (HTML Content from Google Doc)
   ----------------------------------------------------------------------------- */

.issue-article {
    width: auto;
    margin: 0 auto;
}

.issue-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 2px solid var(--border-color);
}

.issue-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.issue-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--accent-color);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
}

.issue-badge.comics-badge {
    background: #e74c3c;
}

.comics-nav {
    margin-top: var(--spacing-md);
}

.issue-meta time {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.issue-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

.issue-theme {
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.issue-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

.issue-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-md);
}

.keyword-tag {
    display: inline-block;
    padding: 2px 10px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Table of Contents */
.issue-toc {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.issue-toc h2 {
    font-size: 1rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

.issue-toc ul {
    list-style: none;
}

.issue-toc li {
    margin-bottom: var(--spacing-xs);
}

.issue-toc li.h2 {
    padding-left: var(--spacing-md);
}

.issue-toc a {
    color: var(--accent-color);
    text-decoration: none;
}

.issue-toc a:hover {
    text-decoration: underline;
}

/* Main Content Area - Google Doc HTML */
.issue-content {
    line-height: 1.7;
}

/* Reset Google's inline styles completely */
.issue-content,
.issue-content * {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Re-add controlled spacing */
.issue-content p,
.issue-content ul,
.issue-content ol,
.issue-content table,
.issue-content blockquote {
    margin-bottom: var(--spacing-md) !important;
}

.issue-content ul,
.issue-content ol {
    padding-left: var(--spacing-lg) !important;
}

/* Reset Google's inline styles and apply our own */
.issue-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: var(--spacing-xl) 0 var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
}

.issue-content h1:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.issue-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: var(--spacing-lg) 0 var(--spacing-md);
    color: var(--text-primary);
}

.issue-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: var(--spacing-lg) 0 var(--spacing-sm);
    color: var(--text-primary);
}

.issue-content h4,
.issue-content h5,
.issue-content h6 {
    font-size: 1rem;
    font-weight: 600;
    margin: var(--spacing-md) 0 var(--spacing-sm);
}

.issue-content p {
    margin-bottom: var(--spacing-md);
}

/* Preserve empty paragraphs used for spacing in Google Docs layouts */
.issue-content p:empty,
.issue-content p:has(span:empty) {
    min-height: 1em;
}

.issue-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: var(--spacing-lg) auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.issue-content em {
    font-style: italic;
    color: var(--text-secondary);
}

.issue-content strong {
    font-weight: 600;
}

.issue-content ul,
.issue-content ol {
    margin: var(--spacing-md) 0;
    padding-left: var(--spacing-lg);
}

.issue-content li {
    margin-bottom: var(--spacing-xs);
}

.issue-content blockquote {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-sidebar);
    border-left: 4px solid var(--accent-color);
    font-style: italic;
}

.issue-content a {
    color: var(--accent-color);
    text-decoration: none;
}

.issue-content a:hover {
    text-decoration: underline;
}

/* Data tables - styled with borders and backgrounds */
.issue-content table {
    border-collapse: collapse;
    margin: var(--spacing-lg) 0;
    /* Use full width for two-column layouts */
    width: 100%;
}

.issue-content th,
.issue-content td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    vertical-align: top;
}

/* Layout tables (cells with percentage widths) - no borders, transparent */
.issue-content td[style*="width:"][style*="%"] {
    border: none;
    background: transparent;
}

/* Data tables (cells WITHOUT percentage widths) - show borders */
.issue-content td:not([style*="%"]):not([style*="width"]) {
    border: 1px solid var(--border-color);
}

.issue-content th {
    background: var(--bg-sidebar);
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.issue-content tr:nth-child(even) td:not([style*="%"]) {
    background: var(--bg-sidebar);
}

.issue-content hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: var(--spacing-xl) 0;
}

/* Code blocks */
.issue-content pre,
.issue-content code {
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.issue-content code {
    background: var(--bg-sidebar);
    padding: 2px 6px;
    border-radius: 4px;
}

.issue-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: var(--spacing-md);
    border-radius: 8px;
    overflow-x: auto;
    margin: var(--spacing-md) 0;
}

.issue-content pre code {
    background: transparent;
    padding: 0;
}

/* Issue Footer */
.issue-footer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.issue-nav {
    margin-top: var(--spacing-md);
}

.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-secondary {
    background: var(--bg-sidebar);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--hover-color);
    border-color: var(--accent-color);
}

/* -----------------------------------------------------------------------------
    PDF View
    ----------------------------------------------------------------------------- */

.issue-view-pdf {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pdf-container {
    flex: 1;
    min-height: 0;
}

.pdf-container iframe {
    width: 100%;
    height: 100%;
    min-height: 600px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.pdf-help {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-secondary);
}

.pdf-help a {
    color: var(--accent-color);
}

.error-message {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.error-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.no-content {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.no-content svg {
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.slideshow-container {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.slideshow-container iframe {
    width: 100%;
    height: 600px;
    border: 3px solid #495057;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.slideshow-help {
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px solid #ffb74d;
    border-radius: 8px;
    font-size: 13px;
    color: #e65100;
    font-weight: 600;
    text-align: center;
}

.slideshow-help a {
    color: #1565c0;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
}

.slideshow-help a:hover {
    color: #0d47a1;
    text-decoration: underline;
    text-shadow: 0 0 8px rgba(21, 101, 192, 0.3);
}

/* -----------------------------------------------------------------------------
    Search Results
    ----------------------------------------------------------------------------- */

.search-results {
    max-width: 1000px;
    margin: 0 auto;
}

.search-header {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
}

.search-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.search-query {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.query-label {
    font-weight: 600;
    color: var(--text-primary);
}

.query-text {
    background: var(--bg-sidebar);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-weight: 600;
}

.result-count {
    color: var(--text-muted);
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.search-result-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-lg);
    transition: all 0.15s ease;
}

.search-result-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.result-meta {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.result-type {
    background: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-volume,
.result-issue {
    background: var(--bg-sidebar);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.result-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.result-score {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.score-badge {
    background: var(--selected-color);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.result-title {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 1.2rem;
}

.result-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.result-title a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.result-theme {
    margin-bottom: var(--spacing-sm);
}

.theme-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: var(--spacing-xs);
}

.theme-text {
    color: var(--text-secondary);
}

.result-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.result-keywords,
.result-articles {
    background: var(--bg-sidebar);
    padding: var(--spacing-sm);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.keywords-label,
.articles-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.keyword-tag {
    display: inline-block;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 16px;
    font-size: 0.8rem;
    margin-right: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}

.articles-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.articles-list li {
    padding: 2px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.result-matches {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.matches-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.match-tag {
    background: var(--hover-color);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.no-results {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.no-results-icon {
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.no-results h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.no-results p {
    margin-bottom: var(--spacing-lg);
    font-size: 1.1rem;
    line-height: 1.6;
}

.suggestions {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-sidebar);
    padding: var(--spacing-lg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.suggestions h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.suggestions li {
    padding: var(--spacing-xs) 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: var(--spacing-sm);
}

.suggestions li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* -----------------------------------------------------------------------------
    Responsive Design
    ----------------------------------------------------------------------------- */

/* -----------------------------------------------------------------------------
    Menu & Dropdown Styling
    ----------------------------------------------------------------------------- */

.menu-container {
    position: relative;
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    display: none;
    min-width: 240px;
    padding: var(--spacing-xs);
}

.menu-dropdown.active {
    display: block;
}

.menu-section {
    padding: 4px;
}

.menu-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 8px 12px 4px;
    letter-spacing: 0.5px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
}

.dropdown-item:hover {
    background-color: var(--hover-color);
    color: var(--accent-color);
}

.dropdown-item a {
    color: inherit;
    text-decoration: none;
    flex: 1;
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

/* Menu search styling */
.menu-section .search-container {
    width: 100%;
    margin: 0;
}

.menu-section .search-container input {
    width: 100%;
    margin-right: 0;
}

.menu-section .search-container .icon-btn {
    width: 28px;
    height: 28px;
    padding: 6px;
}

/* Font size controls styling */
.font-size-controls {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs);
    margin-right: var(--spacing-xs);
}

.font-size-controls .icon-btn {
    width: 28px;
    height: 28px;
    padding: 6px;
}

.font-size-controls .icon-btn:hover {
    background-color: var(--hover-color);
}

.font-size-controls .icon-btn:active {
    background-color: var(--selected-color);
}

/* Sort Dropdown Styling */
.sort-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--bg-toolbar);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 8px;
    margin-right: var(--spacing-sm);
}

.menu-dropdown .sort-container {
    background: var(--bg-primary);
    margin: 4px 8px;
}

.sort-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.sort-select {
    border: none;
    background: transparent;
    font-family: var(--font-system);
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    padding: 4px 0;
}

.sort-select:focus {
    color: var(--accent-color);
}

/* -----------------------------------------------------------------------------
    Tabloid Layout Support
    Tabloid pages (11"x17") are wider than letter (8.5"x11"), so they often use
    two-column layouts in Google Docs. The Google Docs CSS classes are preserved
    and injected as a style block, providing the exact widths from the document.
    ----------------------------------------------------------------------------- */

/* Two-column layout tables - let Google Docs widths control the layout */
.issue-article.tabloid-layout .issue-content table {
    width: auto;
    max-width: 100%;
    table-layout: auto;
}

.issue-article.tabloid-layout .issue-content table tr {
    display: table-row;
}

.issue-article.tabloid-layout .issue-content table td {
    /* Don't override Google's widths - they're set via injected CSS classes */
    display: table-cell;
}

/* On small screens, stack the two-column layout into single column */
@media (max-width: 768px) {
    .issue-article.tabloid-layout .issue-content table {
        display: block;
        width: 100%;
    }

    .issue-article.tabloid-layout .issue-content table tbody {
        display: block;
    }

    .issue-article.tabloid-layout .issue-content table tr {
        display: flex;
        flex-direction: column;
    }

    .issue-article.tabloid-layout .issue-content table td {
        display: block;
        width: 100% !important;
        min-width: 0;
    }

    /* Hide empty spacer paragraphs on mobile - they're only needed for desktop alignment */
    .issue-article.tabloid-layout .issue-content table td p:empty,
    .issue-article.tabloid-layout .issue-content table td p:has(span:empty:only-child) {
        display: none;
    }

    /* Style the "Did You Know?" sidebar section on mobile */
    .issue-article.tabloid-layout .issue-content table td:last-child {
        margin-top: var(--spacing-lg);
        padding-top: var(--spacing-lg);
        border-top: 2px solid var(--border-color);
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: var(--sidebar-width-tablet);
    }

    .issue-title {
        font-size: 1.6rem;
    }
}

@media (max-width: 768px) {
    .file-manager {
        grid-template-columns: 1fr;
        grid-template-areas:
            "toolbar"
            "main"
            "statusbar";
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 280px;
        height: 100%;
        z-index: 100;
        transition: left 0.3s ease;
        padding-top: var(--toolbar-height);
    }

    .sidebar.open {
        left: 0;
    }

    #sidebar-close {
        display: flex;
    }

    .mobile-overlay.active {
        display: block;
    }

    .toolbar-center {
        display: none;
    }

    .main-panel {
        padding: var(--spacing-md);
        width: 100%;
        box-sizing: border-box;
        overflow-x: auto; /* Allow horizontal scrolling if content is wide */
    }
    
    /* Fix content overflow issues */
    .issue-content {
        width: 100%;
        box-sizing: border-box;
    }
    
    .issue-content img {
        max-width: 100%;
        height: auto;
    }
    
    .issue-content table {
        max-width: 100%;
        overflow-x: auto;
    }
    
    .issue-content pre {
        white-space: pre-wrap;
        word-wrap: break-word;
    }
    
    /* Mobile menu button - make it smaller */
    .menu-btn {
        width: 28px;
        height: 28px;
        padding: 6px;
    }
    
    /* Mobile search container - adjust width */
    .search-container {
        width: 160px; /* Smaller on mobile */
    }
    
    .toolbar-actions {
        flex-wrap: wrap;
    }
    

    .issue-title {
        font-size: 1.4rem;
    }

    .issue-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .item-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-results-list {
        gap: var(--spacing-md);
    }
    
    .search-result-item {
        padding: var(--spacing-md);
    }
    
    .result-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .item-grid {
        grid-template-columns: 1fr;
    }

    .issue-article {
        padding: 0;
    }
    
    .search-header h1 {
        font-size: 1.4rem;
    }
    
    .search-query {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
    }
}

/* -----------------------------------------------------------------------------
    Print Styles
    ----------------------------------------------------------------------------- */

@media print {
    .file-manager {
        display: block;
        height: auto;
    }

    .toolbar,
    .sidebar,
    .status-bar,
    .issue-toc,
    .issue-nav,
    .toolbar-actions {
        display: none !important;
    }

    .main-panel {
        overflow: visible;
        padding: 0;
    }

    .issue-article {
        max-width: none;
    }

    .issue-content img {
        max-width: 80%;
        page-break-inside: avoid;
    }

    .issue-content h1,
    .issue-content h2,
    .issue-content h3 {
        page-break-after: avoid;
    }

    .issue-content table {
        page-break-inside: avoid;
    }

    a {
        text-decoration: none !important;
        color: inherit !important;
    }
}

/* -----------------------------------------------------------------------------
    Animations
    ----------------------------------------------------------------------------- */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.main-panel {
    animation: fadeIn 0.3s ease;
}
