/* ===== ОСНОВНЫЕ СТИЛИ ===== */
* { 
    font-family: 'Inter', -apple-system, sans-serif; 
}

body { 
    background: #0A0F1F; 
    overflow-x: hidden; 
}

/* ===== СКРОЛЛБАР ===== */
::-webkit-scrollbar { 
    width: 4px; 
    height: 4px; 
}
::-webkit-scrollbar-track { 
    background: #0A0F1F; 
}
::-webkit-scrollbar-thumb { 
    background: #1A3F3F; 
    border-radius: 2px; 
}
::-webkit-scrollbar-thumb:hover { 
    background: #00FFA3; 
}

/* ===== ФОН С ГРАДИЕНТОМ ===== */
.bg-main {
    background: radial-gradient(ellipse at 20% 50%, #0A2F2F 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, #0A2A3F 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, #1A3F3F 0%, transparent 50%),
                #0A0F1F;
    min-height: 100vh;
}

/* ===== СТЕКЛЯННЫЙ ЭФФЕКТ ===== */
.glass {
    background: rgba(10, 15, 31, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 255, 163, 0.1);
}

.glass-dark {
    background: rgba(10, 15, 31, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 255, 163, 0.08);
}

/* ===== НЕОНОВОЕ СВЕЧЕНИЕ ===== */
.neon-glow {
    box-shadow: 0 0 10px rgba(0, 255, 163, 0.2), 0 0 20px rgba(0, 255, 163, 0.1);
}
.neon-text { 
    color: #00FFA3; 
    text-shadow: 0 0 8px rgba(0, 255, 163, 0.4); 
}

/* ===== СНЕЖИНКИ ===== */
.snowflake {
    position: fixed;
    color: white;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
    animation: snowfall linear infinite, sway ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(135, 206, 250, 0.4));
}

@keyframes snowfall {
    0% { transform: translateY(-10vh); }
    100% { transform: translateY(110vh); }
}

@keyframes sway {
    0%, 100% { margin-left: 0px; }
    25% { margin-left: 10px; }
    50% { margin-left: -5px; }
    75% { margin-left: 12px; }
}

/* ===== ЧАСТИЦЫ ===== */
.particle {
    position: fixed;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: particleRise linear infinite, particleGlow ease-in-out infinite;
}

@keyframes particleRise {
    0% { transform: translateY(100vh); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { transform: translateY(-10vh); opacity: 0; }
}

/* ===== АНИМАЦИИ ===== */
.fade-in { 
    animation: fadeIn 0.4s ease forwards; 
    opacity: 0; 
}
@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
    from { opacity: 0; transform: translateY(8px); }
}

/* ===== ПОЛЯ ВВОДА ===== */
.frost-input {
    background: rgba(10, 15, 31, 0.8);
    border: 1px solid rgba(0, 255, 163, 0.15);
    color: white;
    transition: all 0.3s ease;
    font-size: 15px !important;
}
.frost-input:focus {
    border-color: #00FFA3;
    box-shadow: 0 0 10px rgba(0, 255, 163, 0.15);
    outline: none;
}

/* ===== КНОПКИ ===== */
.btn-gradient {
    background: linear-gradient(135deg, #00FFA3, #00CC82);
    color: #0A0F1F;
    transition: all 0.3s ease;
    font-weight: 600;
}

/* ===== САЙДБАР ===== */
.sidebar-item {
    transition: all 0.3s ease;
    position: relative;
}
.sidebar-item:hover, .sidebar-item.active {
    background: rgba(0, 255, 163, 0.1);
    color: #00FFA3;
}
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #00FFA3;
    box-shadow: 0 0 8px #00FFA3;
    border-radius: 0 2px 2px 0;
}

/* ===== СЕЛЕКТЫ ===== */
.select-frost {
    background: rgba(10, 15, 31, 0.8);
    border: 1px solid rgba(0, 255, 163, 0.15);
    color: white;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%2300FFA3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    font-size: 14px;
}

