/* Anteckna Styles - OneNote-style Layout */

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

/* ===== HEADER BAR ===== */
.notebooks-app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: #f3f2f1;
    border-bottom: 1px solid #e1dfdd;
    min-height: 48px;
    flex-shrink: 0;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Notebook dropdown */
.notebook-dropdown-wrapper {
    position: relative;
}

.notebook-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #323130;
    cursor: pointer;
    transition: background 0.15s;
}

.notebook-dropdown-btn:hover {
    background: #e1dfdd;
}

.notebook-dropdown-btn .bi-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.notebook-dropdown-btn.open .bi-chevron-down {
    transform: rotate(180deg);
}

.notebook-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e1dfdd;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 1050;
    padding: 4px 0;
}

.notebook-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    color: #323130;
    transition: background 0.1s;
}

.notebook-dropdown-menu .dropdown-item:hover {
    background: #f3f2f1;
}

.notebook-dropdown-menu .dropdown-item.active {
    background: #e7f1ff;
    font-weight: 600;
}

.notebook-dropdown-menu .dropdown-item .shared-badge {
    font-size: 0.7rem;
}

.notebook-dropdown-menu .dropdown-divider {
    border-top: 1px solid #e1dfdd;
    margin: 4px 0;
}

.notebook-dropdown-menu .dropdown-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    color: #0078d4;
    transition: background 0.1s;
}

.notebook-dropdown-menu .dropdown-action:hover {
    background: #f3f2f1;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #605e5c;
    font-size: 1.1rem;
    transition: background 0.15s;
}

.header-btn:hover {
    background: #e1dfdd;
}

/* ===== SECTION TABS BAR ===== */
.section-tabs-bar {
    display: flex;
    align-items: flex-end;
    background: #f3f2f1;
    border-bottom: 1px solid #d2d0ce;
    padding: 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    min-height: 38px;
    scrollbar-width: thin;
}

.section-tabs-bar::-webkit-scrollbar {
    height: 3px;
}

.section-tabs-bar::-webkit-scrollbar-thumb {
    background: #c8c6c4;
    border-radius: 3px;
}

.section-tab {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px 6px 0 0;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 500;
    color: #605e5c;
    position: relative;
    bottom: -1px;
    transition: background 0.15s, color 0.15s;
    margin-right: 2px;
    border: 1px solid transparent;
    border-bottom: none;
}

.section-tab:hover {
    background: rgba(255,255,255,0.6);
    color: #323130;
}

.section-tab.active {
    background: #fff;
    color: #323130;
    font-weight: 600;
    border: 1px solid #d2d0ce;
    border-bottom: 1px solid #fff;
}

.section-tab .tab-color-strip {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 6px 6px 0 0;
}

.section-tab-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #605e5c;
    font-size: 1rem;
    margin-left: 4px;
    flex-shrink: 0;
    transition: background 0.15s;
}

.section-tab-add:hover {
    background: #e1dfdd;
}

.section-tabs-empty {
    padding: 8px 16px;
    color: #a19f9d;
    font-size: 0.88rem;
    font-style: italic;
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Editor Area */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid #e1dfdd;
    background: #fff;
    flex-shrink: 0;
}

.editor-header-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.editor-title-input {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    font-weight: 600;
    color: #323130;
    padding: 4px 8px;
    width: 100%;
    outline: none;
}

.editor-title-input:focus {
    background: #f3f2f1;
    border-radius: 4px;
}

.editor-title-input:disabled {
    color: #a19f9d;
}

.save-status {
    margin-left: 12px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.editor-header-actions {
    display: flex;
    gap: 4px;
}

.editor-content {
    flex: 1;
    overflow: hidden;
}

.editor-content .EasyMDEContainer {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.editor-content .EasyMDEContainer .CodeMirror {
    flex: 1;
    border: none;
    border-radius: 0;
}

.editor-content .editor-toolbar {
    border: none;
    border-bottom: 1px solid #e1dfdd;
    border-radius: 0;
    background: #faf9f8;
}

.editor-toolbar button.table {
    width: auto;
}

/* Empty editor state */
.editor-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a19f9d;
}

.editor-empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.editor-empty-state p {
    font-size: 1.1rem;
}

/* ===== NOTES PANEL (right side) ===== */
.notes-panel {
    width: 280px;
    min-width: 280px;
    border-left: 1px solid #e1dfdd;
    background: #faf9f8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #e1dfdd;
    background: #faf9f8;
    flex-shrink: 0;
}

.notes-panel-header .btn-add-page {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: #0078d4;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.notes-panel-header .btn-add-page:hover {
    background: #e1dfdd;
}

.notes-panel-header .btn-add-page:disabled {
    color: #a19f9d;
    cursor: not-allowed;
}

.notes-panel-list {
    flex: 1;
    overflow-y: auto;
}

.note-list-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #edebe9;
    transition: background 0.1s;
}

