* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --primary-light: #e8f0fe;
    --danger: #ea4335;
    --success: #34a853;
    --warning: #fbbc04;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-hover: #f1f3f4;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.2);
    --radius: 8px;
    --sidebar-width: 256px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    overflow: hidden;
}

.app {
    display: flex;
    height: 100vh;
}

/* Сайдбар */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    margin-bottom: 24px;
}

.logo i {
    font-size: 32px;
    color: var(--primary);
}

.logo span {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-secondary);
}

.btn-new {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    margin-bottom: 8px;
}

.btn-new:hover {
    background: var(--bg-hover);
    box-shadow: var(--shadow-lg);
}

.btn-new i {
    font-size: 18px;
    color: var(--primary);
}

.new-menu {
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 16px;
}

.new-menu.active {
    display: flex;
}

.new-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.new-menu button:hover {
    background: var(--bg-hover);
}

.new-menu button i {
    width: 20px;
    color: var(--text-secondary);
}

.nav-menu {
    flex: 1;
    margin-top: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 0 24px 24px 0;
    margin-right: -16px;
    transition: background 0.2s;
}

.nav-item:hover {
    background: var(--bg-hover);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.storage-info {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.storage-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.storage-used {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

.storage-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Основной контент */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.search-box {
    flex: 1;
    max-width: 720px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 24px;
    transition: all 0.2s;
}

.search-box:focus-within {
    background: var(--bg-primary);
    box-shadow: var(--shadow);
}

.search-box i {
    color: var(--text-secondary);
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    font-size: 16px;
    outline: none;
}

.btn-clear-search {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.btn-clear-search.visible {
    display: block;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--bg-hover);
}

.btn-icon.active {
    color: var(--primary);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    font-size: 14px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.breadcrumb-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.breadcrumb-item.current {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-secondary);
}

/* Контент */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
}

.content-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

.content-empty i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.content-empty p {
    font-size: 16px;
}

/* Секция */
.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Grid View */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.item-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.item-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.item-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.item-card-preview {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.item-card-preview i {
    font-size: 48px;
    color: var(--text-secondary);
}

.item-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-card-info {
    padding: 12px;
}

.item-card-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-card-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* List View */
.items-list {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.item-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.item-row:last-child {
    border-bottom: none;
}

.item-row:hover {
    background: var(--bg-hover);
}

.item-row.selected {
    background: var(--primary-light);
}

.item-row-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.item-row-icon i {
    font-size: 24px;
    color: var(--text-secondary);
}

.item-row-icon img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.item-row-info {
    flex: 1;
    min-width: 0;
}

.item-row-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-row-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 16px;
    margin-top: 2px;
}

.item-row-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.item-row:hover .item-row-actions {
    opacity: 1;
}

/* Цвета иконок */
.icon-folder { color: #5f6368 !important; }
.icon-image { color: #ea4335 !important; }
.icon-video { color: #ea4335 !important; }
.icon-audio { color: #fbbc04 !important; }
.icon-pdf { color: #ea4335 !important; }
.icon-doc { color: #4285f4 !important; }
.icon-sheet { color: #34a853 !important; }
.icon-archive { color: #fbbc04 !important; }
.icon-code { color: #673ab7 !important; }

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 500px;
    max-height: 80vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-close:hover {
    background: var(--bg-hover);
}

.modal-body {
    padding: 24px;
}

.modal-body input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.modal-body input:focus {
    border-color: var(--primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: none;
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-light);
}

/* Дерево папок */
.folder-tree {
    max-height: 300px;
    overflow-y: auto;
}

.folder-tree-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.folder-tree-item:hover {
    background: var(--bg-hover);
}

.folder-tree-item.selected {
    background: var(--primary-light);
}

.folder-tree-item i {
    color: var(--text-secondary);
}

.folder-tree-children {
    padding-left: 24px;
}

/* Preview Modal */
.modal-preview {
    background: rgba(0, 0, 0, 0.9);
}

.modal-preview .preview-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
    color: white;
    z-index: 10;
}

.modal-preview .preview-header h3 {
    font-size: 16px;
    font-weight: 500;
}

.modal-preview .preview-actions {
    display: flex;
    gap: 8px;
}

.modal-preview .preview-actions .btn-icon,
.modal-preview .preview-actions .btn-close {
    color: white;
}

.modal-preview .preview-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px 40px;
}

.modal-preview .preview-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-preview .preview-content video,
.modal-preview .preview-content audio {
    max-width: 100%;
    max-height: 100%;
}

.modal-preview .preview-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    border-radius: var(--radius);
}

.modal-preview .preview-content pre {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    font-size: 14px;
    white-space: pre-wrap;
}

.modal-preview .no-preview {
    color: white;
    text-align: center;
}

.modal-preview .no-preview i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Контекстное меню */
.context-menu {
    display: none;
    position: fixed;
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1001;
    overflow: hidden;
}

.context-menu.active {
    display: block;
}

.context-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.context-menu button:hover {
    background: var(--bg-hover);
}

.context-menu button.danger {
    color: var(--danger);
}

.context-menu button i {
    width: 16px;
    color: var(--text-secondary);
}

.context-menu button.danger i {
    color: var(--danger);
}

.context-menu .divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Уведомления */
.notifications {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    background: #323232;
    color: white;
    padding: 14px 24px;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Прогресс загрузки */
.upload-progress {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1002;
    overflow: hidden;
}

.upload-progress.active {
    display: block;
}

.upload-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--primary);
    color: white;
    font-weight: 500;
}

.upload-progress-content {
    max-height: 200px;
    overflow-y: auto;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.upload-item:last-child {
    border-bottom: none;
}

.upload-item-info {
    flex: 1;
    min-width: 0;
}

.upload-item-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-item-progress {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.upload-item-progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.upload-item-status {
    font-size: 20px;
}

.upload-item-status.success {
    color: var(--success);
}

.upload-item-status.error {
    color: var(--danger);
}

/* Drop zone */
.drop-zone {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 115, 232, 0.1);
    border: 3px dashed var(--primary);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.drop-zone.active {
    display: flex;
}

.drop-zone-content {
    text-align: center;
    color: var(--primary);
}

.drop-zone-content i {
    font-size: 64px;
    margin-bottom: 16px;
}

.drop-zone-content p {
    font-size: 20px;
    font-weight: 500;
}

/* Корзина */
.trash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.trash-header h2 {
    font-size: 18px;
    font-weight: 500;
}

.btn-empty-trash {
    padding: 8px 16px;
    background: none;
    border: 1px solid var(--danger);
    border-radius: 4px;
    color: var(--danger);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-empty-trash:hover {
    background: var(--danger);
    color: white;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -256px;
        top: 0;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .search-box {
        padding: 8px 12px;
    }
    
    .breadcrumbs {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    .content {
        padding: 0 16px 16px;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .item-card-preview {
        height: 100px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}