/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', sans-serif;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    background-attachment: fixed;
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Анимация снега */
#snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5em;
    font-family: Arial, sans-serif;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    animation: snowfall linear infinite;
    opacity: 0.7;
}

@keyframes snowfall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0.7;
    }
    25% {
        transform: translateY(25vh) translateX(var(--h-move, 50px)) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: translateY(50vh) translateX(var(--h-move, 100px)) rotate(180deg);
        opacity: 1;
    }
    75% {
        transform: translateY(75vh) translateX(var(--h-move, 50px)) rotate(270deg);
        opacity: 0.8;
    }
    100% {
        transform: translateY(100vh) translateX(var(--h-move, 0px)) rotate(360deg);
        opacity: 0;
    }
}

/* Контейнеры */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.5s ease-out;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Хедер - Glassmorphism */
.header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: slideInUp 0.6s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.header:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4a90e2, #357abd);
}

.header h1 {
    color: #e0e0e0;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* Действия в хедере */
.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

/* Основной контент - Glassmorphism */
.main-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: fadeIn 0.7s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.3s ease;
}

.main-content:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

/* Кнопки */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(40, 40);
        opacity: 0;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #357abd 0%, #2a6aa5 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #555 0%, #444 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #666 0%, #555 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-admin {
    background: linear-gradient(135deg, #5a5a5a 0%, #4a4a4a 100%);
    color: white;
}

.btn-admin:hover {
    background: linear-gradient(135deg, #6a6a6a 0%, #5a5a5a 100%);
    transform: translateY(-2px);
}

.btn-logout {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    color: white;
}

.btn-logout:hover {
    background: linear-gradient(135deg, #b71c1c 0%, #9a0000 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

/* Фильтры тикетов */
.ticket-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 20px;
    border: 2px solid #3a3a3a;
    border-radius: 25px;
    background: transparent;
    color: #b0b0b0;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: #4a90e2;
    color: #4a90e2;
}

.filter-btn.active {
    background: #4a90e2;
    border-color: #4a90e2;
    color: white;
}

/* Карточки тикетов - Glassmorphism */
.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    animation: fadeIn 0.8s ease-out;
}

.ticket-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.ticket-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(74, 144, 226, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(74, 144, 226, 0.3),
                0 0 0 1px rgba(74, 144, 226, 0.3) inset;
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4a90e2, #357abd);
    opacity: 0;
    transition: opacity 0.3s;
}

.ticket-card:hover::before {
    opacity: 1;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 15px;
}

.ticket-header h3 {
    color: #e0e0e0;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    line-height: 1.4;
}

/* Бейджи статусов */
.status-badge {
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-open {
    background: linear-gradient(135deg, rgba(26, 58, 90, 0.9) 0%, rgba(106, 182, 255, 0.2) 100%);
    color: #6bb6ff;
    border: 1px solid rgba(107, 182, 255, 0.3);
}

.status-in_progress {
    background: linear-gradient(135deg, rgba(58, 42, 26, 0.9) 0%, rgba(255, 179, 102, 0.2) 100%);
    color: #ffb366;
    border: 1px solid rgba(255, 179, 102, 0.3);
}

.status-closed {
    background: linear-gradient(135deg, rgba(26, 58, 26, 0.9) 0%, rgba(102, 255, 102, 0.2) 100%);
    color: #66ff66;
    border: 1px solid rgba(102, 255, 102, 0.3);
}

/* Информация тикета */
.ticket-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    color: #b0b0b0;
    font-size: 14px;
}

.ticket-category {
    display: inline-block;
    background: rgba(74, 144, 226, 0.1);
    color: #6bb6ff;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    align-self: flex-start;
}

.ticket-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #3a3a3a;
    color: #808080;
    font-size: 12px;
}

/* Кастомное поле ввода */
.custom-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    font-size: 16px;
    color: #e0e0e0;
    font-family: inherit;
    transition: all 0.3s;
    resize: vertical;
    line-height: 1.5;
}

.custom-textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.custom-textarea::placeholder {
    color: #808080;
}