.note-list-item:hover {
    background: #edebe9;
}

.note-list-item.active {
    background: #e7f1ff;
    border-left: 3px solid #0078d4;
    padding-left: 11px;
}

.note-list-item .note-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #323130;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-list-item .note-date {
    font-size: 0.75rem;
    color: #a19f9d;
    margin-top: 2px;
}

.notes-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #a19f9d;
}

.notes-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
    opacity: 0.4;
    display: block;
}

/* ===== CONTEXT MENU ===== */
.context-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #e1dfdd;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 2000;
    min-width: 180px;
    padding: 4px 0;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #323130;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background 0.1s;
}

.context-menu-item:hover {
    background: #f3f2f1;
}

.context-menu-item.danger {
    color: #a4262c;
}

.context-menu-divider {
    border-top: 1px solid #e1dfdd;
    margin: 4px 0;
}

/* ===== COLOR PICKER ===== */
.color-picker-popup {
    position: fixed;
    background: #fff;
    border: 1px solid #e1dfdd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 2001;
    padding: 12px;
    width: 200px;
}

.color-picker-popup .color-picker-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #323130;
    margin-bottom: 8px;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: #323130;
}

.color-swatch.active {
    border-color: #323130;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #323130;
}

/* ===== SEARCH RESULTS ===== */
.search-result {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.search-result:hover {
    background-color: #f3f2f1;
}

.search-result .result-title {
    font-weight: 500;
}

.search-result .result-path {
    font-size: 0.8rem;
    color: #605e5c;
}

.search-result .result-preview {
    font-size: 0.85rem;
    color: #323130;
    margin-top: 4px;
}

.search-result mark {
    background-color: #fff3cd;
    padding: 0 2px;
}

/* Share list */
.share-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #edebe9;
}

.share-item:last-child {
    border-bottom: none;
}

/* ===== MOBILE STYLES ===== */
.mobile-container {
    display: none;
    height: 100%;
    flex-direction: column;
}

.mobile-view {
    display: none;
    flex-direction: column;
    height: 100%;
    background: #fff;
}

.mobile-view.active {
    display: flex;
}

.mobile-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f3f2f1;
    border-bottom: 1px solid #e1dfdd;
    min-height: 52px;
    flex-shrink: 0;
}

.mobile-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: #323130;
    font-size: 1.2rem;
    margin-right: 12px;
    transition: background 0.15s;
}

.mobile-back-btn:hover {
    background: #e1dfdd;
}

.mobile-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #323130;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-header-actions {
    display: flex;
    gap: 4px;
}

.mobile-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-list-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #edebe9;
    cursor: pointer;
    transition: background 0.1s;
}

.mobile-list-item:active {
    background: #edebe9;
}

.mobile-list-item .item-icon {
    font-size: 1.3rem;
    margin-right: 14px;
    color: #605e5c;
}

.mobile-list-item .item-content {
    flex: 1;
    min-width: 0;
}

.mobile-list-item .item-name {
    font-size: 1rem;
    font-weight: 500;
    color: #323130;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-list-item .item-meta {
    font-size: 0.8rem;
    color: #a19f9d;
    margin-top: 2px;
}

.mobile-list-item .item-chevron {
    color: #c8c6c4;
    font-size: 1rem;
    margin-left: 8px;
}

.mobile-section-item {
    border-left: 4px solid transparent;
}

.mobile-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #0078d4;
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    z-index: 100;
}

.mobile-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.mobile-fab:disabled {
    background: #c8c6c4;
    cursor: not-allowed;
    box-shadow: none;
}

.mobile-editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mobile-editor-title {
    padding: 12px 16px;
    border-bottom: 1px solid #e1dfdd;
}

.mobile-editor-title input {
    border: none;
    background: transparent;
    font-size: 1.2rem;
    font-weight: 600;
    width: 100%;
    outline: none;
    color: #323130;
}

.mobile-editor-content {
    flex: 1;
    overflow: hidden;
}

.mobile-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a19f9d;
}

.mobile-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
    display: block;
}

/* ===== DESKTOP LAYOUT (default) ===== */
.desktop-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .desktop-container {
        display: none !important;
    }

    .mobile-container {
        display: flex !important;
    }

    .mobile-editor-host {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .mobile-editor-host .editor-header-actions,
    .mobile-editor-host .save-status {
        display: none !important;
    }

    body {
        overflow: auto;
    }
}

/* ===== OVERLAY for closing dropdowns ===== */
.dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
}
