
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fira+Code:wght@400;500;600&display=swap');

:root {
    --bg-main: #1e1e1e;
    --bg-panel: #252526;
    --border-color: #3c3c3c;
    --text-main: #cccccc;
    --text-light: #ffffff;
    --accent: #007acc;
    --accent-hover: #0062a3;
    --accent-glow: rgba(0, 122, 204, 0.25);
    --input-bg: #3c3c3c;
    --input-focus-bg: #1e1e1e;
    --danger: #f14c4c;
    --danger-hover: #d13b3b;
    --success: #22c55e;
    --card-bg: #2d2d2d;
    --shadow-main: rgba(0, 0, 0, 0.4);
    --modal-shadow: rgba(0, 0, 0, 0.7);
}

body.light-mode {
    --bg-main: #ffffff;
    --bg-panel: #f3f3f3;
    --border-color: #cccccc;
    --text-main: #333333;
    --text-light: #000000;
    --accent: #007acc;
    --accent-hover: #005f9e;
    --accent-glow: rgba(0, 122, 204, 0.15);
    --input-bg: #f3f3f3;
    --input-focus-bg: #ffffff;
    --card-bg: #eaeaea;
    --shadow-main: rgba(0, 0, 0, 0.08);
    --modal-shadow: rgba(0, 0, 0, 0.2);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: var(--accent);
    color: #ffffff;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 50;
}

.logo {
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
    font-size: 16px;
    user-select: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-switch {
    width: 52px;
    height: 26px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 99px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    font-size: 11px;
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s;
}
.theme-switch:hover {
    background: rgba(0, 0, 0, 0.35);
}
.theme-switch .circle {
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    left: 3px;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
body.light-mode .theme-switch .circle {
    transform: translateX(24px);
}

.user-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700; 
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}
.user-badge:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 700; 
    font-size: 13px;
    transition: all 0.2s ease;
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #ffffff;
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
}

.editor-title-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
}
.editor-title-bar input {
    width: 100%;
    padding: 10px 14px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    border-radius: 4px;
    outline: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.editor-title-bar input:focus {
    border-color: var(--accent);
    background-color: var(--input-focus-bg);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
#note-title {
    font-size: 16px;
    font-weight: 700;
}

#editor-container {
    flex: 1;
    overflow-y: auto;
}
.ql-toolbar.ql-snow {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: var(--bg-panel) !important;
    padding: 8px 20px !important;
}
.ql-container.ql-snow {
    border: none !important;
    background: var(--bg-main) !important;
    color: var(--text-light) !important;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
}
.ql-editor {
    padding: 24px 30px !important;
}
.ql-snow .ql-stroke { stroke: var(--text-main) !important; }
.ql-snow .ql-fill { fill: var(--text-main) !important; }
.ql-snow .ql-picker { color: var(--text-main) !important; font-weight: 700 !important; }
.ql-snow .ql-picker-options { background-color: var(--bg-panel) !important; border-color: var(--border-color) !important; border-radius: 4px; padding: 6px !important; }
.ql-snow .ql-picker-item:hover { color: var(--text-light) !important; background-color: rgba(255,255,255,0.05) !important; }

.ql-syntax {
    background-color: #1e1e1e !important;
    color: #d4d4d4 !important;
    padding: 16px 20px !important;
    border-radius: 6px;
    font-family: 'Fira Code', Consolas, Monaco, monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    border: 1px solid var(--border-color) !important;
    margin: 12px 0 !important;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
}

.settings-section {
    width: 300px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    padding: 24px 20px;
    overflow-y: auto;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-main);
    font-weight: 800; 
    letter-spacing: 1.2px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-main);
    font-weight: 700; 
    font-size: 12px;
}

.settings-section input, 
.settings-section select {
    width: 100%;
    padding: 10px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    outline: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.settings-section input:focus, 
.settings-section select:focus {
    border-color: var(--accent);
    background-color: var(--input-focus-bg);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group {
    display: flex;
    border-radius: 4px;
    overflow: hidden;
}
.input-group select {
    width: 45%;
    border-radius: 4px 0 0 4px;
    border-right: none;
}
.input-group input {
    width: 55%;
    border-radius: 0 4px 4px 0;
}

.hint {
    font-size: 11px;
    color: #f59e0b;
    font-style: italic;
    font-weight: 500;
    margin-top: 2px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #ffffff;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 700; 
    font-size: 14px;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.25);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 122, 204, 0.4);
}
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 122, 204, 0.3);
}