/* ===== СТАТУС БЕЙДЖИ ===== */
.badge-active { background: rgba(0, 255, 163, 0.15); color: #00FFA3; }
.badge-inactive { background: rgba(255, 59, 48, 0.15); color: #FF3B30; }
.badge-warning { background: rgba(255, 204, 0, 0.15); color: #FFCC00; }
.badge-admin { background: rgba(108, 92, 231, 0.15); color: #6C5CE7; }
.badge-user { background: rgba(0, 122, 255, 0.15); color: #007AFF; }
.badge-owner { background: rgba(255, 165, 0, 0.15); color: #FFA500; }
.badge-expired { background: rgba(255, 193, 7, 0.15); color: #FFC107; }

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

/* ===== ТАБЫ ===== */
.tab-active {
    color: #00FFA3;
    border-bottom: 2px solid #00FFA3;
}

/* ===== КНОПКИ В ТОП-БАРЕ ===== */
.top-bar-action-btn {
    background: linear-gradient(135deg, #00FFA3, #00CC82);
    color: #0A0F1F;
    border-radius: 10px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    min-height: 32px;
}
.top-bar-action-btn i {
    font-size: 10px;
}

/* ===== АКТИВАЦИИ ===== */
#activation-error {
    transition: opacity 0.3s ease;
}
#activation-error.hidden {
    display: none;
}

/* ===== МОБИЛЬНОЕ МЕНЮ ===== */
.mobile-menu {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 260px !important;
}
.mobile-menu.open {
    transform: translateX(0);
}

/* ===== ПЛАНШЕТЫ И ТЕЛЕФОНЫ (до 768px) ===== */
@media (max-width: 768px) {
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 40;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }
    
    #sidebar {
        transform: translateX(-100%) !important;
        width: 260px !important;
    }
    #sidebar.open {
        transform: translateX(0) !important;
    }
    
    .page-content > div:first-child {
        margin-top: 60px;
    }
    
    button, .sidebar-item, input, select {
        min-height: 40px;
    }
    
    .modal-overlay + div {
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .page-content { 
        padding-top: 0px !important; 
    }
    input, select, textarea { 
        font-size: 15px !important; 
    }
    .max-w-md { 
        max-width: 90% !important; 
    }
    
    /* Скрываем кнопки на мобильных */
    .page-content > div:first-child .btn-gradient {
        display: none !important;
    }
}

/* ===== МОБИЛЬНЫЕ ТЕЛЕФОНЫ (до 640px) ===== */
@media (max-width: 640px) {
    /* Карточки пользователей */
    .users-mobile-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .user-card {
        background: rgba(10, 15, 31, 0.6);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(0, 255, 163, 0.1);
        border-radius: 16px;
        padding: 14px;
        position: relative;
    }
    
    .user-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .user-id {
        font-size: 11px;
        color: #6B7280;
        background: rgba(0,0,0,0.3);
        padding: 2px 8px;
        border-radius: 20px;
    }
    
    .user-role-badge {
        font-size: 10px;
        padding: 3px 10px;
        border-radius: 20px;
        font-weight: 600;
    }
    
    .user-info-row {
        display: flex;
        margin-bottom: 8px;
        align-items: center;
    }
    
    .user-info-label {
        width: 70px;
        font-size: 11px;
        color: #9CA3AF;
    }
    
    .user-info-value {
        flex: 1;
        font-size: 13px;
        font-weight: 500;
        color: white;
        word-break: break-word;
    }
    
    .user-status-row {
        display: flex;
        align-items: center;
        margin-bottom: 16px;
    }
    
    .user-status-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 11px;
        font-weight: 600;
    }
    
    .user-actions {
        display: flex;
        justify-content: flex-end;
        gap: 6px;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid rgba(255,255,255,0.05);
    }
    
    .user-action-btn {
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(255,255,255,0.05);
        border-radius: 12px;
        padding: 8px 14px;
        font-size: 11px;
        color: #9CA3AF;
        transition: all 0.2s;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }
    
    .user-action-btn:hover {
        background: rgba(0,255,163,0.1);
        color: #00FFA3;
        border-color: rgba(0,255,163,0.2);
    }
    
    /* Карточки ключей */
    .keys-mobile-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .key-card {
        background: rgba(10, 15, 31, 0.6);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(0, 255, 163, 0.1);
        border-radius: 16px;
        padding: 16px;
    }
    
    .key-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .key-code {
        font-family: monospace;
        font-size: 13px;
        font-weight: 600;
        color: #00FFA3;
        word-break: break-all;
        max-width: 70%;
    }
    
    .key-status-badge {
        font-size: 9px;
        padding: 3px 8px;
        border-radius: 20px;
        font-weight: 600;
        white-space: nowrap;
    }
    
    .key-info-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(255,255,255,0.03);
    }
    
    .key-info-label {
        font-size: 11px;
        color: #9CA3AF;
        font-weight: 500;
    }
    
    .key-info-value {
        font-size: 12px;
        font-weight: 600;
        color: white;
        text-align: right;
    }
    
    .key-user-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 8px;
        padding: 10px 0;
        background: rgba(0, 255, 163, 0.03);
        border-radius: 10px;
        padding: 10px 12px;
    }
    
    .key-user-name {
        font-size: 12px;
        color: white;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    .key-user-name i {
        color: #00FFA3;
        font-size: 11px;
    }
    
    .key-action-icons {
        display: flex;
        gap: 8px;
    }
    
    .key-icon-btn {
        background: rgba(255,255,255,0.05);
        border: 1px solid rgba(255,255,255,0.05);
        border-radius: 8px;
        padding: 8px;
        color: #9CA3AF;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 36px;
    }
    
    .key-icon-btn:hover {
        background: rgba(0,255,163,0.1);
        color: #00FFA3;
        border-color: rgba(0,255,163,0.2);
    }
    
    .key-icon-btn i {
        font-size: 14px;
    }
    
    /* Скрываем обычные таблицы на мобильных */
    .desktop-table {
        display: none !important;
    }
}

/* ===== ДЕСКТОП (от 641px) ===== */
@media (min-width: 641px) {
    .mobile-grid-view {
        display: none !important;
    }
    .desktop-table {
        display: table !important;
    }
}

/* ===== ДЕСКТОП (от 769px) ===== */
@media (min-width: 769px) {
    /* Показываем кнопки */
    .page-content > div:first-child .btn-gradient {
        display: flex !important;
    }
    
    /* Таблицы */
    .frost-table th {
        padding: 12px 16px !important;
        font-size: 12px !important;
    }
    
    .frost-table td {
        padding: 12px 16px !important;
        font-size: 13px !important;
    }
    
    .frost-table td .badge-owner,
    .frost-table td .badge-admin,
    .frost-table td .badge-user,
    .frost-table td .badge-active,
    .frost-table td .badge-inactive,
    .frost-table td .badge-warning,
    .frost-table td .badge-expired {
        padding: 4px 12px !important;
        font-size: 11px !important;
    }
    
    .frost-table td button {
        padding: 6px 10px !important;
    }
    
    .frost-table td button i {
        font-size: 12px !important;
    }
    
    /* Заголовки */
    #page-users h1,
    #page-keys h1 {
        font-size: 24px !important;
    }
    
    #page-users p,
    #page-keys p {
        font-size: 14px !important;
    }
    
    /* Кнопки */
    .page-content .btn-gradient {
        font-size: 13px !important;
        padding: 10px 20px !important;
    }
    
    /* Поля ввода */
    .frost-input {
        font-size: 14px !important;
        padding: 10px 16px !important;
    }
    
    .select-frost {
        font-size: 14px !important;
        padding: 10px 32px 10px 16px !important;
    }
    
    /* Отступы для полей с иконками */
    .frost-input.pl-8 {
        padding-left: 36px !important;
    }
    
    .frost-input.pl-9 {
        padding-left: 40px !important;
    }
    
    .frost-input.pl-11 {
        padding-left: 44px !important;
    }
    
    .frost-input.pr-10 {
        padding-right: 40px !important;
    }
    
    /* Иконки */
    .relative i.absolute {
        font-size: 16px !important;
    }
    
    .relative .fa-search {
        left: 14px !important;
    }
    
    /* Модальные окна */
    .modal-content .frost-input.pl-7 {
        padding-left: 32px !important;
    }
    
    .modal-content .relative i.absolute {
        font-size: 14px !important;
        left: 12px !important;
    }
    
    .modal-overlay + div .frost-input {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
    
    .modal-overlay + div .relative i.absolute {
        font-size: 15px !important;
    }
    
    .modal-overlay + div .pl-7 {
        padding-left: 34px !important;
    }
    
    .modal-overlay + div .pl-8 {
        padding-left: 38px !important;
    }
    
    .modal-overlay + div .pl-9 {
        padding-left: 42px !important;
    }
    
    /* Селекты */
    .select-frost {
        background-position: right 16px center !important;
        padding-right: 40px !important;
    }
    
    /* Десктопные таблицы */
    .desktop-table {
        display: table !important;
        width: 100%;
    }
    
    .desktop-table .frost-table {
        min-width: 100%;
    }
}

/* ===== КНОПКИ В ТОП-БАРЕ (специфичные) ===== */
@media (max-width: 768px) {
    .top-bar-action-btn {
        /* мобильные стили уже есть выше */
    }
}

/* ===== ДУРАНДА ДЛЯ ДЛИТЕЛЬНОСТИ И АКТИВАЦИЙ ===== */
.duration-btn.active-duration {
    background: rgba(0, 255, 163, 0.1);
    border-color: rgba(0, 255, 163, 0.5) !important;
    box-shadow: 0 0 15px rgba(0, 255, 163, 0.2);
}

.activation-btn.active-activation {
    background: rgba(0, 255, 163, 0.1);
    border-color: rgba(0, 255, 163, 0.5) !important;
    color: #00FFA3;
}

.badge-active { background: rgba(0, 255, 163, 0.15); color: #00FFA3; }
.badge-inactive { background: rgba(255, 59, 48, 0.15); color: #FF3B30; }
.badge-warning { background: rgba(255, 204, 0, 0.15); color: #FFCC00; }
.badge-expired { background: rgba(0, 255, 255, 0.15); color: #00FFFF; } /* Бирюзовый */
.badge-admin { background: rgba(108, 92, 231, 0.15); color: #6C5CE7; }
.badge-user { background: rgba(0, 122, 255, 0.15); color: #007AFF; }
.badge-owner { background: rgba(255, 165, 0, 0.15); color: #FFA500; }

/* Для мобильных карточек */
.key-status-badge.badge-expired {
    background: rgba(0, 255, 255, 0.15);
    color: #00FFFF;
}