* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    color: #e0e0e0;
}

.container {
    max-width: 100%;
    padding: 20px 15px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #0f3460 0%, #533483 100%);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    color: white;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 25px 25px;
    opacity: 0.3;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header h1 i {
    font-size: 32px;
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    display: block;
    color: #fff;
}

.stat-label {
    font-size: 12px;
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.9);
}

.input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    position: relative;
    align-items: center;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.image-preview-container {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.image-preview {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 24px;
}

.image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 107, 107, 0.9);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    z-index: 2;
}

#itemInput {
    flex: 1;
    padding: 18px 20px;
    border: none;
    font-size: 16px;
    background: transparent;
    transition: all 0.3s ease;
    outline: none;
    color: white;
    min-width: 0;
}

#itemInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.input-wrapper:focus-within {
    box-shadow: 0 5px 20px rgba(83, 52, 131, 0.4);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(83, 52, 131, 0.3);
}

#addBtn {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
    border: none;
    border-radius: 15px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#addBtn:hover, #addBtn:active {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

#addBtn:disabled {
    opacity: 0.6;
    transform: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#fileInput {
    display: none;
}

.list-container {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-bottom: 20px;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.list-header {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-title {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
}

#listCount {
    color: #a991d4;
    font-weight: 600;
    font-size: 14px;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.empty-state i {
    font-size: 50px;
    margin-bottom: 15px;
    opacity: 0.5;
    color: rgba(255, 255, 255, 0.3);
}

#list {
    list-style: none;
    padding: 0;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.item-checkbox {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.list-item.checked .item-checkbox {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    border-color: #4CAF50;
}
.list-item.checked .item-content .item-image{
    filter: brightness(0.5);
}

.item-checkbox i {
    color: white;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.list-item.checked .item-checkbox i {
    opacity: 1;
}

.item-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.item-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.item-image:hover img {
    transform: scale(1.05);
}

.item-image-placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-size: 20px;
}

.item-name {
    flex: 1;
    font-size: 17px;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.9);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item.checked .item-name {
    color: rgba(255, 255, 255, 0.4);
    text-decoration: line-through;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-btn {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover, .delete-btn:active {
    background-color: rgba(255, 107, 107, 0.2);
    color: #ff3d3d;
    border-color: rgba(255, 107, 107, 0.5);
}

/* Минималистичный индикатор подключения */
.connection-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 100;
    transition: all 0.3s ease;
}

.connection-indicator.connected {
    background-color: #4CAF50; /* зелёный */
    animation: pulse 2s infinite;
}

.connection-indicator.disconnected {
    background-color: #ff5252; /* красный */
}

.connection-indicator.reconnecting {
    background-color: #ff9800; /* оранжевый */
    animation: pulse 1s infinite;
}

.connection-indicator.syncing {
    background-color: #2196F3; /* синий */
    animation: pulse 0.8s infinite;
}

@keyframes pulse {
    0% { 
        opacity: 1;
        box-shadow: 0 0 0 0 currentColor;
    }
    70% { 
        opacity: 0.7;
        box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
    }
    100% { 
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    }
}

/* Модальное окно для изображения */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

        
/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.list-item {
    animation: fadeIn 0.3s ease;
}

/* Скроллбар */
.list-container::-webkit-scrollbar {
    width: 6px;
}

.list-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.list-container::-webkit-scrollbar-thumb {
    background: rgba(169, 145, 212, 0.5);
    border-radius: 10px;
}

.list-container::-webkit-scrollbar-thumb:hover {
    background: rgba(169, 145, 212, 0.7);
}
.access-denied {
    display: none;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}
.main-interface {
    display: none;
}
.access-denied i {
    font-size: 80px;
    color: #ff5252;
    margin-bottom: 20px;
    opacity: 0.8;
}

.access-denied h2 {
    font-size: 24px;
    color: var(--tg-theme-text-color, white);
    margin-bottom: 15px;
    font-weight: 600;
}

.access-denied p {
    font-size: 16px;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.7));
    margin-bottom: 10px;
    line-height: 1.5;
}
/* Адаптивность */
@media (max-width: 480px) {
    .container {
        padding: 15px 12px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .input-wrapper {
        flex-direction: row;
    }
    
    .image-preview-container {
        width: 50px;
        height: 50px;
    }
    
    .image-preview {
        width: 40px;
        height: 40px;
    }
    
    #itemInput {
        padding: 15px;
        font-size: 15px;
    }
    
    #addBtn {
        width: 50px;
        height: 50px;
    }
    
    .list-container {
        max-height: 55vh;
    }
    
    .connection-indicator {
        top: 15px;
        right: 15px;
        width: 10px;
        height: 10px;
    }
    
    .item-content {
        gap: 10px;
    }
    
    .item-image {
        width: 40px;
        height: 40px;
    }
    
    .access-denied i {
        font-size: 60px;
    }

    .access-denied h2 {
        font-size: 20px;
    }

    .access-denied p {
        font-size: 14px;
    }
}

@media (max-height: 700px) {
    .list-container {
        max-height: 50vh;
    }
}

/* Эффект добавления нового элемента */
@keyframes highlightNew {
    0% { background-color: rgba(83, 52, 131, 0.3); }
    100% { background-color: transparent; }
}

.list-item.new {
    animation: highlightNew 1s ease;
}

/* Эффекты наведения для статистики */
.stat-number {
    transition: transform 0.2s ease;
}

.stat-item:hover .stat-number {
    transform: scale(1.05);
}