/* Чат сообщения - Glassmorphism */
.message {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid rgba(74, 144, 226, 0.6);
    animation: slideInRight 0.4s ease-out;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.message:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.message.own-message {
    background: rgba(26, 42, 58, 0.4);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border-left-color: rgba(107, 182, 255, 0.6);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.message-header strong {
    color: #e0e0e0;
    font-weight: 600;
}

.badge-admin {
    background: linear-gradient(135deg, #ff8a65 0%, #ff7043 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

.badge-vip {
    background: linear-gradient(135deg, #ffd54f 0%, #ffca28 100%);
    color: #222;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}

/* Форма отправки сообщения - Glassmorphism */
.message-form-container {
    position: relative;
    margin-top: 30px;
}

.message-form {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    position: sticky;
    bottom: 20px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.message-form textarea {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: #e0e0e0;
    font-size: 16px;
    padding: 15px;
    width: 100%;
    min-height: 100px;
    resize: none;
    transition: all 0.3s;
    font-family: inherit;
}

.message-form textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

/* Уведомления - Glassmorphism */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(74, 144, 226, 0.5);
    border-radius: 16px;
    padding: 20px;
    max-width: 350px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: slideInRight 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9999;
    display: none;
}

.notification.show {
    display: block;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.notification-title {
    color: #4a90e2;
    font-weight: 600;
    font-size: 16px;
}

.notification-close {
    background: none;
    border: none;
    color: #808080;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.3s;
}

.notification-close:hover {
    color: #ff6b6b;
}

.notification-body {
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.5;
}

/* Загрузчик */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(74, 144, 226, 0.3);
    border-radius: 50%;
    border-top-color: #4a90e2;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #b0b0b0;
    font-size: 18px;
    animation: fadeIn 0.8s ease-out;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Кнопка панели управления для ПК - скрывается на мобильных */
@media (max-width: 768px) {
    .header a[title="Панель управления"] {
        display: none !important;
    }
}

/* Кнопка панели управления для ПК - справа */
.admin-panel-btn {
    position: absolute !important;
    right: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    padding: 10px 15px !important;
    font-size: 20px !important;
    z-index: 10 !important;
    border-radius: 12px !important;
}

/* Адаптивность */
@media (max-width: 768px) {
    .admin-panel-btn {
        display: none !important;
    }
    
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    
    .header-actions {
        justify-content: center;
        width: 100%;
    }
    
    .tickets-grid {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .ticket-filters {
        justify-content: center;
    }
    
    .notification {
        left: 10px;
        right: 10px;
        max-width: none;
        bottom: 10px;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .ticket-card {
        padding: 20px;
    }
    
    .ticket-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-badge {
        align-self: flex-start;
    }
}

/* Плавные переходы для динамического контента */
.dynamic-content {
    animation: fadeIn 0.3s ease-out;
}
/* Стили для форм авторизации - Glassmorphism */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    background-attachment: fixed;
}

.auth-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    animation: fadeIn 0.5s ease-out;
    transition: all 0.3s ease;
}

.auth-card:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #e0e0e0;
    font-size: 28px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #b0b0b0;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.select-admin {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    font-size: 16px;
    color: #e0e0e0;
    font-family: inherit;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.select-admin:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 10px;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: #b0b0b0;
    font-size: 14px;
}

.auth-link a {
    color: #4a90e2;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.auth-link a:hover {
    color: #357abd;
    text-decoration: underline;
}

.error-message {
    background: rgba(211, 47, 47, 0.1);
    color: #ff6b6b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid rgba(211, 47, 47, 0.3);
    font-size: 14px;
}

.success-message {
    background: rgba(76, 175, 80, 0.1);
    color: #66ff66;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid rgba(76, 175, 80, 0.3);
    font-size: 14px;
}

.password-requirements {
    color: #808080;
    font-size: 12px;
    margin-top: 5px;
}

/* Стили для модальных окон - Glassmorphism */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 24px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.modal h3 {
    color: #e0e0e0;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Индикатор новой загрузки */
.new-message-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #4a90e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
    z-index: 1;
}