/* style.css */

/* --- Переменные и базовые стили --- */
:root {
    --bg-color: #121212;
    --primary-surface-color: #1e1e1e;
    --secondary-surface-color: #2a2a2a;
    --text-color: #e0e0e0;
    --text-secondary-color: #888;
    --accent-color: #0070f3;
    --accent-hover-color: #005bb5;
    --danger-color: #e53e3e;
    --danger-hover-color: #c53030;
    --border-color: #444;
}
body { 
    background-color: var(--bg-color); 
    color: var(--text-color); 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    margin: 0; 
}
#root { 
    display: flex; 
    justify-content: center; 
    padding: 2rem 1rem; 
    height: 100vh;
    box-sizing: border-box; 
}
.app-wrapper { 
    width: 100%; 
    max-width: 700px; 
    display: flex;
    flex-direction: column;
}
h2 { 
    font-size: 2rem; 
    margin-top: 0; 
    margin-bottom: 1.5rem;
}

/* --- Общие классы для элементов форм --- */
.form-control {
    background-color: var(--secondary-surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
    width: 100%;
    margin-bottom: 1rem;
    font-size: 16px;
    font-family: inherit;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
}
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary-color);
    font-size: 0.9rem;
}

/* --- Общие классы для кнопок --- */
.btn {
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    text-align: center;
    display: inline-block;
}
.btn-primary { 
    background-color: var(--accent-color); 
}
.btn-primary:hover { 
    background-color: var(--accent-hover-color); 
}
.btn-secondary { 
    background-color: var(--secondary-surface-color); 
}
.btn-secondary:hover { 
    background-color: #3a3a3a; 
}
.btn-danger {
    background-color: var(--danger-color);
}
.btn-danger:hover {
    background-color: var(--danger-hover-color);
}

/* НОВЫЙ СТИЛЬ: Кнопки-иконки */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.btn-icon:hover {
    background-color: var(--secondary-surface-color);
}
.btn-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-color);
}


/* --- Контейнеры и Шапка --- */
.login-container { 
    background-color: var(--primary-surface-color); 
    padding: 2.5rem; 
    border-radius: 8px; 
    text-align: center; 
    max-width: 400px; 
    margin: auto; 
}
.notes-container, .detail-container, .settings-container { 
    text-align: left; 
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}
.header { 
    display: flex; 
    justify-content: flex-end;
    align-items: center; 
    margin-bottom: 1rem;
    height: 40px;
    flex-shrink: 0;
}
.detail-header, .settings-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 1rem; 
    flex-shrink: 0;
}

/* НОВЫЙ СТИЛЬ: Заголовок заметки в шапке */
.detail-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    padding: 0 1rem;
    flex-grow: 1; /* Занимает все доступное место */
    text-align: center; /* Центрирует текст внутри себя */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Аватар пользователя и блок профиля --- */
.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
}
.profile-avatar:hover {
    transform: scale(1.1);
}
.profile-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: var(--primary-surface-color);
    border-radius: 8px;
}
.profile-info .profile-avatar {
    width: 50px; height: 50px; font-size: 24px; cursor: default;
}
.profile-info .profile-avatar:hover { transform: none; }
.profile-info-text { display: flex; flex-direction: column; }
.profile-info-label { margin: 0; color: var(--text-secondary-color); font-size: 0.9rem; }
.profile-info-email { margin: 0.25rem 0 0 0; font-size: 1.1rem; word-break: break-all; }

/* --- Плавающая кнопка создания (FAB) --- */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--primary-surface-color);
    color: var(--accent-color);
    border: 2px dashed var(--border-color); 
    font-size: 32px;
    line-height: 52px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    z-index: 1000;
}
.fab:hover {
    background-color: var(--secondary-surface-color);
    transform: scale(1.05) rotate(90deg);
}

/* ИЗМЕНЕНО: Стили поля ввода текста заметки */
textarea.note-content-input {
    flex-grow: 1; /* Занимает все доступное место по высоте */
    background-color: transparent;
    color: var(--text-color);
    border: none;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1.6;
    font-family: inherit;
    resize: none; /* Отключаем возможность изменения размера */
    width: 100%;
    box-sizing: border-box;
}
textarea.note-content-input:focus {
    outline: none; /* Убираем обводку при фокусе */
}

/* --- Стили для списка заметок и механики удаления --- */
.notes-list-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: none;
}
.notes-list-wrapper::-webkit-scrollbar {
    display: none;
}
.notes-list { 
    list-style: none; 
    padding: 0; 
}
.note-item-wrapper {
    position: relative;
    margin-bottom: 0.75rem;
    border-radius: 8px;
}
.note-item { 
    position: relative;
    z-index: 2;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem; 
    border-radius: 8px; 
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition: width 0.3s ease-in-out, background-color 0.2s;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.note-item:hover {
    background-color: var(--primary-surface-color);
}
.note-text { 
    font-size: 1.1rem; 
}
.note-item.delete-active {
    width: calc(100% - 88px); 
}
.delete-confirm-area {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    background-color: var(--danger-color);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px; 
    cursor: pointer;
    z-index: 1;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.delete-confirm-area svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

/* Поле ввода заголовка в настройках */
.note-settings-title-input {
    font-size: 2rem;
    font-weight: bold;
    padding: 0.5rem 0;
    border: none;
    border-bottom: 2px solid var(--border-color);
    background: transparent;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    width: 100%;
    transition: border-color 0.2s;
    font-family: inherit;
}
.note-settings-title-input::placeholder {
    color: var(--text-secondary-color);
}
.note-settings-title-input:focus {
    outline: none;
    border-color: var(--accent-color);
}
