/* Кастомные стили для KnackTask */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS переменные */
:root {
    --primary-color: #4B62DA;
    --text-color: #FFFFFF;
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.3);
    --card-radius: 4px;
    --button-radius: 20px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Специальные переменные для форм авторизации */
    --auth-form-bg: #4B62DA;
    --auth-form-text: #FFFFFF;
    --auth-form-border: rgba(255, 255, 255, 0.3);
}

/* Общие стили */
* {
    font-family: var(--font-family) !important;
}

html {
    background: #4B62DA;
    min-height: 100vh;
}

body {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3A4BB5 100%);
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

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

/* Заголовок */
.header {
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-right {
    display: flex;
    gap: 10px;
}

.welcome-section h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
    text-align: left;
}

.welcome-section p {
    font-size: 16px;
    opacity: 0.8;
    margin: 0;
}

/* Секции */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: left;
}

/* Заголовки */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    font-weight: 600;
    margin: 0;
}

/* Кнопки */
.btn {
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: var(--button-radius);
    color: var(--text-color);
    padding: 12px 24px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap; /* Запрещаем перенос текста */
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: var(--card-border);
}

.btn-primary {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-delete {
    background: rgba(244, 67, 54, 0.2);
    border-color: rgba(244, 67, 54, 0.4);
}

.btn-delete:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.6);
}

/* Карточки */
.card, .figure-card {
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.card:hover, .figure-card:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Плитки чертежей - одинаковый размер */
.figures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.figure-card {
    height: 320px;
    display: flex;
    flex-direction: column;
    padding: 0;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

/* Изображение чертежа */
.figure-image {
    height: 60%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    margin: 8px 8px 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.figure-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
}

/* Заглушка для изображения */
.figure-image-placeholder {
    width: 100%;
    height: 100%;
    background: url('figure-images/placeholder.png') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Контент плитки */
.figure-content {
    padding: 15px;
    height: 40%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.figure-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: white;
    line-height: 1.3;
}

.figure-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.figure-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

/* Плитка "Создать новый" */
.create-card {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 320px;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--card-radius);
    padding: 0;
}

.create-card:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-4px);
}

.create-icon {
    font-size: 48px;
    font-weight: 300;
    margin-bottom: 15px;
    opacity: 0.8;
    color: white;
}

.create-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: white;
}

/* Убираем статистику объектов */
.figure-stats {
    display: none;
}

.figure-actions {
    display: flex;
    gap: 8px;
}

.figure-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: var(--button-radius);
}

/* Системные чертежи */
.system-card {
    /* Используем те же стили, что и обычные карточки */
    border: 3px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.system-badge {
    background: var(--main-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
}

/* Уведомление о копии системного чертежа */
.system-copy-notice {
    background: rgba(75, 98, 218, 0.2);
    border: 2px solid rgba(75, 98, 218, 0.5);
    border-radius: 12px;
    padding: 4px 12px;
    font-size: 12px;
    color: white;
    font-weight: 500;
    margin-right: 10px;
}

/* Категории */
.categories {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.category-btn {
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: var(--card-radius);
    color: var(--text-color);
    padding: 10px 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: var(--card-radius);
    color: var(--text-color);
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input::placeholder, .form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

/* Панели */
.top-panel, .bottom-panel {
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 15px 20px;
    margin: 10px 0;
}

/* Статус и сообщения */
.status {
    color: var(--text-color);
    font-size: 14px;
    opacity: 0.9;
}

.error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border: 2px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--card-radius);
    padding: 10px;
    margin: 10px 0;
}

.success {
    color: #51cf66;
    background: rgba(81, 207, 102, 0.1);
    border: 2px solid rgba(81, 207, 102, 0.3);
    border-radius: var(--card-radius);
    padding: 10px;
    margin: 10px 0;
}

/* Загрузка */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(75, 98, 218, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--text-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: var(--card-radius);
    margin-top: 40px;
}

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 30px;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .figures-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 900px) {
    .figures-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 600px) {
    .figures-grid {
        grid-template-columns: 1fr; /* Только одна колонка на узких экранах */
        gap: 15px;
    }
    
    .figure-card {
        max-width: 100%;
        min-width: 280px; /* Минимальная ширина карточки */
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-right {
        justify-content: center;
    }
    
    .welcome-section h1 {
        text-align: center;
    }
}

/* Убираем все эмодзи */
.emoji {
    display: none;
}

/* Скрываем эмодзи в тексте */
h1::before, h2::before, h3::before, 
.btn::before, .figure-card::before {
    content: none !important;
}

/* Стили для логотипа */
.logo {
    max-height: 40px;
    max-width: 200px;
    object-fit: contain;
    margin-right: 15px;
}

.logo-small {
    max-height: 24px;
    max-width: 120px;
}

/* Профиль */
.profile-section {
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 30px;
    margin-bottom: 30px;
}

.profile-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.profile-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.link-btn {
    color: var(--text-color);
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.link-btn:hover {
    opacity: 1;
}

/* Modal стили */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border: 3px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-color);
}

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

.modal-content input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--card-radius);
    color: var(--text-color);
    font-size: 14px;
    box-sizing: border-box;
}

