/* Голографический стиль IRIKHON Digital Office */
:root {
    --bg-dark: #0a0c10;
    --bg-medium: #151a22;
    --primary: #00a8ff;
    --secondary: #4afcff;
    --accent: #ffaa00;
    --text: #e0e0e0;
    --text-dim: #808080;
    --holo: #00ffff;
    --holo-dim: #00a0a0;
    --grid: #1a3f4f;
    --error: #ff4444;
    --success: #00ff88;
    --warning: #ffaa00;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Courier New', monospace;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    opacity: 0.3;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--holo);
    box-shadow: 0 0 10px var(--holo);
    animation: scan 8s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

.container {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.holographic-header {
    background: rgba(10, 12, 16, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--holo);
    padding: 15px 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo h1 {
    font-size: 24px;
    background: linear-gradient(135deg, var(--holo), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.badge {
    background: var(--holo-dim);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: black;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 15px;
    border-radius: 30px;
    border: 1px solid var(--holo-dim);
    cursor: pointer;
    transition: all 0.3s;
}

.user-profile:hover {
    border-color: var(--holo);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.user-avatar {
    font-size: 24px;
}

.user-name {
    font-weight: bold;
    color: var(--holo);
}

.user-role {
    font-size: 11px;
    color: var(--text-dim);
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.logout-btn:hover {
    background: var(--error);
    color: black;
}

.holographic-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav-item {
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--holo-dim);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-item:hover {
    border-color: var(--holo);
    transform: translateY(-2px);
}

.nav-item.active {
    background: var(--holo);
    color: black;
    border-color: var(--holo);
}

.holographic-card {
    background: rgba(26, 30, 36, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid var(--holo-dim);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--holo);
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--holo-dim);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: var(--holo);
    transform: translateY(-3px);
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--holo);
    margin: 10px 0;
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
}

.progress-bar {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    background: linear-gradient(90deg, var(--holo), var(--primary));
    height: 100%;
    transition: width 0.5s;
    border-radius: 10px;
}

.btn {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--holo);
    color: var(--holo);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:hover {
    background: var(--holo);
    color: black;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-medium);
    border: 1px solid var(--holo);
    border-radius: 20px;
    padding: 30px;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--holo);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--holo-dim);
    color: var(--text);
    border-radius: 8px;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--holo);
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--holo-dim);
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.task-item {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--holo);
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.task-item:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateX(5px);
}

.task-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.task-meta {
    display: flex;
    gap: 15px;
    font-size: 11px;
    color: var(--holo-dim);
    margin-top: 5px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
}

