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

:root {
    --primary-color: #0066FF;
    --primary-dark: #0052CC;
    --primary-light: #E6F0FF;
    --success-color: #00C853;
    --warning-color: #FF6B00;
    --danger-color: #FF3B30;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --border-color: #E5E5E5;
    --bg-white: #FFFFFF;
    --bg-gray: #F8F9FA;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background: var(--bg-gray);
    color: var(--text-primary);
    line-height: 1.5;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-gray);
    min-height: 100vh;
}

/* Шапка */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
}

.logo-icon {
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-user {
    font-weight: 500;
    color: var(--text-primary);
    background: var(--primary-light);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

/* Основной контент */
.main-content {
    padding: 20px;
}

/* Поиск */
.search-section {
    margin-bottom: 20px;
}

.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-white);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Фильтры */
.filters-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-white);
    padding: 8px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.filter-btn {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-secondary);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

.filter-btn:hover:not(.active) {
    background: var(--bg-gray);
}

/* Список задач */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.task-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-hover);
}

.task-card.personal {
    border-left-color: var(--primary-color);
}

.task-card.shared {
    border-left-color: var(--warning-color);
}

.task-card.completed {
    opacity: 0.7;
    background: var(--bg-gray);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.task-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

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

.task-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.badge-personal {
    background: var(--primary-light);
    color: var(--primary-color);
}

.badge-shared {
    background: #FFF3E0;
    color: var(--warning-color);
}

.badge-completed {
    background: #E8F5E9;
    color: var(--success-color);
}

/* Кнопки действий */
.task-action-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-secondary);
}

.task-action-icon:hover {
    background: var(--bg-gray);
}

.task-action-icon.edit:hover {
    color: var(--primary-color);
}

.task-action-icon.delete:hover {
    color: var(--danger-color);
}

.task-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.task-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.task-users {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.user-tag {
    background: var(--bg-gray);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Кнопки */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--bg-gray);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-modal {
    font-size: 28px;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-body {
    padding: 20px;
}

.users-list-modal {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background: var(--bg-gray);
}

.user-name {
    font-weight: 500;
}

.user-item button {
    padding: 4px 8px;
    font-size: 12px;
}

/* Форма создания задачи */
.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.task-input,
.task-textarea {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    resize: vertical;
    width: 100%;
    margin-bottom: 12px;
}

.task-input:focus,
.task-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.task-type-selector {
    display: flex;
    gap: 20px;
    padding: 8px 0;
    margin-bottom: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.shared-users-selector {
    padding: 12px;
    background: var(--bg-gray);
    border-radius: 8px;
    margin-bottom: 12px;
}

.input-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
    color: var(--text-secondary);
}

.users-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.users-checkbox-list label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 12px;
    background: var(--bg-white);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.users-checkbox-list label:hover {
    border-color: var(--primary-color);
}

.users-checkbox-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Уведомления */
.notification-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: var(--bg-white);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 350px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.notification.info {
    border-left-color: var(--primary-color);
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification.error {
    border-left-color: var(--danger-color);
}

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    background: var(--bg-white);
    border-radius: var(--border-radius);
}

/* Стили для формы внизу */
.create-task-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-gray);
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    z-index: 90;
}

.create-task-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 0;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 0 auto;
}

.create-toggle-btn {
    width: 100%;
    background: var(--primary-color);
    border-radius: var(--border-radius);
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}

.create-task-form {
    padding: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.form-actions button {
    flex: 1;
}

.loading-contacts {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

/* Адаптивность */
@media (max-width: 600px) {
    .main-content {
        padding: 12px;
    }
    
    .task-actions {
        flex-direction: column;
    }
    
    .task-actions button {
        width: 100%;
    }
    
    .notification-container {
        left: 20px;
        right: 20px;
    }
    
    .notification {
        width: 100%;
    }
    
    .task-header-right {
        margin-left: auto;
    }
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}