/* Общие стили - Remnawave Dashboard Style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Цветовая схема Remnawave */
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #252b3b;
    --bg-card: #1e2332;
    --bg-sidebar: #151a24;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --text-muted: #8a8d91;
    --border-color: #2d3441;
    --accent-teal: #00d4ff;
    --accent-green: #00ff88;
    --accent-orange: #ff6b35;
    --accent-purple: #9d4edd;
    --accent-red: #ff4757;
    --accent-blue: #4a9eff;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0a0e14 0%, #1a1f2e 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    overflow-x: hidden; /* Предотвращаем горизонтальный скролл */
    width: 100%;
    max-width: 100vw; /* Не больше ширины экрана */
}

/* Боковая панель */
.sidebar {
    width: 260px;
    background: rgba(21, 26, 36, 0.4);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Safari */
    -moz-transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Firefox */
    -o-transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Opera */
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.4),
                inset -1px 0 0 rgba(255, 255, 255, 0.05);
    -webkit-box-shadow: 2px 0 20px rgba(0, 0, 0, 0.4),
                        inset -1px 0 0 rgba(255, 255, 255, 0.05); /* Safari */
    -moz-box-shadow: 2px 0 20px rgba(0, 0, 0, 0.4),
                     inset -1px 0 0 rgba(255, 255, 255, 0.05); /* Firefox */
    /* Фикс для iOS Safari */
    -webkit-overflow-scrolling: touch;
}

/* Анимация для мобильных устройств */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 100%; /* Полноэкранный на мобильных */
        max-width: 320px; /* Максимальная ширина для удобства */
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
        -webkit-box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
        -moz-box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
}

/* Overlay для мобильных */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px); /* Safari */
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-transition: opacity 0.3s ease; /* Safari */
    -moz-transition: opacity 0.3s ease; /* Firefox */
    -o-transition: opacity 0.3s ease; /* Opera */
    /* Фикс для мобильных браузеров */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (max-width: 1024px) {
    .sidebar-overlay {
        display: block;
    }
    
    .sidebar.open ~ .sidebar-overlay {
        opacity: 1;
    }
}

/* Кнопка гамбургера */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.2em;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-teal);
    color: var(--accent-teal);
    transform: scale(1.05);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

@media (min-width: 1025px) {
    /* На десктопе сайдбар всегда открыт */
    .sidebar {
        transform: translateX(0) !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .sidebar-toggle {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }
    
    .main-content {
        margin-left: 0 !important; /* Убираем отступ слева на мобильных */
        padding-left: 20px;
        padding-right: 20px;
        width: 100% !important; /* Полная ширина на мобильных */
        max-width: 100% !important;
        position: relative; /* Для правильного позиционирования */
        z-index: 1; /* Ниже сайдбара */
    }
    
    /* Убеждаемся, что контент не перекрывается */
    .page-content {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
    
    /* Предотвращаем горизонтальный скролл */
    body {
        overflow-x: hidden;
    }
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 1.2em;
    font-weight: 600;
}

.sidebar-logo i {
    color: var(--accent-teal);
    font-size: 1.3em;
}

.sidebar-close {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.sidebar-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    transform: rotate(90deg);
}

/* Скрываем крестик в сайдбаре на мобильных (там используется кнопка гамбургера) */
@media (max-width: 1024px) {
    .sidebar-close {
        display: none;
    }
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-section-title {
    padding: 0 20px 10px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Safari */
    -moz-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Firefox */
    -o-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Opera */
    border-left: 3px solid transparent;
    cursor: pointer;
    position: relative;
    margin: 2px 0;
    -webkit-tap-highlight-color: transparent; /* Убираем подсветку на мобильных */
    touch-action: manipulation; /* Улучшаем отзывчивость на мобильных */
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--accent-teal);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding-left: 22px;
    transform: translateX(4px);
}

.nav-item:hover::before {
    transform: scaleY(1);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, rgba(0, 212, 255, 0.1) 100%);
    color: var(--accent-teal);
    border-left-color: var(--accent-teal);
    font-weight: 600;
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item.active i {
    color: var(--accent-teal);
    transform: scale(1.1);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.nav-item:hover i {
    transform: scale(1.15);
    color: var(--accent-teal);
}

/* Основной контент */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

/* Хлебные крошки */
.breadcrumb {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--accent-teal);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Заголовок страницы */
.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95em;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--accent-green);
    color: #000;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2000;
    animation: slideInRight 0.3s ease;
}

.notification.error {
    background: var(--accent-red);
    color: #fff;
}

.notification.warning {
    background: var(--accent-orange);
    color: #fff;
}

.notification-close {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Секции контента */
.content-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* Карточки статистики */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(30, 35, 50, 0.2);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.stat-card:hover {
    border-color: var(--accent-teal);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.2),
                0 8px 32px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    flex-shrink: 0;
}

.stat-icon.total {
    background: rgba(74, 158, 255, 0.2);
    color: var(--accent-blue);
}

.stat-icon.active {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.stat-icon.expired {
    background: rgba(255, 71, 87, 0.2);
    color: var(--accent-red);
}

.stat-icon.warning {
    background: rgba(255, 107, 53, 0.2);
    color: var(--accent-orange);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
}

.stat-value {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-top: 8px;
}

.stat-percentage {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Управление */
.controls {
    background: rgba(30, 35, 50, 0.2);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    background: rgba(30, 35, 50, 0.3);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-teal);
    color: var(--accent-teal);
}

.btn-primary {
    background: rgba(0, 212, 255, 0.3);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    color: var(--accent-teal);
    border-color: rgba(0, 212, 255, 0.4);
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    background: rgba(74, 158, 255, 0.4);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-color: rgba(74, 158, 255, 0.5);
    color: var(--accent-blue);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.auto-refresh label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    user-select: none;
}

.auto-refresh input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-teal);
}

