:root {
    --bg-color: #0b0f19;
    --sidebar-bg: #111827;
    --card-bg: #1f2937;
    --border-color: #374151;
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Сайдбар */
.sidebar {
    width: 65px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.sidebar:hover {
    width: 250px;
}

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

.sidebar-header h2 {
    font-size: 18px;
    margin: 0;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.sidebar:hover .sidebar-header h2 {
    opacity: 1;
}

.logout-btn, .icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
}

.subjects-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
    overflow-x: hidden;
}

.subject-item {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-size: 14px;
    white-space: nowrap;
}

.sub-icon {
    font-size: 14px;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    color: var(--accent-color);
    background: rgba(99, 102, 241, 0.1);
    padding: 4px 6px;
    border-radius: 4px;
    margin-right: 12px;
}

.sub-text {
    opacity: 0;
    transition: opacity 0.2s;
}

.sidebar:hover .sub-text {
    opacity: 1;
}

.subject-item:hover, .subject-item.active {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--text-color);
}

.subject-item.active {
    border-left: 4px solid var(--accent-color);
}

/* Футер сайдбара с ссылкой */
.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin-top: auto;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}

.sidebar-footer:hover {
    background-color: rgba(99, 102, 241, 0.15);
}

.footer-avatar {
    width: 28px;
    height: 28px;
    object-fit: contain;
    min-width: 28px;
    border-radius: 4px;
    margin-right: 12px;
}

.footer-text {
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-footer:hover .footer-text {
    color: var(--accent-color);
}

.sidebar:hover .footer-text {
    opacity: 1;
}

/* Основной контент */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.top-bar {
    height: 60px;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.content-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Кнопки */
.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 9px 18px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 10px;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Админ-бейдж */
.admin-badge {
    background-color: #ef4444;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    font-weight: bold;
    text-transform: uppercase;
}

/* Сетка карточек */
.notes-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.note-card-mini {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.note-card-mini:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.note-card-mini h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.note-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* Просмотр заметки */
.note-fullscreen {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 12px;
}

.note-top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.btn-edit {
    background-color: #3b82f6;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    font-weight: 600;
}

.btn-edit:hover {
    background-color: #2563eb;
}

.btn-delete {
    background-color: #ef4444;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    font-weight: 600;
}

.btn-delete:hover {
    background-color: #dc2626;
}

.back-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    margin-bottom: 15px;
}

.badge {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-color);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.note-fullscreen h1 {
    margin: 15px 0 5px 0;
}

.note-meta-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.note-text {
    line-height: 1.6;
    white-space: pre-line;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 450px;
    padding: 30px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

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

/* Табы в модалке входа */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    font-weight: bold;
    cursor: pointer;
    font-size: 15px;
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

.error-msg {
    color: #f87171;
    font-size: 13px;
    margin-bottom: 15px;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    margin-bottom: 15px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    box-sizing: border-box;
}

.welcome-screen {
    text-align: center;
    margin-top: 100px;
}
