/* Define variables */
:root {
    /* Core colors - Light theme (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #dee2e6;
    --header-height: 64px;
    /* Standardize sidebar widths */
    --sidebar-width: 260px;
    --right-sidebar-width: 260px;
    --font-size-multiplier: 1;
    /* Button colors */
    --button-primary-bg: #c9dbf9;
    --button-primary-text: #000000;
    --button-primary-border: #bebebe;
    --button-secondary-bg: #f3f4f6;
    --button-secondary-text: #374151;
    --button-secondary-border: #d1d5db;
    /* Info box color */
    --info-box-bg: #e6f7ff;
    --info-box-border: #bae3ff;
    --info-box-text: #0c63e4;
}

[data-theme="dark"] {
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --button-primary-bg: #3b82f6;
    --button-primary-text: #000000;
    --button-primary-border: #2563eb;
    --button-secondary-bg: #374151;
    --button-secondary-text: #e5e7eb;
    --button-secondary-border: #4b5563;
    --info-box-bg: #1e3a8a;
    --info-box-border: #2563eb;
    --info-box-text: #dbeafe;
}

/* Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main content specific font sizing */
.main-content {
    font-size: calc(var(--font-size-multiplier) * 1rem);
    box-sizing: border-box;
}

.main-content table, 
.main-content th, 
.main-content td, 
.main-content .text-sm {
    font-size: calc(var(--font-size-multiplier) * 0.875rem);
}

/* Header styles */
.header {
    height: var(--header-height);
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 50;
    box-sizing: border-box;
    transform: translateZ(0);
}

/* Add divider line for right sidebar */
.header::after {
    content: "";
    position: absolute;
    top: 0;
    right: var(--right-sidebar-width);
    height: 100%;
    width: 1px;
    background-color: var(--border-color);
    z-index: 41;
    transform: translateZ(0);
}

/* Hamburger menu */
.hamburger-menu {
    position: absolute;
    left: 15px;
    z-index: 45;
    background-color: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 1rem;
}

.hamburger-menu:hover {
    color: var(--text-primary);
}

/* Logo */
.logo {
    font-weight: 600;
    margin-right: 0;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    padding-left: 2rem;
    /* Update logo width to match sidebar width */
    width: var(--sidebar-width);
    box-sizing: border-box;
    border-right: 1px solid var(--border-color);
    height: 100%;
}

.logo-text {
    display: none; /* Hide logo text as per screenshot */
}

/* Tab navigation */
.nav-tabs {
    display: flex;
    border-bottom: none;
    height: 100%;
    margin-left: 0;
}

.nav-tab {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 1rem;
    position: relative;
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-color);
}

/* Custom tab animation */
.nav-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-tab:hover::after {
    width: 100%;
    left: 0;
}

.nav-tab.active::after {
    width: 100%;
    left: 0;
    bottom: -1px;
}

/* Header controls group - Right side text/cog/dark mode */
.header-controls {
    display: flex;
    align-items: center;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 43;
    width: var(--right-sidebar-width);
    justify-content: center;
}

/* Search box */
.search-container {
    position: absolute;
    right: calc(var(--right-sidebar-width) + 1rem);
    top: 50%;
    transform: translateY(-50%);
    width: 240px;
    z-index: 42;
}