.last-update {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.85em;
}

.last-update i {
    color: var(--accent-teal);
}

/* Контейнер устройств */
.devices-container {
    background: rgba(30, 35, 50, 0.2);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.devices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.devices-header h2 {
    color: var(--text-primary);
    font-size: 1.5em;
    font-weight: 600;
}

.devices-header h2 i {
    margin-right: 10px;
    color: var(--accent-teal);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-btn:hover {
    border-color: var(--accent-teal);
    color: var(--accent-teal);
}

.filter-btn.active {
    background: var(--accent-teal);
    color: #000;
    border-color: var(--accent-teal);
}

/* Загрузка и ошибки */
.loading, .error {
    text-align: center;
    padding: 50px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

.loading i {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: var(--accent-teal);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.error {
    color: var(--accent-red);
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: 12px;
    padding: 20px;
}

.error i {
    margin-right: 10px;
}

.warning {
    color: var(--accent-orange);
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid var(--accent-orange);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    font-weight: 500;
}

.warning i {
    margin-right: 10px;
}

/* Список устройств */
.devices-list {
    display: grid;
    gap: 15px;
}

.device-card {
    background: rgba(30, 35, 50, 0.2);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.device-card:hover {
    border-color: var(--accent-teal);
    box-shadow: 0 12px 40px rgba(0, 212, 255, 0.2),
                0 8px 32px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.device-card.expired {
    background: rgba(255, 71, 87, 0.15);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-color: var(--accent-red);
    opacity: 0.8;
}

.device-card.expiring-soon {
    background: rgba(255, 107, 53, 0.15);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-color: var(--accent-orange);
}

.device-info {
    flex: 1;
    min-width: 250px;
}

.device-id {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

.device-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 10px;
}

.device-status.online {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.device-status.offline {
    background: rgba(255, 71, 87, 0.2);
    color: var(--accent-red);
}

.device-status i {
    font-size: 0.7em;
}

.device-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.device-details > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-details i {
    width: 16px;
    color: var(--accent-teal);
}

.device-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.days-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.days-badge.positive {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.days-badge.warning {
    background: rgba(255, 107, 53, 0.2);
    color: var(--accent-orange);
}

.days-badge.danger {
    background: rgba(255, 71, 87, 0.2);
    color: var(--accent-red);
}

.days-badge.expired {
    background: rgba(138, 141, 145, 0.2);
    color: var(--text-muted);
}

/* Плавная анимация появления пунктов меню */
.nav-item {
    animation: slideInLeft 0.4s ease backwards;
}

.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.1s; }
.nav-item:nth-child(3) { animation-delay: 0.15s; }
.nav-item:nth-child(4) { animation-delay: 0.2s; }
.nav-item:nth-child(5) { animation-delay: 0.25s; }
.nav-item:nth-child(6) { animation-delay: 0.3s; }
.nav-item:nth-child(7) { animation-delay: 0.35s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Анимация появления секций */
.nav-section {
    animation: fadeIn 0.5s ease backwards;
}

.nav-section:nth-child(1) { animation-delay: 0.1s; }
.nav-section:nth-child(2) { animation-delay: 0.2s; }
.nav-section:nth-child(3) { animation-delay: 0.3s; }

/* Улучшенная прокрутка для сайдбара */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px;
        margin-left: 0 !important; /* Убираем отступ на маленьких экранах */
        width: 100% !important;
    }
    
    .page-title {
        font-size: 2em;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    /* Сайдбар на очень маленьких экранах - полноэкранный */
    .sidebar {
        max-width: 100% !important; /* Полноэкранный на очень маленьких экранах */
        width: 100% !important;
    }
    
    /* Убеждаемся, что контент не перекрывается на маленьких экранах */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}
    
    .devices-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .device-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .device-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.device-card {
    animation: fadeIn 0.4s ease backwards;
}

.device-card:nth-child(1) { animation-delay: 0.1s; }
.device-card:nth-child(2) { animation-delay: 0.2s; }
.device-card:nth-child(3) { animation-delay: 0.3s; }
.device-card:nth-child(4) { animation-delay: 0.4s; }
.device-card:nth-child(5) { animation-delay: 0.5s; }

/* Формы */
.page-content {
    animation: fadeIn 0.3s ease;
}

.device-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95em;
}

.form-group input {
    padding: 12px;
    background: rgba(30, 35, 50, 0.3);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-teal);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-group small {
    color: var(--text-muted);
    font-size: 0.85em;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.input-group input {
    flex: 1;
}

/* Router Status */
.router-status-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.router-status-result {
    margin-top: 20px;
    padding: 20px;
    background: rgba(30, 35, 50, 0.2);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    min-height: 100px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.status-online {
    color: var(--accent-green);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 600;
}

.status-offline {
    color: var(--accent-red);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 600;
}

/* Usage Statistics */
.usage-stats-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.usage-stat-card {
    background: rgba(30, 35, 50, 0.2);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.usage-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.usage-stat-admin {
    font-weight: 600;
    color: var(--text-primary);
}

.usage-stat-counts {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.usage-stat-count {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.usage-stat-count-label {
    color: var(--text-muted);
    font-size: 0.85em;
}

.usage-stat-count-value {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-primary);
}

/* Router IP */
.router-ip-content {
    padding: 20px;
}

.router-ip-display {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
}

.router-ip-value {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--accent-teal);
    font-family: 'Courier New', monospace;
    margin: 20px 0;
}

.router-ip-timestamp {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Device Actions */
.device-action-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(30, 35, 50, 0.3);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85em;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.device-action-btn:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.device-action-btn.revoke {
    background: rgba(255, 71, 87, 0.2);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-color: rgba(255, 71, 87, 0.4);
    color: var(--accent-red);
}

.device-action-btn.revoke:hover {
    background: rgba(255, 71, 87, 0.2);
}

.device-action-btn.install {
    background: rgba(0, 212, 255, 0.2);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-color: rgba(0, 212, 255, 0.4);
    color: var(--accent-teal);
}

.device-action-btn.install:hover {
    background: rgba(0, 212, 255, 0.3);
    border-color: var(--accent-teal);
    color: var(--accent-teal);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-content {
    background: rgba(30, 35, 50, 0.95);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 10px;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.log-content {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 60vh;
    overflow-y: auto;
    line-height: 1.6;
}

.log-content::-webkit-scrollbar {
    width: 6px;
}

.log-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.log-content::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Online Users Modal */
.online-users-content {
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
}

.online-users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(30, 35, 50, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.online-users-stats {
    font-size: 1.1em;
    color: var(--text-primary);
}

.online-users-stats strong {
    color: var(--accent-green);
    font-size: 1.2em;
}

.online-users-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.online-user-card {
    background: rgba(30, 35, 50, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.online-user-card:hover {
    background: rgba(30, 35, 50, 0.6);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.online-user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.online-user-name {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.online-user-name i {
    color: var(--accent-blue);
}

.online-user-protocol {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.protocol-tcp {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.protocol-udp {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.online-user-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.online-user-detail {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.online-user-detail i {
    color: var(--accent-blue);
    width: 20px;
}

.online-user-detail strong {
    color: var(--text-primary);
    margin-right: 5px;
}

.online-user-stats {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.stat-item i {
    color: var(--accent-green);
}

.no-online-users {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-online-users i {
    font-size: 4em;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 20px;
}

.no-online-users h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.device-action-btn.online {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.2), rgba(39, 174, 96, 0.2));
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.device-action-btn.online:hover {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.3), rgba(39, 174, 96, 0.3));
    border-color: rgba(46, 204, 113, 0.6);
    color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}
