/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Контейнеры */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.login-box h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

.login-box p {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.5;
}

/* Кнопка Telegram */
.telegram-login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #0088cc;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    width: 100%;
}

.telegram-login-button:hover {
    background: #0077b3;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,136,204,0.3);
}

.telegram-login-button svg {
    width: 24px;
    height: 24px;
}

/* Шапка */
header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 24px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-menu span {
    color: #666;
}

.logout-btn {
    color: #ff4757;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #ff4757;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #ff4757;
    color: white;
}

/* Основной контейнер дашборда */
.dashboard-container {
    display: flex;
    min-height: calc(100vh - 70px);
    max-width: 1400px;
    margin: 0 auto;
}

/* Сайдбар */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #eee;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
}

.user-info {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
}

.user-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.user-info p {
    color: #888;
    font-size: 14px;
    margin-bottom: 15px;
}

.subscription-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.subscription-badge.free {
    background: #f1f1f1;
    color: #666;
}

.subscription-badge.premium {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #333;
}

/* Навигация в сайдбаре */
.side-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #666;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.side-nav a:hover {
    background: #f5f5f5;
    color: #333;
}

.side-nav a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.side-nav a.upgrade-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #333;
    font-weight: 600;
    margin-top: 10px;
}

/* Статистика в сайдбаре */
.stats-summary {
    margin-top: auto;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
}

.stats-summary h4 {
    margin-bottom: 15px;
    color: #333;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stat-item:last-child {
    border-bottom: none;
}

.price-up {
    color: #4cd964;
}

.price-down {
    color: #ff3b30;
}

/* Основной контент */
.main-content {
    flex: 1;
    padding: 30px;
    background: #f8f9fa;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h2 {
    color: #333;
    font-size: 28px;
}

/* Кнопки */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f1f1f1;
    color: #666;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e5e5e5;
}

.btn-icon {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #f5f5f5;
    color: #333;
}

.btn-icon.delete:hover {
    background: #ffebee;
    color: #ff4757;
}

.btn-link {
    color: #667eea;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* Карточки товаров */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.product-header h4 {
    font-size: 16px;
    color: #333;
    line-height: 1.4;
    flex: 1;
    margin-right: 10px;
}

.product-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.marketplace-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.marketplace-badge.ozon {
    background: #005bff;
    color: white;
}

.marketplace-badge.wildberries {
    background: #a200ff;
    color: white;
}

.marketplace-badge.yandex_market {
    background: #fc0;
    color: #333;
}

.notification-threshold {
    background: #f0f7ff;
    color: #005bff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
}

.product-price {
    margin-bottom: 15px;
}

.current-price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.current-price strong {
    font-size: 24px;
    color: #333;
}

.price-change {
    font-size: 14px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.last-checked {
    color: #888;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    color: #333;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

/* Формы */
.form-group {
    padding: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input[type="url"],
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: #667eea;
    outline: none;
}

.form-help {
    display: block;
    margin-top: 6px;
    color: #888;
    font-size: 13px;
}

.range-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.range-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.range-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.range-container span {
    font-weight: 600;
    color: #667eea;
    min-width: 50px;
}

/* Предпросмотр маркетплейсов */
.marketplace-preview {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
}

.marketplace-option {
    flex: 1;
    text-align: center;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.marketplace-option.active {
    border-color: #667eea;
    background: #f0f7ff;
}

.marketplace-option i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.marketplace-option.ozon.active i {
    color: #005bff;
}

.marketplace-option.wildberries.active i {
    color: #a200ff;
}

.marketplace-option.yandex_market.active i {
    color: #fc0;
}

/* Действия формы */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #eee;
}

/* Состояние пустого списка */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 10px;
}

.empty-state p {
    color: #888;
    margin-bottom: 30px;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .dashboard-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
    }
    
    .user-menu {
        margin-top: 15px;
    }
}

/* Добавляем стили для уведомлений */
#notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 4.7s forwards;
    border-left: 4px solid #667eea;
    max-width: 400px;
}

.notification.success {
    border-left-color: #4cd964;
}

.notification.error {
    border-left-color: #ff3b30;
}

.notification.info {
    border-left-color: #007aff;
}

.notification .icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notification.success .icon {
    color: #4cd964;
}

.notification.error .icon {
    color: #ff3b30;
}

.notification.info .icon {
    color: #007aff;
}

.notification .content {
    flex: 1;
}

.notification .title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.notification .message {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Стили для секций */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Настройки профиля */
.settings-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.settings-form {
    max-width: 600px;
}

.settings-form .form-group {
    margin-bottom: 25px;
}

.settings-form label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.settings-form input[type="text"],
.settings-form input[type="email"],
.settings-form select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.settings-form input:focus {
    border-color: #667eea;
    outline: none;
}

.settings-form input[readonly] {
    background: #f9f9f9;
    color: #666;
    cursor: not-allowed;
}

/* Тарифные планы */
.subscription-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.plan-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
    position: relative;
}

.plan-card.active {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.plan-card.premium.active {
    border-color: #ffd700;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.2);
}

.plan-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.plan-header h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.plan-price {
    font-size: 32px;
    font-weight: 700;
    color: #667eea;
}

.plan-header.premium .plan-price {
    color: #ffd700;
}

.plan-features ul {
    list-style: none;
    padding: 0;
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: #666;
}

.plan-features li i.fa-check {
    color: #4cd964;
}

.plan-features li i.fa-times {
    color: #ff3b30;
}

.current-plan {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    background: #4cd964;
    color: white;
    border-radius: 6px;
    font-weight: 600;
}

/* Использование */
.current-usage {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.usage-stats {
    margin-top: 20px;
}

.usage-item {
    margin-bottom: 20px;
}

.usage-item:last-child {
    margin-bottom: 0;
}

.usage-item span {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
}

.usage-item strong {
    color: #333;
    font-size: 16px;
}

.usage-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Статистика */
.statistics-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.total {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.up {
    background: linear-gradient(135deg, #4cd964 0%, #5cd975 100%);
}

.stat-icon.down {
    background: linear-gradient(135deg, #ff3b30 0%, #ff5e54 100%);
}

.stat-icon.time {
    background: linear-gradient(135deg, #007aff 0%, #5ac8fa 100%);
}

.stat-info h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

.chart-container {
    margin-top: 30px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .subscription-plans {
        grid-template-columns: 1fr;
    }
    
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .notification {
        max-width: calc(100vw - 40px);
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }
    
    .settings-container,
    .current-usage,
    .statistics-container {
        padding: 20px;
    }
}

/* Добавляем стиль для бейджа Мегамаркета */
.marketplace-badge.megamarket {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
}

/* Обновляем marketplace-option для мегамаркета */
.marketplace-option[data-market="megamarket"].active {
    border-color: #ff6b6b;
    background: #fff5f5;
}

.marketplace-option[data-market="megamarket"].active i {
    color: #ff6b6b;
}