:root {
    --primary: #d32f2f;
    --secondary: #b71c1c;
    --dark: #1a1a1a;
    --light-bg: #f5f5f5;
    --card-bg: #ffffff;
    --border: #e0e0e0;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-bg);
    color: #333;
}

.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #2b2b2b 0%, #1a1a1a 100%);
}

.auth-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 350px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.logo {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 30px;
}

input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box;
}

.btn-primary, .btn-success, .btn-secondary, .btn-outline {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: #2e7d32; color: white; }
.btn-secondary { background: #757575; color: white; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }

.app-header {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.folder-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid var(--border);
}

.folder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.folder-header h3 { margin: 0; color: var(--dark); font-size: 1.1rem; }
.folder-cost { background: #eee; padding: 4px 8px; border-radius: 20px; font-size: 0.8rem; font-weight: bold; }

.dropzone {
    min-height: 120px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    margin: 10px 0;
    padding: 10px;
    background: #fafafa;
    transition: border 0.2s;
}

.dropzone.dragover { border-color: var(--primary); background: #ffeeee; }

.preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid #ddd;
    background: white;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.has-note { border: 2px solid #4caf50; box-shadow: 0 0 0 1px #4caf50; }

.note-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.delete-attach {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.thumb:hover .delete-attach { display: flex; }

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: bold;
}

.copy-link-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
}
.copy-link-btn:hover { opacity: 1; }

/* Дополнительные стили для улучшения UX */
.dropzone.dragover {
    border-color: var(--primary);
    background: #fff0f0;
    transition: all 0.2s ease;
}

.drop-message {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
    padding: 20px 0;
    pointer-events: none;
}

.btn-choose-files {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-choose-files:hover {
    background: #e0e0e0;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.folder-card {
    animation: fadeIn 0.3s ease;
}

.thumb {
    transition: transform 0.2s;
}

.thumb:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* Адаптивность */
@media (max-width: 768px) {
    .folders-grid {
        grid-template-columns: 1fr;
    }
    
    .app-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .auth-container {
        width: 90%;
        padding: 20px;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Индикатор загрузки */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Уведомления */
.toast-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
    background: white;
    border-radius: 12px;
    margin-top: 30px;
}

.empty-state::before {
    content: "📂";
    display: block;
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Модальное окно для просмотра изображений */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-image img {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: block;
    margin: 0 auto;
}

.close-modal {
    position: fixed;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 48px;
    font-weight: 300;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.2s;
    line-height: 1;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
}

.close-modal:hover {
    color: #ff4444;
    background: rgba(0, 0, 0, 0.5);
}

/* Анимация появления */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal[style*="display: flex"] {
    animation: fadeIn 0.2s ease;
}

/* Навигация по скриншотам (стрелки) */
.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    height: auto;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 80px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    z-index: 10001;
    user-select: none;
    line-height: 1;
    padding: 20px;
}

.modal-nav:hover {
    color: white;
    background: none;
}

.modal-nav-prev {
    left: 10px;
}

.modal-nav-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.modal-nav-next {
    right: 10px;
}

.modal-nav-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Для мобильных */
@media (max-width: 768px) {
    .modal-nav {
        font-size: 50px;
        padding: 15px;
    }
    
    .modal-nav-prev {
        left: 0;
    }
    
    .modal-nav-next {
        right: 0;
    }
}

/* Кнопка закрытия тоже без круга */
.close-modal {
    position: fixed;
    top: 20px;
    right: 30px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 50px;
    font-weight: 300;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
    background: none;
    width: auto;
    height: auto;
    display: block;
}

.close-modal:hover {
    color: white;
    transform: scale(1.1);
    background: none;
}

@media (max-width: 768px) {
    .close-modal {
        top: 15px;
        right: 20px;
        font-size: 40px;
    }
}

/* Курсор для кликабельных превью */
.thumb img {
    cursor: pointer;
    transition: opacity 0.2s;
}

.thumb img:hover {
    opacity: 0.8;
}

/* Кастомный тултип для бейджей отделов */
.dept-badge {
    position: relative;
    cursor: help;
}

.dept-badge:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: none;
}

.dept-badge:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
    margin-bottom: -4px;
    z-index: 1000;
    pointer-events: none;
}