/* Переменные для легкой настройки цветов одной гаммы */
:root {
    /* Основной фиолетовый тон */
    --primary-color: #9b59b6;      /* насыщенный лиловый */
    --primary-light: #f4f3f5;      /* светлый лавандовый для фонов */
    --primary-dark: #6c3483;       /* темный фиолетовый для акцентов и hover */
    
    /* Glassmorphism элементы */
    --glass-bg: rgba(155, 89, 182, 0.15);    /* полупрозрачный лиловый фон */
    --glass-border: rgba(155, 89, 182, 0.3); /* полупрозрачная рамка */
    
    /* Текст */
    --text-main: #2c1a3d;          /* темный фиолетовый для текста */
    --text-secondary: #7d5ba6;     /* мягкий фиолетовый для вторичного текста */
    
    /* Ошибки и успех — в рамках фиолетового оттенка */
    --error-color: #e74c3c;        /* контрастная ошибка (красноватый) */
    --success-color: #8ae6ff;      /* светлый бирюзовый для успеха, гармонирует с фиолетовым */
    
    --shadow: 0 8px 32px 0 rgba(155, 89, 182, 0.2);
}

/* Общие сбросы */
body {
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    /* Мягкий градиент на фоне для усиления эффекта стекла */
    background: radial-gradient(circle at top right, #e8f0fe, #ffffff);
    color: var(--text-main);
    line-height: 1.5;
}

/* Шапка */
.header-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 90%;
    max-width: 550px;
    margin: 24px auto 12px auto;
    gap: 12px;
}

/* Контейнер с контентом (Glassmorphism) */
.main-container {
    width: 90%;
    max-width: 500px;
    margin: 0 auto 40px auto;
    padding: 24px;
    
    /* Эффект стекла */
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.item-row {
    display: flex;
    width: 100%;
}

.item-content {
    display: flex;
    flex: auto;
    align-self: center;
    align-items: center;
}

p {
    margin-block: 4px;
    display: flex;
    flex-flow: column;
}

/* Заголовки */
h1 {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary-dark);
    margin: 0 0 16px 0;
}

h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 0 0 8px 0;
}

/* Список элементов */
ul {
    list-style: none;
    align-items: flex-start;
    padding: 0;
    margin-block: 8px;
    display: flex;
    flex-direction: column;
}

li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgb(127 127 127 / 30%);
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: -webkit-fill-available;
    margin-block: 8px;
}

li:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

/* Состояние "Выполнено" */
li.done {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.02);
    order: 1; /* Уходит вниз */
}

li:not(.done) {
    order: 0;
}

/* Чекбоксы в стиле Material */
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* Кнопки */
button {
    font-family: inherit;
    font-weight: 500;
    margin-inline-end: 8px;
    margin-block: 8px;
    cursor: pointer;
    padding: 8px 16px;
    border: none;
    border-radius: 12px;
    background-color: var(--primary-color);
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(26, 115, 232, 0.2);
}

button:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.3);
}

span {
    margin-left: 4px;
}

.space-page {
    padding: 8px;
}

.space-header {
    display: flex;
    place-content: flex-end;
}

.space-info {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
}
/* Кнопка удаления (второстепенная, но заметная при наведении) */
.delete-button {
    background-color: transparent;
    color: var(--error-color);
    border: 1px solid transparent;
    box-shadow: none;
}

.delete-button:hover {
    background-color: rgba(217, 48, 37, 0.1);
    color: var(--error-color);
    box-shadow: none;
}

/* Бейджи пользователей */
.user-badge, .user-item {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 0px 2px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-block: 2px 6px;
}

.users-section {
    display: flex;
    flex-direction: column;
}

/* Поля ввода */

input {
    display: flex;
    margin-block-start: 8px;
}

input[type="text"] {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #dadce0;
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    background: #fff;
}

input[type="email"] {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #dadce0;
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s;
    outline: none;
}

input[type="password"] {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #dadce0;
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s;
    outline: none;
}

form {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
}



/* Попапы (Уведомления) */
.popup-message {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 16px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
    backdrop-filter: blur(8px);
    animation: slideIn 0.3s ease-out, fadeout 0.5s ease-out 3s forwards;
}

/* @keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeout {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
} */

.error { background: rgba(217, 48, 37, 0.9); }
.success { background: rgba(24, 128, 56, 0.9); }

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
    .main-container {
        width: 88%;
        padding: 20px;
        border-radius: 0; /* На мобилках часто лучше выглядит во всю ширину */
        min-height: 100vh;
        margin: 0;
    }

    .header-container {
        width: 95%;
        justify-content: center;
    }

    .header-list {
        display: inline-flex;
    }

    li {
        display: flex;
        padding: 16px;
        flex-direction: column;
        flex-wrap: wrap;
        gap: 12px;
    }

    button {
        width: 100%; /* Кнопки на мобильных удобнее делать большими */
        padding: 14px;
    }
    
    .item-buttons {
        width: 100%;
        flex-direction: row !important;
        gap: 8px;
    }
    
    .item-buttons button {
        flex: 1;
    }
}