.status-pending { background: #ffaa00; color: black; }
.status-in_progress { background: #00a8ff; color: white; }
.status-answered { background: #00ff88; color: black; }
.status-resolved { background: #00ff88; color: black; }
.status-completed { background: #00ff88; color: black; }

.priority-high { border-left-color: #ff4444; }
.priority-medium { border-left-color: #ffaa00; }
.priority-low { border-left-color: #00ff88; }

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

.stat-card, .task-item {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== АДАПТАЦИЯ ДЛЯ ПЛАНШЕТОВ И ТЕЛЕФОНОВ ==================== */

/* Планшеты (до 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 10px;
    }
    
    .holographic-nav {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-item {
        display: inline-block;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .stat-label {
        font-size: 10px;
    }
}

/* Телефоны (до 768px) */
@media (max-width: 768px) {
    /* Шапка */
    .holographic-header {
        flex-direction: column;
        text-align: center;
        padding: 10px;
        gap: 10px;
    }
    
    .logo h1 {
        font-size: 18px;
    }
    
    .badge {
        font-size: 10px;
    }
    
    .user-profile {
        padding: 5px 10px;
    }
    
    .user-avatar {
        font-size: 20px;
    }
    
    .user-name {
        font-size: 12px;
    }
    
    .user-role {
        font-size: 9px;
    }
    
    .logout-btn {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    /* Карточки */
    .holographic-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .card-title {
        font-size: 14px;
    }
    
    /* Проекты, задачи, отчеты */
    .project-card, .report-card, .task-item {
        padding: 12px;
    }
    
    .project-name, .report-title, .task-title {
        font-size: 14px;
    }
    
    .task-meta {
        font-size: 10px;
        gap: 8px;
    }
    
    /* ========== ЧАТ - АДАПТАЦИЯ ДЛЯ ТЕЛЕФОНА ========== */
    .chat-container {
        flex-direction: column;
        gap: 10px;
        height: auto;
    }
    
    /* Список комнат - горизонтальная прокрутка */
    .rooms-sidebar {
        width: 100%;
        max-height: 100px;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        padding: 10px;
        display: flex;
        gap: 8px;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 15px;
    }
    
    .rooms-sidebar > div:first-child {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        position: sticky;
        left: 0;
        background: rgba(0, 0, 0, 0.5);
        padding: 5px 10px;
        border-radius: 10px;
        margin-bottom: 5px;
    }
    
    .rooms-sidebar h3 {
        font-size: 14px;
        margin: 0;
    }
    
    .room-item {
        display: inline-block;
        width: auto;
        min-width: 100px;
        margin: 0;
        padding: 8px 12px;
        white-space: normal;
    }
    
    /* Основная область чата */
    .chat-main {
        width: 100%;
        height: 450px;
        display: flex;
        flex-direction: column;
    }
    
    .chat-header {
        padding: 10px;
    }
    
    .chat-title {
        font-size: 16px;
    }
    
    /* Правая панель (участники) - СКРЫВАЕМ НА ТЕЛЕФОНЕ */
    .members-sidebar {
        display: none;
    }
    
    /* Сообщения */
    .chat-messages {
        flex: 1;
        padding: 10px;
    }
    
    .message {
        max-width: 85%;
        margin-bottom: 12px;
    }
    
    .message-text {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .message-sender {
        font-size: 11px;
    }
    
    .message-time {
        font-size: 9px;
    }
    
    /* ========== ЯРКИЕ КНОПКИ ДЛЯ ТЕЛЕФОНА В ЧАТЕ ========== */
    .input-toolbar {
        display: flex;
        gap: 8px;
        margin-bottom: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Яркие кнопки */
    .toolbar-btn {
        background: linear-gradient(135deg, #00ffff, #00aaff);
        border: none;
        color: black;
        font-weight: bold;
        padding: 10px 14px;
        border-radius: 30px;
        font-size: 12px;
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
        transition: all 0.2s;
    }
    
    .toolbar-btn:active {
        transform: scale(0.95);
        box-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
    }
    
    /* Кнопка отправки сообщения */
    .chat-input-wrapper .btn {
        background: linear-gradient(135deg, #00ffff, #00aaff);
        border: none;
        color: black;
        font-weight: bold;
        padding: 12px 20px;
        border-radius: 30px;
        font-size: 16px;
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
    }
    
    .chat-input-wrapper .btn:active {
        transform: scale(0.95);
    }
    
    /* Поле ввода */
    .chat-input {
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid #00ffff;
        border-radius: 30px;
        color: white;
        font-size: 16px;
        padding: 12px 15px;
    }
    
    .chat-input:focus {
        outline: none;
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
        border-color: #00ffff;
    }
    
    /* Кнопки редактирования/удаления сообщений */
    .message-action-btn {
        background: rgba(0, 255, 255, 0.3);
        border: 1px solid #00ffff;
        border-radius: 20px;
        padding: 5px 12px;
        font-size: 12px;
        color: #00ffff;
        font-weight: bold;
    }
    
    .message-action-btn:active {
        background: #00ffff;
        color: black;
        transform: scale(0.95);
    }
    
    /* Кнопка создания комнаты */
    .rooms-sidebar .btn {
        background: linear-gradient(135deg, #00ffff, #00aaff);
        border: none;
        color: black;
        font-weight: bold;
        padding: 6px 14px;
        border-radius: 25px;
        box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
    }
    
    /* Кнопка записи голосового/видео */
    .toolbar-btn.recording {
        background: linear-gradient(135deg, #ff4444, #cc0000);
        color: white;
        box-shadow: 0 0 15px rgba(255, 68, 68, 0.6);
        animation: pulse 1s infinite;
    }
    
    /* Контейнер ввода */
    .chat-input-wrapper {
        display: flex;
        gap: 10px;
        flex-direction: column;
    }
    
    /* Анимация пульсации для записи */
    @keyframes pulse {
        0% { opacity: 1; transform: scale(1); }
        50% { opacity: 0.7; transform: scale(0.98); }
        100% { opacity: 1; transform: scale(1); }
    }
    
    /* ========== КОНЕЦ ЧАТ ========== */
    
    /* ПВЗ */
    .pvz-container {
        flex-direction: column;
        height: auto;
    }
    
    .questions-sidebar {
        width: 100%;
        max-height: 150px;
        overflow-y: auto;
    }
    
    .questions-list {
        max-height: 400px;
    }
    
    .question-card {
        padding: 10px;
    }
    
    .question-title {
        font-size: 13px;
    }
    
    .question-meta {
        font-size: 9px;
        gap: 8px;
    }
    
    /* Отделы */
    .departments-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .department-card {
        padding: 12px;
    }
    
    .department-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .department-icon {
        font-size: 40px;
    }
    
    .department-title {
        font-size: 18px;
    }
    
    .department-description {
        font-size: 12px;
    }
    
    .department-stats {
        justify-content: center;
    }
    
    .stat-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    /* Фильтры */
    .filter-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-select {
        width: 100%;
        padding: 10px;
    }
    
    /* Статистика в отчётах */
    .stats-grid-small {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .stat-card-small {
        padding: 8px;
    }
    
    .stat-value-small {
        font-size: 20px;
    }
    
    /* ========== АДАПТАЦИЯ МОДАЛЬНЫХ ОКОН ДЛЯ ТЕЛЕФОНА ========== */
    .modal {
        align-items: flex-end;
    }
    
    .modal-content {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        min-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 20px;
        margin: 0;
        max-height: 85vh;
        overflow-y: auto;
        animation: slideUp 0.3s ease-out;
    }
    
    .modal-header {
        font-size: 18px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--holo-dim);
        margin-bottom: 15px;
        position: sticky;
        top: 0;
        background: var(--bg-medium);
        z-index: 10;
    }
    
    .modal-body {
        padding-bottom: 20px;
    }
    
    .form-input, .form-select, .form-textarea {
        font-size: 16px;
        padding: 12px;
        margin: 8px 0;
    }
    
    .modal-body .btn {
        width: 100%;
        padding: 12px;
        margin-top: 15px;
        font-size: 16px;
    }
    
    /* Редактор Quill в модальных окнах */
    .ql-editor {
        min-height: 180px;
        font-size: 16px;
    }
    
    .ql-toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .ql-toolbar button {
        padding: 8px;
        min-width: 40px;
    }
    
    /* Специально для окон */
    #questionModal .modal-content,
    #reportModal .modal-content,
    #projectModal .modal-content,
    #taskModal .modal-content,
    #departmentModal .modal-content {
        padding: 15px;
    }
    
    .modal-large {
        min-width: auto;
        max-width: 100%;
    }
    
    /* Анимация */
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
}

/* Очень маленькие телефоны (до 480px) */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .project-header, .report-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .task-meta {
        flex-direction: column;
        gap: 4px;
    }
    
    .chat-messages {
        padding: 8px;
    }
    
    .message {
        max-width: 95%;
    }
    
    .input-toolbar {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .toolbar-btn {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    .chat-input-wrapper {
        flex-direction: column;
    }
    
    .chat-input {
        width: 100%;
    }
    
    .chat-input-wrapper .btn {
        width: 100%;
    }
    
    .member-item {
        font-size: 11px;
    }
    
    .upload-area {
        padding: 12px;
        font-size: 12px;
    }
    
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .file-name {
        font-size: 11px;
    }
    
    /* Комнаты чата на маленьких телефонах */
    .rooms-sidebar {
        max-height: 120px;
    }
    
    .room-item {
        min-width: 85px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* Модальные окна на маленьких телефонах */
    .modal-content {
        padding: 15px;
        max-height: 90vh;
    }
    
    .modal-header {
        font-size: 16px;
    }
    
    .form-input, .form-select, .form-textarea {
        font-size: 14px;
        padding: 10px;
    }
    
    .ql-editor {
        min-height: 150px;
        font-size: 14px;
    }
    
    .stats-grid-small {
        grid-template-columns: 1fr;
    }
}

/* Сенсорные экраны (телефоны и планшеты) */
@media (hover: none) and (pointer: coarse) {
    /* Увеличиваем область нажатия */
    .nav-item, .room-item, .question-card, .project-card, .task-item, .btn, .tab-btn, .toolbar-btn {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Убираем hover эффекты (они не работают на тачскринах) */
    .nav-item:hover, .room-item:hover, .btn:hover, .project-card:hover, .task-item:hover {
        transform: none;
    }
    
    /* Добавляем active эффект для тачскринов */
    .nav-item:active, .room-item:active, .btn:active, .tab-btn:active, .toolbar-btn:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
    
    /* Увеличиваем кнопки в чате */
    .toolbar-btn {
        min-height: 44px;
        min-width: 60px;
    }
    
    .message-action-btn {
        min-height: 36px;
        min-width: 44px;
    }
    
    /* Увеличиваем ссылки */
    a, .clickable {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Улучшенная читаемость на телефонах */
@media (max-width: 768px) {
    p, div, span, a, button, input, textarea {
        font-size: 14px;
    }
    
    h1 { font-size: 20px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }
    h4 { font-size: 14px; }
}

/* Отступы для контента на телефонах */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }
    
    .holographic-nav {
        margin-bottom: 15px;
    }
    
    .holographic-card {
        margin-bottom: 10px;
    }
}

/* Фикс для горизонтальной прокрутки */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .container {
        overflow-x: hidden;
    }
    
    .holographic-nav, .tabs, .rooms-sidebar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
}