/* Memory Professional Edition - Main CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Surfaces */
    --surface-0: #FFFFFF;
    /* Основной фон контента */
    --surface-1: #F9FAFB;
    /* Фон страницы, сайдбары (gray-50) */
    --surface-2: #F3F4F6;
    /* Hover states, Inputs (gray-100) */
    --surface-3: #E5E7EB;
    /* Active states, Dividers (gray-200) */

    /* Borders */
    --border-subtle: #E5E7EB;
    /* Default borders (gray-200) */
    --border-focus: #D1D5DB;
    /* Active/Focus states (gray-300) */

    /* Text */
    --text-main: #111827;
    /* Primary content (gray-900) */
    --text-secondary: #6B7280;
    /* Meta data, hints (gray-500) */
    --text-tertiary: #9CA3AF;
    /* Placeholders, disabled (gray-400) */

    /* Brand/Action */
    --brand-primary: #2563EB;
    /* Primary buttons, Active links (blue-600) */
    --brand-hover: #1D4ED8;
    /* Hover state (blue-700) */

    /* Status */
    --status-success: #10B981;
    --status-warning: #F59E0B;
    --status-error: #EF4444;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;

    --site-max-width: none;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--surface-1);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

button {
    font-family: inherit;
}

/* Utilities */
.container {
    max-width: var(--site-max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Atomic Text Classes */
.text-xs {
    font-size: var(--font-size-xs);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.text-base {
    font-size: var(--font-size-base);
}

.text-lg {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.text-xl {
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

.text-brand {
    color: var(--brand-primary);
}

/* Components: Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--brand-hover);
}

.btn-secondary {
    background-color: var(--surface-0);
    border-color: var(--border-subtle);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: var(--surface-1);
    border-color: var(--border-focus);
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-ghost:hover {
    background-color: var(--surface-2);
    color: var(--text-main);
}

/* Components: Inputs */
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background-color: var(--surface-0);
    color: var(--text-main);
    font-size: var(--font-size-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Components: Cards */
.card {
    background: var(--surface-0);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: var(--space-lg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Utility: Layouts */
.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--space-sm);
}

.gap-4 {
    gap: var(--space-md);
}

.hidden {
    display: none;
}

/* Layouts: 3-Panel Grid (High End) */
.page-layout-3col {
    display: grid;
    grid-template-columns: 260px 1fr 340px;
    grid-template-rows: calc(100vh - 60px);
    /* Full height minus header */
    gap: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    overflow: hidden;
}

@media (max-width: 1280px) {
    .page-layout-3col {
        grid-template-columns: 240px 1fr 280px;
    }
}

@media (max-width: 1024px) {
    .page-layout-3col {
        grid-template-columns: 0 1fr 300px;
        /* Hide left sidebar on tablet */
    }
}

@media (max-width: 768px) {
    .page-layout-3col {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        overflow-y: auto;
    }
}

/* Panel Areas */
.col-sidebar-left {
    background: var(--surface-1);
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.col-main-content {
    background: var(--surface-0);
    overflow-y: auto;
    padding: 32px 40px;
    /* Aligned with navbar padding */
    position: relative;
}

.col-inspector-right {
    background: var(--surface-1);
    border-left: 1px solid var(--border-subtle);
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Typography Helpers for Content */
.prose {
    max-width: 720px;
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-main);
}

.prose h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.prose h2 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.prose p {
    margin-bottom: 16px;
}

/* Component: Metadata List */
.meta-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.meta-value {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
}

/* Global Search Styles (Refactored) */
#globalSearchContainer {
    position: fixed;
    top: 15vh;
    left: 50%;
    transform: translate(-50%, -10px) scale(0.98);
    width: 850px;
    max-width: 95%;
    background: var(--surface-0);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

#globalSearchContainer.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0) scale(1);
}

.search-input-wrapper {
    position: relative;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-0);
    transition: all 0.2s ease;
}

#globalSearchContainer.active .search-input-wrapper:focus-within {
    background: #fcfdfe;
    border-bottom-color: var(--brand-primary);
    box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.1);
}

.search-input-wrapper svg {
    transition: all 0.2s ease;
}

.search-input-wrapper:focus-within svg {
    color: var(--brand-primary) !important;
    transform: scale(1.1);
}

#searchBackdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    backdrop-filter: blur(4px);
}

/* Search Items Grid */
.search-item {
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) auto 60px 30px !important;
    grid-template-areas: "icon content badges date arrow" !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 24px !important;
    min-height: 64px !important;
    height: auto !important;
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item.selected {
    background: var(--surface-1) !important;
    box-shadow: inset 4px 0 0 var(--brand-primary);
}

.search-icon {
    grid-area: icon;
    font-size: 20px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-content-col {
    grid-area: content;
    min-width: 0;
}

.search-badges-col {
    grid-area: badges;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.search-date-col {
    grid-area: date;
    text-align: right;
    color: var(--text-tertiary);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.search-arrow-col {
    grid-area: arrow;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--border-focus);
}

.search-group-header {
    padding: 12px 24px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.05em;
    background: #fcfdfe;
    border-bottom: 1px solid var(--border-subtle);
}

/* Filters Row */
.search-filters-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-0);
    flex-wrap: wrap;
}

.filter-chip {
    padding: 4px 10px;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.filter-chip:hover {
    background: var(--surface-2);
    border-color: var(--border-focus);
    color: var(--text-main);
}

.filter-chip.active {
    background: #eff6ff;
    /* brand-light */
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.filter-divider {
    width: 1px;
    height: 12px;
    background: var(--border-subtle);
    margin: 0 4px;
}

.date-filter-select {
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-0);
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    height: 24px;
}

.date-filter-select:hover {
    border-color: var(--border-focus);
}

.date-filter-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}