#manager-view {
    background-color: var(--bg-main);
    overflow-y: auto;
}

.manager-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}
.manager-header-bar h2 {
    font-weight: 800;
    color: var(--text-light);
}

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

.note-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    padding: 22px;
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-main);
    transition: all 0.25s ease;
}
.note-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
.note-card h3 {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 6px;
    font-weight: 700;
}
.meta-desc {
    font-size: 13px;
    color: var(--text-main);
    margin-bottom: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.note-card .meta {
    font-size: 12px;
    color: var(--text-main);
    display: flex;
    gap: 16px;
    font-weight: 600;
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(6px); 
}
.modal-overlay.active {
    display: flex;
    animation: fadeInOverlay 0.2s ease-out forwards;
}
@keyframes fadeInOverlay {
    from { opacity: 0; } to { opacity: 1; }
}

.modal-box {
    background: var(--bg-panel);
    padding: 40px 36px;
    border: 1px solid var(--border-color);
    width: 400px;
    border-radius: 12px;
    box-shadow: 0 24px 64px var(--modal-shadow);
    position: relative;
    border-top: 4px solid var(--accent); 
    transform: translateY(0);
    animation: slideUpModal 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; 
}
@keyframes slideUpModal {
    from { transform: translateY(40px) scale(0.94); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-box h2 {
    margin-bottom: 28px;
    font-size: 24px;
    color: var(--text-light);
    font-weight: 800; 
    text-align: center;
    letter-spacing: -0.3px;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 22px;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}
.modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--danger);
    transform: rotate(90deg);
}
body.light-mode .modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.modal-box .form-group input {
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.18); 
    border: 1px solid var(--border-color);
    width: 100%;
    color: var(--text-light);
    transition: all 0.25s ease;
}
body.light-mode .modal-box .form-group input {
    background: #ffffff;
    border-color: #d1d5db;
}
.modal-box .form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow); 
    background: var(--bg-main);
}

.modal-box .btn-primary {
    padding: 14px;
    font-size: 15px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 12px;
    box-shadow: 0 4px 16px rgba(0, 122, 204, 0.35);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--accent);
    color: #ffffff;
    padding: 0 20px;
    font-size: 12px;
    height: 26px;
    font-weight: 600; 
    user-select: none;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
    z-index: 50;
}
.status-left, .status-right {
    display: flex;
    align-items: center;
}
.status-left span, .status-right span {
    padding: 0 10px;
    height: 26px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s ease;
}
.status-left span:hover, .status-right span:hover {
    background: rgba(255, 255, 255, 0.18);
}
.status-right a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 800; 
    border-bottom: 1px dashed rgba(255,255,255,0.6);
    transition: all 0.2s;
}
.status-right a:hover {
    border-bottom-style: solid;
    background: rgba(255, 255, 255, 0.1);
}

.text-danger { color: var(--danger) !important; font-weight: 600; text-align: center; font-size: 12px; display: block; margin-top: 10px;}
.text-green { color: var(--success) !important; font-weight: 600; }
.text-secondary { color: var(--text-main) !important; }

@media (max-width: 900px) {
    .container { flex-direction: column; overflow-y: auto; }
    .settings-section { width: 100%; border-left: none; border-top: 1px solid var(--border-color); }
    .editor-wrapper { min-height: 400px; }
}

@media (max-width: 850px) {
    .container {
        flex-direction: column; 
        overflow-y: auto;
    }
    .settings-section {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding: 20px;
    }
    .editor-section { min-height: 500px; }
    .app-header { flex-wrap: wrap; gap: 10px; justify-content: center;}
    .header-right { flex-wrap: wrap; justify-content: center; width: 100%;}
    
 
    .ql-toolbar.ql-snow {
        white-space: normal;
    }
   
    .modal-box { width: 90%; padding: 25px 20px; }
}


.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(0,0,0,0.2);
}
.history-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: 13px;
    transition: 0.2s;
}
.history-item:hover { background: rgba(255,255,255,0.05); }
.history-item:last-child { border-bottom: none; }
.history-btn {
    background: var(--accent); color: white; border: none; padding: 6px 12px;
    border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.history-btn:hover { background: #005f9e; }
.btn-warning { background: #f59e0b; margin-bottom: 15px; color: #000;}
.btn-warning:hover { background: #d97706; }

.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(15, 23, 42, 0.95);
    color: #fff;
    padding: 10px 24px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    z-index: 99999;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
    .toast-notification {
        bottom: 85px; 
    }
}