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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Хедер */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    color: white;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
}

.user-info span {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 5px 15px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    transition: background 0.2s;
    font-size: 14px;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

.admin-btn {
    color: white;
    text-decoration: none;
    padding: 5px 15px;
    background: #ffa502;
    border-radius: 20px;
    transition: background 0.2s;
    font-size: 14px;
}

.admin-btn:hover {
    background: #f09c00;
}

/* Область загрузки */
.upload-area {
    background: white;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    border: 3px dashed #e0e0e0;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: scale(1.02);
}

.upload-content {
    text-align: center;
}

.upload-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

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

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.upload-info {
    color: #999;
    font-size: 14px;
    margin-top: 10px;
}

/* Прогресс загрузки */
.upload-progress {
    width: 100%;
    max-width: 400px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

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

#progressText {
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* Список файлов */
.file-list {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.file-list-header h2 {
    color: #333;
    font-size: 1.5em;
}

.refresh-btn {
    background: #f0f0f0;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.refresh-btn:hover {
    background: #e0e0e0;
}

#filesContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.loading {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 16px;
    grid-column: 1 / -1;
}

/* Карточка файла */
.file-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.file-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.file-card .file-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.file-card .file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    word-break: break-word;
}

.file-card .file-meta {
    color: #888;
    font-size: 13px;
    margin-bottom: 5px;
}

.file-card .file-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.file-card .file-actions a,
.file-card .file-actions button {
    flex: 1;
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    min-width: 80px;
}

.file-card .download-link {
    background: #667eea;
    color: white;
}

.file-card .download-link:hover {
    background: #5a67d8;
}

.file-card .delete-btn {
    background: #ff4757;
    color: white;
}

.file-card .delete-btn:hover {
    background: #ff3747;
}

.file-card .share-btn {
    background: #2ed573;
    color: white;
}

.file-card .share-btn:hover {
    background: #26b865;
}

.file-card .edit-btn {
    background: #ffa502;
    color: white;
}

.file-card .edit-btn:hover {
    background: #f09c00;
}

.file-card .public-btn {
    background: #2ed573;
    color: white;
}

.file-card .public-btn:hover {
    background: #26b865;
}

.file-card .unpublic-btn {
    background: #ff4757;
    color: white;
}

.file-card .unpublic-btn:hover {
    background: #ff3747;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
    z-index: 1000;
    max-width: 400px;
}

.toast.success {
    background: #2ed573;
}

.toast.error {
    background: #ff4757;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}


/* Переключатель вида */
.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.file-list-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    gap: 5px;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 10px;
    margin-left: 5px;
}

.view-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

.view-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.view-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.view-btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Таблица - полная ширина и улучшенный дизайн */
.table-view {
    display: block !important;
    padding: 0 !important;
    width: 100%;
}

.table-view .file-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

/* Ширина колонок */
.table-view .file-table th:nth-child(1),
.table-view .file-table td:nth-child(1) {
    width: 30%;
} /* Файл */

.table-view .file-table th:nth-child(2),
.table-view .file-table td:nth-child(2) {
    width: 12%;
} /* Размер */

.table-view .file-table th:nth-child(3),
.table-view .file-table td:nth-child(3) {
    width: 18%;
} /* Дата */

.table-view .file-table th:nth-child(4),
.table-view .file-table td:nth-child(4) {
    width: 10%;
} /* Скачиваний */

.table-view .file-table th:nth-child(5),
.table-view .file-table td:nth-child(5) {
    width: 12%;
} /* Статус */

.table-view .file-table th:nth-child(6),
.table-view .file-table td:nth-child(6) {
    width: 18%;
} /* Действия */

.table-view .file-table thead {
    background: #f0f2f5;
    border-radius: 12px 12px 0 0;
}

.table-view .file-table th {
    padding: 14px 16px;
    text-align: left;
    color: #555;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-view .file-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e8e8e8;
    vertical-align: middle;
}

/* Чередование цветов строк */
.table-view .file-table tbody tr:nth-child(odd) {
    background-color: #fafafa;
}

.table-view .file-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

.table-view .file-table tbody tr:hover {
    background-color: #f0f4ff !important;
    transition: background-color 0.2s ease;
}

/* Информация о файле в таблице */
.table-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-file-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.table-file-name {
    font-weight: 500;
    color: #333;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Статус в таблице */
.table-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.table-status.public {
    background: #e8f5e9;
    color: #2e7d32;
}

.table-status.private {
    background: #fce4ec;
    color: #c62828;
}

/* Действия в таблице */
.table-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.table-actions button,
.table-actions a {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.table-actions .download-link {
    background: #667eea;
    color: white;
}

.table-actions .download-link:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.table-actions .share-btn {
    background: #2ed573;
    color: white;
}

.table-actions .share-btn:hover {
    background: #26b865;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(46, 213, 115, 0.3);
}

.table-actions .public-btn {
    background: #2ed573;
    color: white;
}

.table-actions .public-btn:hover {
    background: #26b865;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(46, 213, 115, 0.3);
}

.table-actions .unpublic-btn {
    background: #ff6b81;
    color: white;
}

.table-actions .unpublic-btn:hover {
    background: #ff4757;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

.table-actions .delete-btn {
    background: #ff4757;
    color: white;
}

.table-actions .delete-btn:hover {
    background: #ff3747;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

/* Карточки */
.cards-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    padding: 0 !important;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .table-view .file-table {
        font-size: 13px;
    }
    
    .table-view .file-table th,
    .table-view .file-table td {
        padding: 12px 14px;
    }
    
    .table-view .file-table th:nth-child(1),
    .table-view .file-table td:nth-child(1) {
        width: 25%;
    }
    
    .table-view .file-table th:nth-child(2),
    .table-view .file-table td:nth-child(2) {
        width: 10%;
    }
    
    .table-view .file-table th:nth-child(3),
    .table-view .file-table td:nth-child(3) {
        width: 15%;
    }
    
    .table-view .file-table th:nth-child(4),
    .table-view .file-table td:nth-child(4) {
        width: 8%;
    }
    
    .table-view .file-table th:nth-child(5),
    .table-view .file-table td:nth-child(5) {
        width: 12%;
    }
    
    .table-view .file-table th:nth-child(6),
    .table-view .file-table td:nth-child(6) {
        width: 30%;
    }
}

@media (max-width: 768px) {
    .file-list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .file-list-controls {
        justify-content: space-between;
        width: 100%;
    }
    
    .view-toggle {
        margin-left: 0;
    }
    
    .table-view .file-table {
        font-size: 12px;
    }
    
    .table-view .file-table th,
    .table-view .file-table td {
        padding: 10px 12px;
    }
    
    .table-view .file-table th:nth-child(1),
    .table-view .file-table td:nth-child(1) {
        width: 20%;
    }
    
    .table-view .file-table th:nth-child(2),
    .table-view .file-table td:nth-child(2) {
        width: 8%;
    }
    
    .table-view .file-table th:nth-child(3),
    .table-view .file-table td:nth-child(3) {
        width: 12%;
    }
    
    .table-view .file-table th:nth-child(4),
    .table-view .file-table td:nth-child(4) {
        width: 8%;
    }
    
    .table-view .file-table th:nth-child(5),
    .table-view .file-table td:nth-child(5) {
        width: 10%;
    }
    
    .table-view .file-table th:nth-child(6),
    .table-view .file-table td:nth-child(6) {
        width: 42%;
    }
    
    .table-file-icon {
        font-size: 22px;
        width: 28px;
    }
    
    .table-file-name {
        font-size: 12px;
        max-width: 80px;
    }
    
    .table-actions button,
    .table-actions a {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .table-status {
        font-size: 11px;
        padding: 2px 8px;
    }
}

@media (max-width: 480px) {
    .table-view .file-table {
        font-size: 11px;
    }
    
    .table-view .file-table th,
    .table-view .file-table td {
        padding: 8px 10px;
    }
    
    .table-view .file-table th:nth-child(2),
    .table-view .file-table td:nth-child(2) {
        display: none;
    } /* Скрываем размер на очень маленьких экранах */
    
    .table-view .file-table th:nth-child(4),
    .table-view .file-table td:nth-child(4) {
        display: none;
    } /* Скрываем скачивания на очень маленьких экранах */
    
    .table-file-name {
        max-width: 60px;
        font-size: 11px;
    }
    
    .table-file-icon {
        font-size: 18px;
        width: 24px;
    }
    
    .table-actions {
        gap: 4px;
    }
    
    .table-actions button,
    .table-actions a {
        padding: 3px 6px;
        font-size: 11px;
        min-width: 0;
    }
    
    .table-status {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* Добавить в конец файла */

/* Кнопка смены пароля */
.change-password-btn {
    color: white;
    text-decoration: none;
    padding: 5px 15px;
    background: #ffa502;
    border-radius: 20px;
    transition: background 0.2s;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.change-password-btn:hover {
    background: #f09c00;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    color: #333;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    padding: 0 10px;
}

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

.password-form .form-group {
    margin-bottom: 15px;
}

.password-form label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.password-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border 0.3s;
    box-sizing: border-box;
}

.password-form input:focus {
    outline: none;
    border-color: #667eea;
}

.password-form .btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.password-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid #c3e6cb;
    text-align: center;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid #f5c6cb;
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Адаптивность для модального окна */
@media (max-width: 480px) {
    .modal-content {
        padding: 20px;
        width: 95%;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .password-form input {
        font-size: 14px;
        padding: 10px;
    }
}