/* Mobile search box - hidden by default */
.mobile-search-container {
    display: none;
    padding: 0.75rem 1rem;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 45;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-input {
    width: 100%;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Theme toggle button */
.theme-toggle {
    background-color: rgba(59, 130, 246, 0.1); /* Light blue background */
    margin-right: 0.5rem;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.theme-toggle i {
    font-size: 1.25rem;
}

/* Toggle right sidebar button */
.toggle-right-sidebar {
    background-color: rgba(107, 114, 128, 0.1); /* Light gray background */
    margin-left: 0;
    margin-right: 0.5rem;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.toggle-right-sidebar:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.toggle-right-sidebar i {
    font-size: 1.25rem;
}

/* Font size controls */
.font-size-controls {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-tertiary);
    white-space: nowrap;
    border-radius: 999px;
    padding: 0.25rem 0.5rem;
    margin-right: 1rem;
}

.font-size-btn {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

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

.text-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Main layout */
.layout {
    display: flex;
    min-height: 100vh;
    padding-top: 64px; /* Use exact pixel value instead of var */
    position: relative;
    margin: 0;
}

/* Left sidebar */
.sidebar {
    /* Updated sidebar width */
    width: var(--sidebar-width);
    background-color: var(--bg-primary);
    height: calc(100vh - 64px); /* Use exact pixel value */
    overflow-y: auto;
    position: fixed;
    top: 64px; /* Use exact pixel value */
    left: 0;
    z-index: 40;
    transition: transform 0.3s ease;
    box-sizing: border-box;
    transform: translateZ(0);
}

/* Use box-shadow for borders in dark mode */
[data-theme="dark"] .sidebar {
    box-shadow: 1px 0 0 0 #333333;
    border-right: none;
}

[data-theme="light"] .sidebar {
    border-right: 1px solid var(--border-color);
}

/* Collapsed sidebar state */
.sidebar.collapsed {
    transform: translateX(-100%);
}

/* Sidebar sections */
.sidebar-section {
    padding-bottom: 1rem;
}

.sidebar-header {
    padding: 1.25rem 1.5rem 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background-color 0.2s;
}

.sidebar-content {
    max-height: none;
    overflow: visible;
}

/* Shared sidebar link base styles */
.sidebar-link,
.right-sidebar-link {
    color: var(--text-secondary);
    transition: background-color 0.2s;
    border-left: 4px solid transparent;
    text-decoration: none;
    border-radius: 0.25rem;
}

/* Shared hover state for both sidebars */
.sidebar-link:hover,
.right-sidebar-link:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-left: 4px solid var(--accent-color);
}

/* Shared active state for both sidebars */
.sidebar-link.active,
.right-sidebar-link.current {
    background-color: var(--bg-tertiary);
    color: var(--accent-color);
    border-left: 4px solid var(--accent-color);
}

/* Left sidebar specific styles */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    margin: 0.25rem 0.5rem;
    font-size: 0.9375rem;
}

.sidebar-link i {
    margin-right: 0.75rem;
    width: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.sidebar-link:hover i {
    color: var(--text-secondary);
}

/* Right sidebar specific styles */
.right-sidebar-link {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    margin: 0.25rem 0 0.25rem 0.5rem;
}

/* For backwards compatibility - can be removed later */
.current {
    background-color: var(--bg-tertiary);
    border-left: 4px solid var(--accent-color);
}

/* Main content */
.main-content {
    flex-grow: 1;
    padding: 2rem;
    margin-left: var(--sidebar-width);
    margin-right: var(--right-sidebar-width);
    width: calc(100% - var(--sidebar-width) - var(--right-sidebar-width));
    transition: margin 0.3s ease, width 0.3s ease;
    box-sizing: border-box;
}

/* Main content when left sidebar is collapsed */
.main-content.left-expanded {
    margin-left: 0;
    width: calc(100% - var(--right-sidebar-width));
}

/* Main content when right sidebar is collapsed */
.main-content.right-expanded {
    margin-right: 0;
    width: calc(100% - var(--sidebar-width));
}

/* Main content when both sidebars are collapsed */
.main-content.fully-expanded {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

/* Tab content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Right sidebar */
.right-sidebar {
    width: var(--right-sidebar-width);
    background-color: var(--bg-primary);
    padding: 1.5rem 1rem;
    height: calc(100vh - 64px); /* Use exact pixel value */
    overflow-y: auto;
    position: fixed;
    top: 64px; /* Use exact pixel value */
    right: 0;
    z-index: 40;
    transition: transform 0.3s ease;
    box-sizing: border-box;
    transform: translateZ(0);
    right: 1px;
}

/* Use box-shadow for borders in dark mode */
[data-theme="dark"] .right-sidebar {
    box-shadow: -1px 0 0 0 #333333;
    border-left: none;
}

[data-theme="light"] .right-sidebar {
    border-left: 1px solid var(--border-color);
}

/* Collapsed right sidebar state */
.right-sidebar.collapsed {
    transform: translateX(100%);
}

.right-sidebar-header {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

/* Info box */
.info-box {
    background-color: var(--info-box-bg);
    border: 1px solid var(--info-box-border);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 2rem;
    box-sizing: border-box;
}

.info-box-title {
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    color: var(--info-box-text);
}

.info-box-title i {
    color: var(--info-box-text);
    margin-right: 0.5rem;
}

.info-content {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* Placeholder content area styling */
.placeholder-content {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    box-sizing: border-box;
}

/* Responsive adjustments */
@media (max-width: 1280px) {
    /* Keep search bar alignment consistent with full width */
    .search-container {
        width: 180px;
        right: calc(var(--right-sidebar-width) + 1rem);
        left: auto;
        transform: translateY(-50%);
    }
}

@media (max-width: 768px) {
    .layout {
        /* Adjust layout to accommodate mobile search bar */
        padding-top: calc(64px + 48px); /* Use exact pixel values */
    }
    
    .sidebar {
        transform: translateX(-100%);
        /* Adjust sidebar position */
        top: calc(64px + 48px);  /* Use exact pixel values */
        height: calc(100vh - 64px - 48px);  /* Use exact pixel values */
    }
    
    .sidebar.visible {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
    }
    
    .right-sidebar {
        transform: translateX(100%);
        /* Adjust right sidebar position */
        top: calc(64px + 48px);  /* Use exact pixel values */
        height: calc(100vh - 64px - 48px);  /* Use exact pixel values */
    }
    
    .right-sidebar.visible {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    
    .logo {
        width: auto;
        border-right: none;
        padding-left: 4rem;
    }
    
    .nav-tab {
        padding: 0 1rem;
    }
    
    /* Hide font size controls on mobile */
    .font-size-controls {
        display: none;
    }
    
    /* Hide the header divider line on mobile */
    .header::after {
        display: none;
    }
    
    /* Hide regular search in mobile view */
    .search-container {
        display: none;
    }
    
    /* Show mobile search bar */
    .mobile-search-container {
        display: block;
    }
    
    .header-controls {
        width: auto;
        right: 1rem;
    }
}

/* Hide any elements in print mode */
@media print {
    .no-print, .sidebar, .right-sidebar, .header {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
        width: 100%;
    }
}

/* Activity item styling */
.activity-item {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1rem;
}

.activity-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Taxonomy level badges */
.taxonomy-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Media print styles for activities */
@media print {
    .activity-item {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd !important;
        border-left-width: 4px !important;
        margin-bottom: 1rem !important;
        padding: 1rem !important;
    }
    
    #generate-btn, .font-size-controls, .theme-toggle, .toggle-right-sidebar {
        display: none !important;
    }
    
    .info-box {
        display: none;
    }
    
    #results-container {
        display: block !important;
    }
    
    #print-btn, #save-btn {
        display: none !important;
    }
    
    h1, h2, h3 {
        color: black !important;
    }
}

/* Dark mode specific styling */
[data-theme="dark"] .activity-item {
    border-color: var(--border-color);
}

/* Checkbox and button styling to match template */
input[type="checkbox"] {
    accent-color: var(--accent-color);
}

button {
    transition: all 0.2s;
}

#generate-btn {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: 1px solid var(--button-primary-border);
}

#generate-btn:hover {
    filter: brightness(0.95);
}

#print-btn, #save-btn {
    background-color: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    border: 1px solid var(--button-secondary-border);
}