/* ================= БАЗОВЫЕ СТИЛИ ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root {
    --bg: linear-gradient(120deg, #f3f4f6, #e2e8f0);
    --panel: rgba(255, 255, 255, 0.7);
    --text: #111;
    --border: rgba(0, 0, 0, 0.06);
    --accent2: #111;
    --accent: #ffd84d;
    --toolbar: #e5e7eb;
    --glow: rgba(255, 216, 77, 0.0);
    --success: #10b981;
    --btn-text: #000000;
}

body.dark {
    --bg: linear-gradient(120deg, #020617, #0f172a);
    --panel: rgba(30, 41, 59, 0.7);
    --text: #f8fafc;
    --border: rgba(255, 255, 255, 0.06);
    --accent: #ffd84d;
    --toolbar: #1e293b;
    --glow: rgba(250, 204, 21, 0.25);
    --success: #059669;
    --btn-text: #f8fafc;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, sans-serif;
    height: 100vh;
    overflow: hidden;
}

/* ================= ОВЕРЛЕЙ ТЕМЫ ================= */
.theme-overlay {
    position: fixed;
    inset: 0;
    backdrop-filter: blur(0px);
    opacity: 0;
    pointer-events: none;
    transition: 0.6s;
    z-index: 100;
}

.theme-overlay.active {
    backdrop-filter: blur(10px);
    opacity: 1;
}

/* ================= ОСНОВНОЙ ЛАЙАУТ ================= */
.app {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* ================= САЙДБАР ================= */
.sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 40px var(--glow);
    backdrop-filter: blur(20px);
}

/* Верхняя часть сайдбара */
.sidebar-top {
    padding: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--accent);
    text-shadow: 0 0 10px var(--glow);
}

.sidebar h2:hover {
    color: var(--accent);
    transform: translateY(-2px);
    text-shadow: 0 5px 15px var(--glow);
}

/* Кнопка новой заметки */
.new-note {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background: var(--accent);
    color: var(--btn-text);
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 20px var(--glow);
    transition: all 0.3s ease;
}

.new-note:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: 0 5px 25px var(--glow);
}

/* Список заметок */
.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Стили для скроллбара */
.notes-list::-webkit-scrollbar {
    width: 6px;
}

.notes-list::-webkit-scrollbar-track {
    background: transparent;
}

.notes-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.notes-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Элементы заметок */
.note-item {
    padding: 14px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.note-item:hover {
    background: var(--toolbar);
    border-color: var(--border);
}

.note-item.active {
    background: var(--toolbar);
    border: 1px solid var(--accent);
    box-shadow: 0 0 20px var(--glow);
}

.note-title {
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-time {
    font-size: 12px;
    opacity: 0.7;
}

/* Цвета заметок */
.note-item[data-color="default"] { 
    border-left: 4px solid var(--accent);
    opacity: 0.9;
}

.note-item[data-color="yellow"] { 
    border-left: 4px solid #facc15;
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.1) 0%, transparent 100%);
}

.note-item[data-color="blue"] { 
    border-left: 4px solid #60a5fa;
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.1) 0%, transparent 100%);
}

.note-item[data-color="green"] { 
    border-left: 4px solid #4ade80;
    background: linear-gradient(90deg, rgba(74, 222, 128, 0.1) 0%, transparent 100%);
}

.note-item[data-color="pink"] { 
    border-left: 4px solid #f472b6;
    background: linear-gradient(90deg, rgba(244, 114, 182, 0.1) 0%, transparent 100%);
}

/* Для активной заметки */
.note-item.active[data-color="default"] { 
    background: var(--toolbar);
    opacity: 1;
}

.note-item.active[data-color="yellow"] { 
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.15) 0%, var(--toolbar) 100%);
}

.note-item.active[data-color="blue"] { 
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.15) 0%, var(--toolbar) 100%);
}

.note-item.active[data-color="green"] { 
    background: linear-gradient(90deg, rgba(74, 222, 128, 0.15) 0%, var(--toolbar) 100%);
}

.note-item.active[data-color="pink"] { 
    background: linear-gradient(90deg, rgba(244, 114, 182, 0.15) 0%, var(--toolbar) 100%);
}

/* Эффект при наведении на цветные заметки */
.note-item[data-color="yellow"]:hover {
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.2) 0%, transparent 100%);
}

.note-item[data-color="blue"]:hover {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.2) 0%, transparent 100%);
}

.note-item[data-color="green"]:hover {
    background: linear-gradient(90deg, rgba(74, 222, 128, 0.2) 0%, transparent 100%);
}

.note-item[data-color="pink"]:hover {
    background: linear-gradient(90deg, rgba(244, 114, 182, 0.2) 0%, transparent 100%);
}

/* Нижняя часть сайдбара */
.sidebar-bottom {
    padding: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    background: var(--panel);
    margin-top: auto;
}

/* Кнопка смены темы */
.theme-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: var(--toolbar);
    color: var(--text);
    font-size: 16px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.theme-icon {
    font-size: 18px;
}

.theme-text {
    font-weight: 500;
}

/* ================= ОСНОВНОЙ КОНТЕНТ ================= */
.content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

/* Стиль для заголовка заметки в редакторе */
.note-title-input {
    width: 100%;
    font-size: 24px;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    font-weight: 500;
}

.note-title-input[data-color="default"] {
    border-left: 4px solid var(--accent);
}

.note-title-input[data-color="yellow"] {
    border-left: 4px solid #facc15;
}

.note-title-input[data-color="blue"] {
    border-left: 4px solid #60a5fa;
}

.note-title-input[data-color="green"] {
    border-left: 4px solid #4ade80;
}

.note-title-input[data-color="pink"] {
    border-left: 4px solid #f472b6;
}

.note-text-input {
    width: 100%;
    min-height: 300px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    resize: vertical;
    font-size: 16px;
    line-height: 1.6;
}

.note-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.note-actions button,
.note-actions select {
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--toolbar);
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn {
    background: linear-gradient(120deg, #10b981, #059669) !important;
    color: white !important;
    font-weight: 600 !important;
    border: none !important;
}

.delete-btn {
    background: linear-gradient(120deg, #ef4444, #dc2626) !important;
    color: white !important;
    font-weight: 600 !important;
    border: none !important;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
}

.delete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(239, 68, 68, 0.4);
}

select {
    min-width: 120px;
}

/* ================= АДАПТИВНОСТЬ ================= */
@media (max-width: 768px) {
    .app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 60vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .sidebar-bottom {
        position: sticky;
        bottom: 0;
        background: var(--panel);
    }
    
    .notes-list {
        max-height: calc(60vh - 200px);
    }
    
    .content {
        padding: 20px;
        min-height: 40vh;
    }
    
    .note-actions {
        justify-content: center;
    }
}