/* Memory Page Tabs */
.memory-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    padding-bottom: 1px;
}

.memory-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary, #666);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.memory-tab:hover {
    color: var(--primary-color, #667eea);
    background: var(--hover-bg, rgba(102, 126, 234, 0.05));
}

.memory-tab.active {
    color: var(--primary-color, #667eea);
    border-bottom-color: var(--primary-color, #667eea);
    background: var(--active-bg, rgba(102, 126, 234, 0.1));
}

.memory-tab svg {
    flex-shrink: 0;
}

/* Memory Tab Content */
.memory-tab-content {
    display: none;
}

.memory-tab-content.active {
    display: block;
}

/* Files Upload Zone */
.files-upload-zone {
    border: 2px dashed var(--border-color, #ccc);
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 24px;
}

.files-upload-zone:hover {
    border-color: var(--primary-color, #667eea);
    background: var(--hover-bg, rgba(102, 126, 234, 0.05));
}

.files-upload-zone.drag-over {
    border-color: var(--primary-color, #667eea);
    background: var(--active-bg, rgba(102, 126, 234, 0.1));
}

.files-upload-content svg {
    margin-bottom: 16px;
    color: var(--text-secondary, #999);
}

.files-upload-content p {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--text-primary, #333);
}

.files-upload-content .upload-link {
    color: var(--primary-color, #667eea);
    text-decoration: underline;
}

.files-upload-content .upload-hint {
    font-size: 12px;
    color: var(--text-secondary, #999);
}

/* Files List */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.files-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary, #666);
}

.files-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary, #999);
}

.files-empty svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.files-empty p {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--text-primary, #333);
}

.files-empty span {
    font-size: 14px;
}

/* File Item */
.file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.file-item:hover {
    border-color: var(--primary-color, #667eea);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.file-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 8px;
}

.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary, #666);
}

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

.file-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-actions button:hover {
    background: var(--bg-secondary, #f5f5f5);
}

.file-download-btn:hover {
    color: var(--primary-color, #667eea);
}

.file-delete-btn:hover {
    color: var(--error-color, #f44336);
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .files-upload-zone {
        background: var(--bg-secondary, #2a2a2a);
    }
    
    .file-item {
        background: var(--bg-primary, #1a1a1a);
    }
    
    .file-icon {
        background: var(--bg-secondary, #2a2a2a);
    }
}

/* File Preview (Image thumbnails) */
.file-preview {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary, #f5f5f5);
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (prefers-color-scheme: dark) {
    .file-preview {
        background: var(--bg-secondary, #2a2a2a);
    }
}

/* Video preview in file list */
.file-preview--video {
    position: relative;
}

.file-preview--video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.file-preview-play svg {
    margin-left: 2px;
    width: 12px;
    height: 12px;
}

/* Lightbox */
.file-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-lightbox.active {
    opacity: 1;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.88);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 10;
    background: none;
    border: none;
    color: white;
    font-size: 36px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lightbox-content {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90vw;
    max-height: 85vh;
}

.lightbox-media {
    max-width: 90vw;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}

video.lightbox-media {
    background: #000;
}

.lightbox-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}

.lightbox-name {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-counter {
    opacity: 0.6;
    white-space: nowrap;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Document viewer (PDF / Word) */
.lightbox-doc-content {
    width: 80vw;
    max-width: 960px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.lightbox-pdf-frame {
    flex: 1;
    width: 100%;
    border: none;
    border-radius: 8px;
    background: #fff;
}
.lightbox-doc-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex: 1;
    color: #e2e8f0;
}
.lightbox-doc-icon { font-size: 64px; line-height: 1; }
.lightbox-doc-name {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    word-break: break-word;
    max-width: 400px;
}
.lightbox-doc-dl {
    padding: 10px 28px;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.lightbox-doc-dl:hover { background: rgba(255,255,255,0.2); }

/* Modal Styles */
.file-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
}

.file-modal.active {
    display: block;
}

.file-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.file-modal-content {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 100%;
    animation: slideUp 0.2s ease;
}

.file-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.file-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.file-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.file-modal-close:hover {
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-primary, #333);
}

.file-modal-body {
    padding: 20px;
}

.file-modal-body p {
    margin: 0 0 8px;
    color: var(--text-primary, #333);
    line-height: 1.5;
}

.file-modal-hint {
    font-size: 13px;
    color: var(--text-secondary, #666) !important;
}

.file-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

/* Modal Buttons */
.file-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-btn-secondary {
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-primary, #333);
}

.file-btn-secondary:hover {
    background: var(--border-color, #e0e0e0);
}

.file-btn-danger {
    background: var(--error-color, #f44336);
    color: white;
}

.file-btn-danger:hover {
    background: #d32f2f;
}

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

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

/* Dark theme for modal */
@media (prefers-color-scheme: dark) {
    .file-modal-content {
        background: var(--bg-primary, #1a1a1a);
    }
    
    .file-modal-header,
    .file-modal-footer {
        border-color: var(--border-color, #333);
    }
    
    .file-modal-close:hover {
        background: var(--bg-secondary, #2a2a2a);
    }
    
    .file-btn-secondary {
        background: var(--bg-secondary, #2a2a2a);
        color: var(--text-primary, #eee);
    }
    
    .file-btn-secondary:hover {
        background: var(--border-color, #333);
    }
}
