/* ==========================================================================
   FOCUS NOTES MODULE STYLES (Focus Hub App - Flagship Edition)
   ========================================================================== */

/* ── 1. Library View & Premium Card Grid ────────────────────────────────── */
.notes-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.notes-filter-capsules {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.notes-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 99px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s ease;
}

.notes-filter-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.notes-filter-btn.active {
    background: var(--interactive-subtle);
    border-color: var(--primary-light);
    color: var(--primary-light);
    box-shadow: 0 0 12px var(--primary-glow);
}

.notes-sort-wrapper {
    width: 140px;
    flex-shrink: 0;
}

.notes-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--interactive-subtle);
    color: var(--primary-light);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s ease;
}

.notes-export-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notes-export-btn:hover {
    background: var(--interactive-hover);
    border-color: var(--primary-light);
    box-shadow: 0 0 16px var(--primary-glow);
    transform: translateY(-1px);
}

.notes-export-btn.locked {
    opacity: 0.75;
}

/* Notes Cards Grid */
.notes-library {
    width: 100%;
}

.notes-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
}

.notes-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.notes-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), 0 0 20px var(--primary-glow);
}

.notes-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.notes-card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.35;
    letter-spacing: -0.02em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notes-card-category {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.notes-card-snippet {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.notes-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid var(--divider-color);
}

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

.notes-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 64px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-xl);
    gap: 14px;
}

.notes-empty-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-muted);
    opacity: 0.5;
}

.notes-empty-state p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 400px;
}


