/* Drive Module Styles v1.0 */

.drive-container {
    display: flex;
    height: 100%;
    min-height: 0;
    background: var(--bg, var(--bg-primary, #0a0a0f));
    color: var(--text, var(--text-primary, #ffffff));
}

/* Drive Sidebar */
.drive-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--surface, var(--bg-secondary, #12121a));
    border-right: 1px solid var(--border, #2a2a3a);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.drive-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.drive-nav {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.drive-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.drive-nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.drive-nav-item.active {
    background: var(--primary);
    color: white;
}

.drive-storage {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.storage-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 8px;
}

.storage-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
}

.storage-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.storage-detail {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Drive Main */
.drive-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Drive Header */
.drive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border, #2a2a3a);
    flex-shrink: 0;
}

/* Drive Content - File Grid */
.drive-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-list-header {
    display: grid;
    grid-template-columns: 1fr 150px 100px;
    gap: 16px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #6b6b80);
    border-bottom: 1px solid var(--border, #2a2a3a);
}

.file-list-item,
.drive-file-item {
    display: grid;
    grid-template-columns: 1fr 150px 100px;
    gap: 16px;
    padding: 12px 16px;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.file-list-item:hover,
.drive-file-item:hover {
    background: var(--surface-hover, rgba(255, 255, 255, 0.05));
}

.file-list-item.selected,
.drive-file-item.selected {
    background: var(--accent-light, rgba(59, 130, 246, 0.1));
}

.file-name {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: var(--text, var(--text-primary, #ffffff));
}

.file-icon {
    font-size: 20px;
}

.file-date,
.file-size {
    font-size: 13px;
    color: var(--text-secondary, #6b6b80);
}

.drive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.drive-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drive-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-item {
    color: var(--text-secondary);
    cursor: pointer;
}

.breadcrumb-item:hover {
    color: var(--primary);
}

.breadcrumb-item.current {
    color: var(--text);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--text-secondary);
}

/* File Grid */
.file-grid {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    align-content: start;
}

.file-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.file-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.file-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.file-icon.folder {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}
.file-icon.document {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}
.file-icon.image {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}
.file-icon.video {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
.file-icon.audio {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 4px;
}

/* File List View */
.file-list {
    flex: 1;
    overflow-y: auto;
}

.file-list-header {
    display: grid;
    grid-template-columns: 1fr 120px 100px 80px;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.file-list-header .file-col {
    display: flex;
    align-items: center;
}

.file-list-item,
.drive-file-item {
    display: grid;
    grid-template-columns: 1fr 120px 100px 80px;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    align-items: center;
}

.file-list-item:hover,
.drive-file-item:hover {
    background: var(--surface-hover);
}

.file-list-item.selected,
.drive-file-item.selected {
    background: var(--primary-light, rgba(99, 102, 241, 0.1));
}

.file-list-name,
.file-col.file-name-col {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    min-width: 0;
}

.file-list-name svg,
.file-col.file-name-col svg {
    flex-shrink: 0;
}

.file-col.file-name-col span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-col.file-modified-col,
.file-col.file-size-col {
    font-size: 13px;
    color: var(--text-secondary);
}

.file-col.file-actions-col {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone svg {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-zone h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.upload-zone p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Search Box */
.drive-toolbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 20px;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 8px 12px 8px 40px;
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 8px;
    background: var(--surface, #12121a);
    color: var(--text, #ffffff);
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
}

.search-box input::placeholder {
    color: var(--text-secondary, #6b6b80);
}

/* Selection Bar */
.selection-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: var(--surface, #12121a);
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.selection-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--text, #ffffff);
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, #6b6b80);
    cursor: pointer;
    transition: all 0.15s;
}

.action-btn:hover {
    background: var(--surface-hover, rgba(255, 255, 255, 0.1));
    color: var(--text, #ffffff);
}

.action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.close-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary, #6b6b80);
    cursor: pointer;
    margin-left: 8px;
}

.close-selection:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary, #6b6b80);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border, #2a2a3a);
    border-top-color: var(--primary, #3b82f6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary, #6b6b80);
}

.empty-state svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text, #ffffff);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

.empty-state .btn-primary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--primary, #3b82f6);
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.empty-state .btn-primary:hover {
    opacity: 0.9;
}

/* Drop Overlay */
.drop-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
}

.drop-overlay.visible {
    display: flex;
}

.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 60px;
    border: 3px dashed var(--primary, #3b82f6);
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--text, #ffffff);
}

.drop-zone svg {
    margin-bottom: 16px;
    color: var(--primary, #3b82f6);
}

.drop-zone p {
    font-size: 16px;
    font-weight: 500;
}

/* File Checkbox */
.file-checkbox {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    cursor: pointer;
    accent-color: var(--primary, #3b82f6);
}

/* Button Icon Small */
.btn-icon-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary, #6b6b80);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}

.btn-icon-sm:hover {
    background: var(--surface-hover, rgba(255, 255, 255, 0.1));
    color: var(--text, #ffffff);
}

/* Drive Container Position Relative for overlay */
.drive-container {
    position: relative;
}

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

/* Sidebar Actions */
.drive-sidebar-actions {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-primary-full,
.btn-secondary-full {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary-full {
    background: var(--primary, #3b82f6);
    color: white;
}

.btn-primary-full:hover {
    opacity: 0.9;
}

.btn-secondary-full {
    background: var(--surface-hover, rgba(255, 255, 255, 0.1));
    color: var(--text, #ffffff);
    border: 1px solid var(--border, #2a2a3a);
}

.btn-secondary-full:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* File Card Info */
.file-card-info {
    text-align: center;
}

.file-card-meta {
    font-size: 11px;
    color: var(--text-secondary, #6b6b80);
    margin-top: 4px;
    color: var(--text-secondary);
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.2),
        0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1000;
    padding: 6px;
    backdrop-filter: blur(12px);
    animation: contextMenuIn 0.15s ease-out;
    transform-origin: top left;
}

@keyframes contextMenuIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.context-menu.hidden {
    display: none !important;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 8px;
    color: var(--text);
}

.context-menu-item svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition:
        opacity 0.15s ease,
        transform 0.15s ease;
}

.context-menu-item:hover {
    background: linear-gradient(
        135deg,
        var(--primary-light, rgba(99, 102, 241, 0.1)) 0%,
        var(--surface-hover, rgba(99, 102, 241, 0.05)) 100%
    );
    color: var(--primary, #6366f1);
}

.context-menu-item:hover svg {
    opacity: 1;
    transform: scale(1.1);
    stroke: var(--primary, #6366f1);
}

.context-menu-item:active {
    transform: scale(0.98);
}

.context-menu-item.danger {
    color: var(--error, #ef4444);
}

.context-menu-item.danger svg {
    stroke: var(--error, #ef4444);
}

.context-menu-item.danger:hover {
    background: linear-gradient(
        135deg,
        rgba(239, 68, 68, 0.15) 0%,
        rgba(239, 68, 68, 0.05) 100%
    );
    color: var(--error, #ef4444);
}

.context-menu-item.danger:hover svg {
    stroke: var(--error, #ef4444);
}

.context-menu-divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--border) 20%,
        var(--border) 80%,
        transparent 100%
    );
    margin: 6px 8px;
}

/* Inline Editor Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: var(--surface, #12121a);
    border-radius: 12px;
    border: 1px solid var(--border, #2a2a3a);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.editor-modal-content {
    width: 90vw;
    height: 85vh;
    max-width: 1200px;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border, #2a2a3a);
    background: var(--bg-secondary, #0d0d12);
    border-radius: 12px 12px 0 0;
}

.editor-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.editor-icon {
    font-size: 18px;
}

.editor-filename {
    color: var(--text, #ffffff);
}

.editor-status {
    color: var(--warning, #f59e0b);
    font-size: 12px;
    margin-left: 8px;
}

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

.editor-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.editor-textarea {
    flex: 1;
    width: 100%;
    height: 100%;
    padding: 16px;
    border: none;
    background: var(--bg, #0a0a0f);
    color: var(--text, #ffffff);
    font-family: "JetBrains Mono", "Fira Code", "Monaco", "Consolas", monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    tab-size: 2;
}

.editor-textarea:focus {
    outline: none;
}

.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid var(--border, #2a2a3a);
    background: var(--bg-secondary, #0d0d12);
    border-radius: 0 0 12px 12px;
    font-size: 12px;
    color: var(--text-secondary, #6b6b80);
}

.editor-info {
    display: flex;
    gap: 16px;
}

/* Button styles for editor */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary, #3b82f6);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: var(--primary-hover, #2563eb);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary, #6b6b80);
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-secondary:hover {
    background: var(--surface-hover, #1a1a24);
    color: var(--text, #ffffff);
}

/* Responsive */
@media (max-width: 768px) {
    .drive-sidebar {
        display: none;
    }

    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 12px;
        gap: 12px;
    }

    .editor-modal-content {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .editor-header,
    .editor-footer {
        border-radius: 0;
    }
}
