/* ================================
   БАЗОВЫЕ СТИЛИ
   ================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* ================================
   СТРАНИЦА АВТОРИЗАЦИИ
   ================================ */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo i {
    font-size: 50px;
    color: #667eea;
    margin-bottom: 15px;
}

.logo h1 {
    color: #333;
    font-size: 28px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
}

.input-with-icon input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

.input-with-icon input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.test-account {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    border-left: 4px solid #667eea;
}

.alert {
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: center;
}

.alert-danger {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

/* ================================
   ЛИЧНЫЙ КАБИНЕТ - ОБЩИЕ СТИЛИ
   ================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info span {
    font-size: 16px;
    color: #555;
}

.btn-logout {
    background: #ff6b6b;
    color: white;
    padding: 10px 20px;
    width: auto;
}

.btn-logout:hover {
    background: #ff5252;
}

/* ================================
   СЕТКА ФОРМАТОВ
   ================================ */
.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

/* ================================
   СЕКЦИЯ ФОРМАТА
   ================================ */
.format-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.format-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.format-section h2 i {
    color: #667eea;
}

/* ================================
   ОБЛАСТЬ ЗАГРУЗКИ
   ================================ */
.upload-area {
    border: 3px dashed #ddd;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 25px;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    background: #fafafa;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area i {
    font-size: 50px;
    color: #667eea;
    margin-bottom: 15px;
    opacity: 0.7;
}

.upload-area p {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.progress-bar {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    margin-top: 20px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s;
}

/* ================================
   ГАЛЕРЕЯ ПРЕВЬЮШЕК
   ================================ */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    min-height: 100px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 10px;
    transition: all 0.3s;
}

/* Индикатор загрузки */
.gallery.loading {
    position: relative;
    min-height: 100px;
}

.gallery.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ================================
   ЭЛЕМЕНТ ПРЕВЬЮ
   ================================ */
.preview-item {
    position: relative;
    width: 100%;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
    cursor: pointer;
    background: #fff;
}

.preview-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.document-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 30px;
}

.document-preview i {
    opacity: 0.9;
}

/* ================================
   ИКОНКА УДАЛЕНИЯ (ВСЕГДА ВИДИМАЯ)
   ================================ */
.delete-btn {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 107, 107, 0.95);
    border: 2px solid white;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Для десктопов - в правом верхнем углу */
.delete-btn {
    top: 5px;
    right: 5px;
}

.delete-btn:hover {
    background: #ff5252;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.delete-btn i {
    font-size: 14px;
}

/* Анимация нажатия для кнопок */
.delete-btn:active,
.btn:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

/* ================================
   СООБЩЕНИЕ "ФАЙЛЫ ОТСУТСТВУЮТ"
   ================================ */
.no-files {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 40px 20px;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 10px;
    border: 2px dashed #ddd;
}

/* ================================
   МОДАЛЬНОЕ ОКНО ДЛЯ ПРОСМОТРА ФОТО
   ================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    display: block;
    max-width: 90%;
    max-height: 80%;
    margin: 5% auto;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 1001;
}

.close-modal:hover {
    color: #ccc;
}

#modalCaption {
    text-align: center;
    color: white;
    padding: 20px;
    font-size: 18px;
}

/* ================================
   УВЕДОМЛЕНИЯ
   ================================ */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transform: translateX(150%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.notification-error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.notification-info {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

.notification i {
    font-size: 20px;
}

.notification-text {
    font-size: 14px;
}

/* ================================
   АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ================================ */

/* Для планшетов и небольших экранов */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        padding: 15px;
        gap: 15px;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .btn-logout {
        width: 100%;
    }
    
    .formats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .format-section {
        padding: 20px;
    }
    
    .upload-area {
        padding: 30px 15px;
        margin: 15px 0;
    }
    
    .upload-area i {
        font-size: 40px;
        margin-bottom: 10px;
    }
    
    .upload-area p {
        font-size: 13px;
        line-height: 1.4;
        margin-bottom: 10px;
    }
    
    .format-section h2 {
        font-size: 18px;
        padding: 10px 0;
        margin-bottom: 15px;
    }
    
    /* На мобильных - уменьшаем иконку удаления и помещаем в правый нижний угол */
    .delete-btn {
        width: 15px;
        height: 15px;
        top: auto;
        right: 5px;
        bottom: 5px;
    }
    
    .delete-btn i {
        font-size: 12px;
    }
    
    /* Увеличиваем превьюшки для мобильных */
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 12px;
    }
    
    .preview-item {
        height: 110px;
    }
    
    /* Улучшаем модальное окно */
    .modal-content {
        max-width: 95%;
        max-height: 85%;
        margin: 10% auto;
    }
    
    .close-modal {
        top: 10px;
        right: 20px;
        font-size: 35px;
    }
}

/* Для очень маленьких экранов (смартфоны) */
@media (max-width: 480px) {
    .auth-box {
        padding: 25px;
    }
    
    .logo i {
        font-size: 40px;
    }
    
    .logo h1 {
        font-size: 24px;
    }
    
    .formats-grid {
        gap: 15px;
    }
    
    .format-section {
        padding: 15px;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
    }
    
    .preview-item {
        height: 90px;
    }
    
    /* На очень маленьких экранах делаем иконку еще меньше */
    .delete-btn {
        width: 22px;
        height: 22px;
        right: 4px;
        bottom: 4px;
    }
    
    .delete-btn i {
        font-size: 10px;
    }
    
    /* Улучшаем уведомления для мобильных */
    .notification {
        left: 10px;
        right: 10px;
        top: 10px;
        width: auto;
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .notification-text {
        font-size: 13px;
    }
}

/* Улучшения для iOS Safari */
@supports (-webkit-touch-callout: none) {
    .delete-btn,
    .preview-item,
    .upload-area {
        -webkit-tap-highlight-color: transparent;
    }
    
    .upload-area:active {
        background: rgba(102, 126, 234, 0.1);
    }
}

/* Предотвращение масштабирования при вводе на iOS */
@media screen and (max-width: 768px) {
    input,
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Улучшения для старых Android */
@media screen and (-webkit-min-device-pixel-ratio:0) and (max-width: 768px) {
    .delete-btn {
        min-height: 28px;
        min-width: 28px;
    }
}

/* Анимации для плавного взаимодействия */
.preview-item,
.upload-area,
.btn,
.delete-btn {
    transition: all 0.3s ease;
}

/* Дополнительные эффекты при наведении (только для десктопа) */
@media (hover: hover) and (pointer: fine) {
    .preview-item:hover .delete-btn {
        transform: scale(1.1);
    }
    
    .upload-area:hover {
        background: rgba(102, 126, 234, 0.05);
    }
}

/* Оптимизация для высоких экранов */
@media (min-height: 800px) {
    .auth-container {
        padding: 40px 20px;
    }
    
    .container {
        padding: 30px 20px;
    }
}

/* Добавляем в существующий style.css */

.format-description {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    font-weight: normal;
    font-style: italic;
}

.no-formats {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.no-formats p {
    color: #888;
    font-size: 18px;
}