/**
 * NOTES LAYOUT v6.0 CSS - World Class Design
 * ProductiveApp - Multi-panes resizable layout
 */

/* ========== LAYOUT STRUCTURE ========== */

.notes-v6-layout {
    display: flex;
    height: 100%;
    width: 100%;
    background: var(--bg-primary, #0a0e1a);
    color: var(--text-primary, #e4e7ec);
    overflow: hidden;
    position: relative;
}

.notes-v6-layout.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

/* ========== SIDEBAR ========== */

.notes-v6-sidebar {
    min-width: 200px;
    max-width: 400px;
    background: var(--bg-secondary, #0f1420);
    border-right: 1px solid var(--border-color, rgba(255,255,255,0.08));
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.notes-v6-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    flex-shrink: 0;
}

.notes-v6-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notes-v6-logo svg {
    color: var(--primary-color, var(--accent));
    flex-shrink: 0;
}

.notes-v6-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.notes-v6-header-actions {
    display: flex;
    gap: 6px;
}

/* Sidebar Tabs */
.notes-v6-sidebar-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 12px 0 12px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    flex-shrink: 0;
}

.notes-v6-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px 6px 0 0;
    color: var(--text-secondary, #9ca3af);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    position: relative;
}

.notes-v6-tab svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.notes-v6-tab:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary, #e4e7ec);
}

.notes-v6-tab.active {
    background: var(--bg-primary, #0a0e1a);
    color: var(--primary-color, var(--accent));
    border-bottom: 2px solid var(--primary-color, var(--accent));
}

.notes-v6-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color, var(--accent));
    box-shadow: 0 0 8px var(--primary-color, var(--accent));
}

/* Sidebar Content */
.notes-v6-sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
}

.notes-v6-sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.notes-v6-sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.notes-v6-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.notes-v6-sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.15);
}

/* Sidebar Footer */
.notes-v6-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.08));
    flex-shrink: 0;
}

.notes-v6-btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--primary-color, var(--accent)) 0%, var(--accent-light) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease-out, border-color 0.3s ease-out, opacity 0.3s ease-out;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 20%, transparent);
}

.notes-v6-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
}

.notes-v6-btn-primary:active {
    transform: translateY(0);
}

.notes-v6-btn-primary svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

/* ========== RESIZE HANDLES ========== */

.notes-v6-resize-handle {
    width: 4px;
    background: transparent;
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s ease;
    z-index: 10;
}

.notes-v6-resize-handle::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -2px;
    right: -2px;
}

.notes-v6-resize-handle:hover,
.notes-v6-resize-handle.dragging {
    background: var(--primary-color, var(--accent));
}

.notes-v6-resize-handle.dragging {
    box-shadow: 0 0 12px var(--primary-color, var(--accent));
}

/* ========== MAIN EDITOR AREA ========== */

.notes-v6-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 400px;
    background: var(--bg-primary, #0a0e1a);
    overflow: hidden;
}

/* Command Bar */
.notes-v6-command-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #0f1420);
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    flex-shrink: 0;
}

.notes-v6-btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}

.notes-v6-btn-icon:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary, #e4e7ec);
}

.notes-v6-btn-icon svg {
    width: 16px;
    height: 16px;
}

/* Quick Search */
.notes-v6-quick-search {
    flex: 1;
    max-width: 500px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}

.notes-v6-quick-search:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--primary-color, var(--accent));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.notes-v6-quick-search svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary, #9ca3af);
}

.notes-v6-search-placeholder {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary, #9ca3af);
}

.notes-v6-quick-search kbd {
    padding: 2px 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #9ca3af);
    font-family: monospace;
}

/* View Controls */
.notes-v6-view-controls {
    display: flex;
    gap: 4px;
    padding: 0 8px;
    border-left: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-right: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

/* Tabs */
.notes-v6-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-secondary, #0f1420);
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    overflow-x: auto;
    flex-shrink: 0;
}

.notes-v6-tabs::-webkit-scrollbar {
    height: 4px;
}

/* Editor Container */
.notes-v6-editor-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
}

.notes-v6-editor-container::-webkit-scrollbar {
    width: 8px;
}

.notes-v6-editor-container::-webkit-scrollbar-track {
    background: transparent;
}

.notes-v6-editor-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.notes-v6-editor-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.15);
}

/* ========== BACKLINKS PANEL ========== */

.notes-v6-backlinks-panel {
    min-width: 200px;
    max-width: 500px;
    background: var(--bg-secondary, #0f1420);
    border-left: 1px solid var(--border-color, rgba(255,255,255,0.08));
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.notes-v6-panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    flex-shrink: 0;
}

.notes-v6-panel-tabs {
    display: flex;
    gap: 8px;
}

.notes-v6-panel-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary, #9ca3af);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
}

.notes-v6-panel-tab:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary, #e4e7ec);
}

.notes-v6-panel-tab.active {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--primary-color, var(--accent));
}

.notes-v6-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.notes-v6-panel-content::-webkit-scrollbar {
    width: 6px;
}

.notes-v6-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.notes-v6-panel-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

/* ========== PLACEHOLDERS ========== */

.notes-v6-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary, #9ca3af);
    font-size: 14px;
    line-height: 1.6;
}

/* ========== SPLIT VIEW ========== */

.notes-v6-layout[data-split="vertical"] .notes-v6-editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.notes-v6-layout[data-split="horizontal"] .notes-v6-editor-container {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 1024px) {
    .notes-v6-sidebar {
        max-width: 280px;
    }

    .notes-v6-backlinks-panel {
        max-width: 320px;
    }

    .notes-v6-layout[data-split="vertical"] .notes-v6-editor-container,
    .notes-v6-layout[data-split="horizontal"] .notes-v6-editor-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
}

@media (max-width: 768px) {
    .notes-v6-sidebar,
    .notes-v6-backlinks-panel {
        position: absolute;
        top: 0;
        bottom: 0;
        z-index: 100;
    }

    .notes-v6-sidebar {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .notes-v6-backlinks-panel {
        right: 0;
        box-shadow: -4px 0 20px rgba(0,0,0,0.3);
    }
}

/* ========== ANIMATIONS ========== */

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.notes-v6-sidebar-content > * {
    animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notes-v6-panel-content > * {
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== DARK MODE OVERRIDES ========== */

:root[data-theme*="light"] .notes-v6-layout {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: rgba(0,0,0,0.08);
}

:root[data-theme*="light"] .notes-v6-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
}

:root[data-theme*="light"] .notes-v6-btn-primary {
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 15%, transparent);
}
