* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --accent-color: #f59e0b;
    --background-light: #f8fafc;
    --surface-light: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --sidebar-width: 280px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: var(--background-light);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.container {
    display: flex;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.1), transparent);
    pointer-events: none;
}

.sidebar-header {
    padding: 28px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

.sidebar-header h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header h1 i {
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.subtitle {
    font-size: 13px;
    opacity: 0.85;
    font-weight: 500;
}

.notebooks-section {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    position: relative;
    z-index: 1;
}

.notebooks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 0 8px;
}

.notebooks-header h2 {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.9;
    text-transform: uppercase;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 8px 10px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.notebooks-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notebook-item {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    font-weight: 500;
    font-size: 14px;
}

.notebook-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.notebook-item.active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

.btn-settings {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-settings:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--background-light);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 24px;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
}

.empty-state i {
    font-size: 88px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.empty-state h2 {
    font-size: 32px;
    color: var(--text-primary);
    font-weight: 700;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 16px;
}

.notebook-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.notebook-view.hidden {
    display: none;
}

.empty-state.hidden {
    display: none;
}

.notebook-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-light);
    box-shadow: var(--shadow-sm);
}

.notebook-title-section {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.notebook-title-section h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    font-weight: 700;
}

.notebook-title-section .btn-icon {
    background: var(--background-light);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.notebook-title-section .btn-icon:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.notebook-title-section .btn-icon.delete:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--background-light);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
}

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

.notes-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.notes-list-section {
    width: 320px;
    background: var(--background-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-list-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-light);
}

.notes-list-header h3 {
    font-size: 15px;
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.notes-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 8px 8px;
}

.note-item {
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    border-radius: 6px;
    margin-bottom: 6px;
    background: transparent;
}

.note-item:hover {
    background: var(--surface-light);
    box-shadow: var(--shadow-sm);
}

.note-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.note-item-title {
    font-weight: 600;
    color: inherit;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.note-item.active .note-item-title {
    color: white;
}

.note-item-preview {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item.active .note-item-preview {
    color: rgba(255, 255, 255, 0.8);
}

.note-item-date {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.note-item.active .note-item-date {
    color: rgba(255, 255, 255, 0.7);
}

.note-editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface-light);
    overflow: hidden;
}

.no-note-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 14px;
    color: var(--text-secondary);
}

.no-note-selected i {
    font-size: 72px;
    color: var(--text-tertiary);
    opacity: 0.4;
}

.editor-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-wrapper.hidden {
    display: none;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-light);
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    gap: 4px;
    padding: 0 8px;
    border-right: 1px solid var(--border-color);
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    padding: 8px 12px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.toolbar-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.toolbar-spacer {
    flex: 1;
}

.note-status {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 12px;
    font-weight: 500;
}

.note-status.saved {
    color: var(--success);
}

.note-title-input {
    padding: 20px 24px;
    font-size: 28px;
    font-weight: 700;
    border: none;
    outline: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    width: 100%;
}

.note-title-input:focus {
    border-bottom-color: var(--primary-color);
    background: linear-gradient(to bottom, transparent, rgba(99, 102, 241, 0.02));
}

.note-editor {
    flex: 1;
    padding: 20px 24px;
    outline: none;
    overflow-y: auto;
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
}

.note-editor:focus {
    outline: none;
}

.note-editor p {
    margin-bottom: 14px;
}

.note-editor ul, .note-editor ol {
    margin: 14px 0 14px 24px;
}

.note-editor li {
    margin-bottom: 8px;
}

.note-editor a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
    transition: var(--transition);
}

.note-editor a:hover {
    border-bottom-color: var(--primary-color);
}

.note-meta {
    padding: 12px 24px;
    font-size: 12px;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-color);
    background: var(--background-light);
    font-weight: 500;
}

/* BUTTONS */
.btn-primary {
    padding: 11px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary-small {
    padding: 7px 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-primary-small:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    padding: 11px 24px;
    background: var(--background-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    padding: 11px 24px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-block {
    width: 100%;
    margin-bottom: 12px;
}

/* MODALS */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface-light);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 500px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-small {
    max-width: 400px;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.btn-close:hover {
    color: var(--text-primary);
    background: var(--background-light);
}

.modal-body {
    padding: 24px;
}

.modal-body input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    background: var(--background-light);
    color: var(--text-primary);
}

.modal-body input::placeholder {
    color: var(--text-tertiary);
}

.modal-body input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--surface-light);
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--background-light);
}

/* SETTINGS MODAL */
.settings-section {
    margin-bottom: 28px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.settings-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar {
        width: 260px;
    }

    .notes-list-section {
        width: 280px;
    }

    .notebook-title-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .notebook-header {
        padding: 20px 24px;
    }

    .note-title-input {
        font-size: 24px;
        padding: 16px 20px;
    }
}

@media (max-width: 600px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .notebooks-section {
        max-height: 200px;
        padding: 12px;
    }

    .notes-list-section {
        display: none;
    }

    .note-editor-section {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }
}

.hidden {
    display: none !important;
}