/* ── 2. Sleek Theme-Sensitive Highlight System ────────────────────────── */
:root {
    --highlight-bg-sole: color-mix(in srgb, var(--primary-color, #f59e0b) 25%, transparent);
    --highlight-bg-text-sole: var(--text-primary, #FFFFFF);
    --highlight-text-color: var(--primary-light, #fbbf24);
}

html[data-theme="linen"],
:root[data-theme="linen"] {
    --highlight-bg-sole: #FDE68A;
    --highlight-bg-text-sole: #78350F;
    --highlight-text-color: #B45309;
}

html[data-theme="obsidian"],
:root[data-theme="obsidian"],
html[data-theme="default"],
:root[data-theme="default"] {
    --highlight-bg-sole: rgba(6, 182, 212, 0.24);
    --highlight-bg-text-sole: #E0F2FE;
    --highlight-text-color: #38BDF8;
}

html[data-theme="midnight"],
:root[data-theme="midnight"] {
    --highlight-bg-sole: rgba(168, 85, 247, 0.25);
    --highlight-bg-text-sole: #F3E8FF;
    --highlight-text-color: #C084FC;
}

html[data-theme="cyberpunk"],
:root[data-theme="cyberpunk"],
html[data-theme="nebula"],
:root[data-theme="nebula"] {
    --highlight-bg-sole: rgba(6, 182, 212, 0.25);
    --highlight-bg-text-sole: #E0F2FE;
    --highlight-text-color: #38BDF8;
}

html[data-theme="forest"],
:root[data-theme="forest"],
html[data-theme="woods"],
:root[data-theme="woods"] {
    --highlight-bg-sole: rgba(16, 185, 129, 0.25);
    --highlight-bg-text-sole: #D1FAE5;
    --highlight-text-color: #34D399;
}

html[data-theme="sunset"],
:root[data-theme="sunset"] {
    --highlight-bg-sole: rgba(244, 63, 94, 0.25);
    --highlight-bg-text-sole: #FFE4E6;
    --highlight-text-color: #FB7185;
}

/* Marker Icons inside Format Toolbar */
.notes-format-toolbar .highlight-bg-marker {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--highlight-bg-sole);
    border: 1.5px solid var(--highlight-text-color);
}

.notes-format-toolbar .highlight-text-marker {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--highlight-text-color);
    border-bottom: 2.5px solid var(--highlight-text-color);
    line-height: 1;
}

/* ── Highlight Styles: 3 Crisp Aesthetic States ── */
/* Anti-nesting defense: eliminate bloat if legacy or nested elements exist */
.notes-editor-content .writer-highlight-bg .writer-highlight-bg,
.notes-editor-content mark mark,
.notes-editor-content .writer-highlight-text .writer-highlight-text {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* STATE 1: Isolated Background Highlight Only */
.notes-editor-content mark.writer-highlight-bg,
.notes-editor-content .writer-highlight-bg {
    background-color: var(--highlight-bg-sole, rgba(56, 189, 248, 0.22)) !important;
    color: var(--highlight-bg-text-sole, inherit) !important;
    border: none !important;
    border-radius: 4px;
    padding: 1.5px 5px;
    margin: 0 1px;
    font-weight: 600 !important;
    text-shadow: none !important;
    -webkit-text-fill-color: initial !important;
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* STATE 2: Isolated Theme Text Color Highlight Only */
.notes-editor-content span.writer-highlight-text,
.notes-editor-content .writer-highlight-text {
    background: transparent !important;
    color: var(--highlight-text-color, #38bdf8) !important;
    -webkit-text-fill-color: var(--highlight-text-color, #38bdf8) !important;
    font-weight: 700 !important;
    text-shadow: 0 0 12px var(--primary-glow, rgba(56, 189, 248, 0.45)) !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline;
}

/* STATE 3: Mixed (Background Pill + Themed Text Color) */
.notes-editor-content mark.writer-highlight-bg.writer-highlight-text,
.notes-editor-content .writer-highlight-bg.writer-highlight-text,
.notes-editor-content .writer-highlight-bg .writer-highlight-text,
.notes-editor-content .writer-highlight-text .writer-highlight-bg {
    background-color: var(--highlight-bg-sole, rgba(56, 189, 248, 0.22)) !important;
    color: var(--highlight-text-color, #38bdf8) !important;
    -webkit-text-fill-color: var(--highlight-text-color, #38bdf8) !important;
    border: none !important;
    font-weight: 700 !important;
    text-shadow: 0 0 12px var(--primary-glow, rgba(56, 189, 248, 0.45)) !important;
    border-radius: 4px;
    padding: 1.5px 5px;
    margin: 0 1px;
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}


/* ── 3. Full-Viewport Overlay & Sleek Glass Floating Topbar Header ────────── */
.notes-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    background: var(--bg-primary);
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 0;
    animation: editorFadeIn 0.22s var(--ease-out);
}

.notes-editor-overlay.open {
    display: flex;
}

@keyframes editorFadeIn {
    from { opacity: 0; transform: scale(0.99); }
    to   { opacity: 1; transform: scale(1); }
}

/* Centered Editor Container (up to 1380px wide) */
.notes-editor-container {
    width: 100%;
    max-width: clamp(720px, 94vw, 1380px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0 24px 64px 24px;
    margin: 0 auto;
    position: relative;
}

/* Sleek Floating Glass Header (No Cramped Padding or Dark Blocks!) */
.notes-editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    margin-bottom: 24px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    gap: 12px;
    position: sticky;
    top: 14px;
    z-index: 100;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.notes-editor-topbar:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.notes-editor-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notes-editor-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
}

.notes-editor-back-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notes-editor-back-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.06);
}

.notes-editor-back-btn:active {
    transform: scale(0.92);
}

.notes-editor-breadcrumb {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.notes-editor-breadcrumb span {
    color: var(--primary-light);
    font-weight: 700;
}

.notes-editor-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Top Action Icon Buttons (Copy & Paste) */
.notes-icon-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
}

.notes-icon-action-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.06);
}

.notes-icon-action-btn:active {
    transform: scale(0.92);
}

/* Scrollable Inner Content Area */
.notes-editor-scrollable-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.notes-editor-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Editor Title Area */
.notes-editor-title-area {
    padding: 12px 0 0;
    flex-shrink: 0;
}

.notes-editor-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.notes-editor-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.25;
    flex: 1;
    min-width: 0;
}

.notes-editor-category {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.notes-editor-divider {
    height: 1px;
    background: var(--divider-color);
    margin-bottom: 24px;
}

/* Editor Writing Content Body */
.notes-editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.notes-editor-content {
    flex: 1;
    min-height: 70vh;
    outline: none;
    font-family: var(--font-sans);
    font-size: clamp(1.05rem, 0.5vw + 0.95rem, 1.25rem);
    line-height: 1.75;
    color: var(--text-primary);
    tab-size: 2;
    white-space: pre-wrap;
    word-break: break-word;
}

.notes-editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
    font-style: italic;
}

/* ── 4. Selection Format Toolbar & Autosave Indicator ──────────────────── */
.notes-format-toolbar {
    position: fixed;
    z-index: 10001;
    background: rgba(18, 18, 26, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 3px 4px;
    display: none;
    align-items: center;
    gap: 2px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateY(-8px);
    animation: toolbarIn 0.18s var(--ease-spring) both;
    pointer-events: all;
    box-sizing: border-box;
}

.notes-format-toolbar.visible {
    display: flex;
}

@keyframes toolbarIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.95); }
    to   { opacity: 1; transform: translateY(-8px) scale(1); }
}

.notes-fmt-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.82rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, background 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}

.notes-fmt-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.notes-fmt-btn:active {
    transform: scale(0.92);
}

/* Right-most Autosave Status Indicator */
.notes-autosave-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    position: relative;
}

.notes-autosave-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.notes-autosave-indicator.saving .notes-autosave-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(124, 58, 237, 0.15);
    border-top-color: var(--primary-light);
    background: transparent;
    animation: indicatorSpin 0.7s linear infinite;
}

@keyframes indicatorSpin {
    to { transform: rotate(360deg); }
}

.notes-autosave-indicator.saved .notes-autosave-dot {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
    animation: indicatorRipple 1.2s ease-out infinite;
}

@keyframes indicatorRipple {
    0% { box-shadow: 0 0 0 0px rgba(16, 185, 129, 0.6); }
    100% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.notes-autosave-text {
    display: none;
}
