:root {
    /* Основные цвета */
    --primary-color: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --success-color: #10b981;
    --success-light: #a7f3d0;
    --danger-color: #ef4444;
    --danger-light: #fecaca;
    --warning-color: #f59e0b;
    --warning-light: #fde68a;
    --info-color: #3b82f6;
    --info-light: #bfdbfe;
    
    /* Фоны */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --card-bg-hover: #f1f5f9;
    --modal-bg: rgba(0, 0, 0, 0.5);
    
    /* Текст */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-on-primary: #ffffff;
    
    /* Границы */
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    /* Тени */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Анимации */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Размеры */
    --header-height: 60px;
    --footer-height: 70px;
    --max-width: 500px;
}

/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
    overflow-x: hidden;
}

#app {
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-color);
}

/* Общие стили */
.container {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: 8px;
    text-decoration: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-on-primary);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: #f8fafc;
    box-shadow: var(--shadow);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.input-field {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    transition: border-color var(--transition-fast);
    background-color: white;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-field::placeholder {
    color: var(--text-tertiary);
}

/* Страница приветствия */
.welcome-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.app-logo {
    font-size: 64px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.app-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 40px;
    max-width: 300px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 300px;
}

/* Страница создания/подключения */
.form-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 24px;
}

.form-header {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: 50%;
    transition: background-color var(--transition-fast);
}

.back-btn:hover {
    background-color: var(--border-color);
}

.form-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Страница списка */
.list-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.list-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--card-bg);
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.9);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.list-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.users-count {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background-color: var(--primary-light);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.progress-section {
    margin-top: 16px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.progress-bar {
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 4px;
    transition: width var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

.list-content {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px;
}

.add-item-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 90;
}

.add-item-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.quantity-input {
    width: 60px;
    text-align: center;
    padding: 10px;
}

.add-item-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    transition: border-color var(--transition-fast);
}

.add-item-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.add-item-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--success-color), #34d399);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.add-item-btn:active {
    transform: scale(0.9);
}

/* Список товаров */
.items-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-subtext {
    font-size: 14px;
    opacity: 0.7;
}

.item-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.item-card.completed {
    background-color: #f0fdf4;
    border-color: var(--success-light);
    opacity: 0.8;
}

.item-card.completed::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--success-color);
}

.item-checkbox {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    background-color: white;
    margin-top: 2px;
}

.item-checkbox:hover {
    border-color: var(--primary-color);
}

.item-checkbox.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.item-checkbox.checked::after {
    content: '✓';
    font-size: 14px;
    font-weight: bold;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.item-name {
    font-weight: 500;
    font-size: 16px;
    line-height: 1.4;
    word-break: break-word;
}

.item-card.completed .item-name {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.item-quantity {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 600;
    background-color: rgba(79, 70, 229, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
    margin-left: 8px;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.user-badge.you {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.time-badge {
    font-size: 11px;
    opacity: 0.7;
}

.item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.item-card:hover .item-actions {
    opacity: 1;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    color: var(--text-secondary);
    background-color: var(--border-color);
}

.action-btn.delete:hover {
    color: var(--danger-color);
    background-color: var(--danger-light);
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--modal-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn var(--transition-normal);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background-color var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--border-color);
}

.modal-body {
    padding: 20px;
}

.invite-link {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    font-family: monospace;
    font-size: 14px;
    word-break: break-all;
    margin-bottom: 20px;
    user-select: all;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.share-btn:hover {
    background-color: var(--bg-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.share-icon {
    font-size: 24px;
}

.whatsapp .share-icon { color: #25D366; }
.telegram .share-icon { color: #0088cc; }
.email .share-icon { color: var(--primary-color); }

/* Уведомления */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 24px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    z-index: 1100;
    animation: slideUp 0.3s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--danger-color);
}

.notification.info {
    background-color: var(--info-color);
}

.notification.warning {
    background-color: var(--warning-color);
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Анимации */
.fade-enter-active, .fade-leave-active {
    transition: opacity var(--transition-normal);
}

.fade-enter-from, .fade-leave-to {
    opacity: 0;
}

.slide-enter-active, .slide-leave-active {
    transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.slide-enter-from, .slide-leave-to {
    transform: translateX(20px);
    opacity: 0;
}

/* Адаптивность */
@media (max-width: 480px) {
    :root {
        --border-radius: 16px;
    }
    
    .container {
        padding: 12px;
    }
    
    .card {
        padding: 16px;
    }
    
    .app-title {
        font-size: 28px;
    }
    
    .list-title {
        font-size: 18px;
    }
    
    .add-item-form {
        flex-direction: column;
    }
    
    .quantity-input {
        width: 100%;
        order: 1;
    }
    
    .add-item-input {
        order: 2;
    }
    
    .add-item-btn {
        order: 3;
        width: 100%;
        height: 50px;
        border-radius: var(--border-radius-sm);
    }
    
    .share-buttons {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    #app {
        border-radius: var(--border-radius-lg);
        margin: 20px auto;
        box-shadow: var(--shadow-lg);
        min-height: calc(100vh - 40px);
        max-height: calc(100vh - 40px);
        overflow: hidden;
    }
    
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        padding: 20px;
        height: 100vh;
        overflow: hidden;
    }
}

/* Прокрутка */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Утилиты */
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-muted { color: var(--text-tertiary); }
.font-bold { font-weight: 600; }
.font-sm { font-size: 14px; }
.font-xs { font-size: 12px; }
.rounded { border-radius: var(--border-radius-sm); }
.shadow { box-shadow: var(--shadow); }