.modal-content input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.modal-content input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-buttons .btn {
    min-width: 100px;
}

.btn-danger {
    background: rgba(244, 67, 54, 0.2);
    border: 3px solid rgba(244, 67, 54, 0.4);
    color: #f44336;
}

.btn-danger:hover {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.5);
}

/* Логотип стили */
.dashboard-logo {
    width: 144px !important; /* 120 * 1.2 */
    height: 48px !important; /* 40 * 1.2 */
    max-width: 144px !important;
    max-height: 48px !important;
}

.welcome-section h1 {
    font-size: 24px; /* уменьшено с 28px */
    font-weight: 600;
    margin-bottom: 5px;
}

.profile-info h2 {
    font-size: 28px;
    margin-bottom: 5px;
}

.profile-info p {
    opacity: 0.8;
    font-size: 16px;
}

.profile-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .profile-form {
        grid-template-columns: 1fr;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-avatar {
        margin-right: 0;
        margin-bottom: 15px;
    }
}

/* Клетчатый фон */
.grid-background {
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: 0 0, 0 0;
}

/* Новый макет с хэдером и боковым меню */
.app-container {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #3A4BB5 100%);
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 24px 24px;
    display: flex;
    flex-direction: column;
}

/* Хэдер */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    gap: 10px;
}

.header .logo {
    height: 50px;
    width: auto;
}

/* Основной макет */
.main-layout {
    display: flex;
    flex: 1;
    margin-top: 80px; /* Отступ для фиксированного хэдера */
}

/* Боковая панель */
.sidebar {
    position: fixed;
    top: 80px; /* Под фиксированным хэдером */
    left: 0;
    bottom: 0; /* Убираем отступ для footer */
    width: 250px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 0;
    overflow-y: auto; /* Скролл для длинного меню */
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 15px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--card-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-left: 3px solid white;
}

.nav-text {
    font-weight: 500;
}

/* Основной контент */
.main-content {
    flex: 1;
    margin-left: 250px; /* Отступ для закрепленной боковой панели */
    padding: 30px;
    overflow-y: auto;
    min-height: calc(100vh - 80px); /* Полная высота минус хэдер */
}


/* Секции контента */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Уведомление о разработке */
.development-notice {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--card-radius);
    padding: 60px 40px;
    text-align: center;
    margin-top: 40px;
}

.development-notice p {
    font-size: 18px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }
    
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px; /* Обновляем отступ для уменьшенной боковой панели */
        padding: 20px;
    }
    
    .header .logo {
        height: 45px;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 10px 15px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        position: fixed;
        top: 80px; /* Под фиксированным хэдером */
        height: calc(100vh - 80px); /* Высота минус только хэдер */
        z-index: 1001;
        width: 250px; /* Полная ширина на мобильных */
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0; /* Убираем отступ на мобильных */
        padding: 15px;
    }
    
    .header .logo {
        height: 40px;
    }
    
    .header-right {
        gap: 8px;
    }
    
    .header-right .btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Аватар в хедере */
.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.header-avatar:hover {
    background: rgba(255, 255, 255, 0.3);
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.header-avatar-placeholder {
    color: white;
    font-weight: 600;
    font-size: 16px;
}

/* Аватар автора в карточках */
.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
}

.author-avatar-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

/* Прелоадер */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(75, 98, 218, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    font-size: 18px;
    font-weight: 500;
    margin-top: 20px;
}

/* Footer */
.footer {
    background: #FFFFFF;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 20px 30px;
    margin-top: auto;
}

.footer-content {
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-logo {
    height: 40px;
    width: auto;
}

/* Адаптивность для footer */
@media (max-width: 768px) {
    .footer {
        padding: 15px 20px;
    }
    
    .footer-logo {
        height: 35px;
    }
}

@media (max-width: 600px) {
    .footer {
        padding: 10px 15px;
    }
    
    .footer-logo {
        height: 30px;
    }
}
