/* Team Documents Header */
.documents-team-header {
    padding: 0;
    padding-bottom: 12px; /* Match My Documents padding-bottom */
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
    border-bottom: 1.8px solid #ddd; /* Match My Documents border */
    background: #ffffff; /* Changed from #FAFAFC to white to match My Documents */
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px; /* Match My Documents margin-bottom */
    margin-top: 15px; /* Match My Documents top spacing from #task-details padding-top */
    min-height: 55px; /* Match My Documents height */
    box-sizing: border-box; /* Include border in height calculation */
}

.documents-team-header-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.view-title {
    font-size: 24px;
    font-weight: 500;
    color: #202124;
    margin: 0;
    font-family: 'Google Sans', 'Roboto', sans-serif;
}

/* Override for team documents header to match My Documents */
.documents-team-header .view-title {
    font-size: 24px !important; /* Match My Documents */
    color: #333 !important; /* Match My Documents */
    padding-left: 15px; /* Match My Documents */
    font-weight: normal !important; /* Match My Documents */
    line-height: 1.2; /* Match My Documents */
}

/* For personal documents in task-header, override to match standard h2 styling */
#task-header h2.view-title {
    font-size: 24px !important;
    color: #333 !important;
    padding-left: 15px;
    font-weight: normal !important;
    font-family: 'Google Sans', 'Roboto', sans-serif; /* Match .view-title */
}

/* Keep documents-team-title for backward compatibility */
.documents-team-title {
    font-size: 1.3em !important; /* Match My Documents */
    font-weight: normal !important; /* Match My Documents */
    color: #333 !important; /* Match My Documents */
    margin: 0;
    padding-left: 15px; /* Match My Documents */
    line-height: 1.2; /* Match My Documents */
    font-family: 'Google Sans', 'Roboto', sans-serif;
}

.documents-team-subtitle {
    font-size: 0.85rem !important; /* Match My Documents chat-info */
    color: #666 !important; /* Match My Documents chat-info */
    margin: 0;
    padding-left: 15px; /* Match My Documents chat-info */
    margin-top: 0px; /* Match My Documents chat-info when has toolbar */
}

.documents-header-path {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    line-height: 1.2; /* Match standard h2 line-height for consistent spacing */
}

/* Prevent breadcrumb wrapping in task-header to maintain fixed header height */
#task-header .documents-header-path {
    flex-wrap: nowrap; /* Prevent wrapping to keep header height fixed */
    overflow: hidden; /* Hide overflow if breadcrumb is too long */
    max-width: 100%; /* Constrain to header width */
    height: 100%; /* Take full height of h2 */
    max-height: 100%; /* Don't exceed h2 height */
}

/* Ensure documents header path inside h2 doesn't affect spacing with chat-info */
/* Prevent h2 from growing vertically but allow content to show */
#task-header h2.view-title.documents-header-path {
    margin-bottom: 0;
    line-height: 1.2; /* Match standard h2 line-height */
    max-height: 1.56em; /* Constrain to single line (1.3em font-size * 1.2 line-height) */
    flex-shrink: 0; /* Don't shrink */
    overflow: hidden; /* Only hide overflow from breadcrumb, not content below */
}

/* Adjust spacing between documents title and chat-info to match My Tasks */
/* The flex container in h2 makes the spacing tighter, so we adjust chat-info margin */
#task-header:has(.documents-toolbar) .chat-info {
    margin-top: 0px; /* Neutral margin to create more space (default is -5px) */
}

.documents-header-path .header-path-segment {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

/* For task-header (personal documents), use the standard color and font size */
#task-header .view-title.documents-header-path .header-path-segment {
    color: #333;
    font-size: inherit; /* Inherit from parent h2 instead of compounding em */
    font-weight: normal; /* Match standard h2 font-weight */
}

/* For team documents, match My Documents styling */
.documents-team-header .view-title.documents-header-path .header-path-segment {
    font-size: inherit; /* Inherit from parent h2 instead of compounding */
    font-weight: normal; /* Match My Documents */
    color: #333; /* Match My Documents */
}

.documents-header-path .header-path-segment.clickable {
    color: #4285f4;
    cursor: pointer;
}

.documents-header-path .header-path-separator {
    color: #a0aec0;
    font-size: inherit;
}

/* For team documents, match My Documents separator styling */
.documents-team-header .view-title.documents-header-path .header-path-separator {
    font-size: 1.3em; /* Match My Documents */
    color: #a0aec0;
}

/* For personal documents, separator should match title size */
#task-header .view-title.documents-header-path .header-path-separator {
    font-size: 1.3em;
    color: #a0aec0;
}

/**
 * Documents Tab Styles
 * Modern Google Drive/SharePoint style interface
 */

/* Documents Container */
.documents-container {
    background: #ffffff;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.documents-container.drag-active {
    box-shadow: inset 0 0 0 2px rgba(66, 133, 244, 0.25);
}

.documents-drop-overlay {
    position: absolute;
    inset: 0;
    border: 2px dashed #4285f4;
    border-radius: 16px;
    background: rgba(66, 133, 244, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: scale(0.98);
    z-index: 5;
}

.documents-drop-overlay.visible {
    opacity: 1;
    transform: scale(1);
}

.documents-drop-overlay .drop-overlay-content {
    text-align: center;
    color: #1a73e8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.documents-drop-overlay i {
    width: 48px;
    height: 48px;
}

.documents-drop-overlay h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a73e8;
}

.documents-drop-overlay p {
    margin: 0;
    font-size: 14px;
    color: #1a73e8;
    opacity: 0.8;
}

/* Documents Header */
.documents-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 100px 40px;
    gap: 16px;
    padding: 12px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e8eaed;
    font-size: 12px;
    font-weight: 600;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-items: center;
}

.header-column {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-icon {
    width: 14px;
    height: 14px;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.sort-icon:hover {
    opacity: 1;
}

/* Documents List */
.documents-list {
    flex: 1;
    background: #ffffff;
}

/* Document List Item */
.document-list-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 100px 40px;
    gap: 16px;
    padding: 8px 24px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
    align-items: center;
    min-height: 56px;
}

.document-list-item:hover {
    background-color: #f8f9fa;
}

.document-list-item.hovered {
    background-color: #f8f9fa;
}

/* List Columns */
.list-column {
    display: flex;
    align-items: center;
}

/* Name Column */
.name-container {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0; /* Allow text truncation */
}

.file-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.file-icon,
.folder-icon {
    width: 24px;
    height: 24px;
}

.name-text {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.document-name {
    font-size: 14px;
    color: #202124;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

/* Inline rename input */
.document-name-input {
    font-size: 14px;
    color: #202124;
    font-weight: 400;
    border: 2px solid #1a73e8;
    border-radius: 4px;
    padding: 4px 8px;
    background: #ffffff;
    outline: none;
    min-width: 200px;
    max-width: 100%;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    line-height: 1.4;
    margin: 0;
    box-sizing: border-box;
}

.document-name-input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.document-name-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ensure name-text container can accommodate input */
.name-text .document-name-input {
    flex: 0 1 auto;
}

.sharing-indicator {
    width: 16px;
    height: 16px;
    color: #5f6368;
    flex-shrink: 0;
}

/* Owner Column */
.owner-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.owner-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4285f4;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

.owner-name {
    font-size: 14px;
    color: #202124;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modified Column */
.modified-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modified-date {
    font-size: 14px;
    color: #202124;
    white-space: nowrap;
}

.modified-by {
    font-size: 12px;
    color: #5f6368;
    white-space: nowrap;
}

/* Size Column */
.file-size {
    font-size: 14px;
    color: #5f6368;
    text-align: right;
}

/* Actions Column */
.document-actions-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    color: #5f6368;
}

.document-list-item:hover .document-actions-btn {
    opacity: 1;
}

.document-actions-btn:hover {
    background-color: #f1f3f4;
}

.document-actions-btn i {
    width: 16px;
    height: 16px;
}

/* Context Menu */
.document-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 180px;
    overflow: hidden;
}

.context-menu-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #202124;
    transition: background-color 0.2s ease;
    gap: 12px;
}

.context-menu-item:hover {
    background-color: #f8f9fa;
}

.context-menu-item.destructive {
    color: #d93025;
}

.context-menu-item.destructive:hover {
    background-color: #fef7e0;
}

.context-menu-item i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Loading States */
.documents-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #5f6368;
    text-align: center;
    flex: 1;
}

.documents-loading-state .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8eaed;
    border-top: 3px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.documents-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #d93025;
    text-align: center;
    flex: 1;
}

/* Empty State */
.documents-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #5f6368;
    text-align: center;
    flex: 1;
}

.empty-state-content {
    max-width: 400px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    opacity: 0.3;
}

.empty-title {
    font-size: 20px;
    font-weight: 400;
    margin: 0 0 8px 0;
    color: #202124;
}

.empty-description {
    font-size: 14px;
    margin: 0;
    opacity: 0.8;
    line-height: 1.5;
}

/* Documents Toolbar - now inside header */
.documents-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    margin-right: 15px;
    flex-shrink: 0;
}

/* Set task-header to accommodate both title and subtitle lines */
/* Breadcrumb constraints prevent growth, so we just need enough height for content */
#task-header:has(.documents-toolbar) {
    padding-bottom: 12px; /* Increase from 10px to 12px (adds 2px to match 55px total) */
    min-height: 55px; /* Match My Tasks/My Board height */
    /* No max-height - breadcrumb wrapping prevention keeps it from growing */
    align-items: flex-start; /* Align to top to show both lines properly */
    box-sizing: border-box; /* Include border in height calculation */
    background-color: #ffffff; /* Add white background to prevent grey from showing below border */
}

/* Make task-content white when it contains documents to cover the margin gap */
/* Pull it up to start right after the border, covering the margin area */
#task-content:has(.documents-container) {
    background-color: #ffffff;
    margin-top: -18.2px; /* Pull up to cover margin (20px) minus border (1.8px) = 18.2px */
    padding-top: 18.2px; /* Compensate for the negative margin */
}

/* Allow header-info container to show full content including chat-info */
#task-header:has(.documents-toolbar) .header-info {
    overflow: visible; /* Allow chat-info to be fully visible */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Documents Action Toolbar (moved to main content) - hide this since we use toolbar in header */
.documents-action-toolbar {
    display: none; /* Hide - toolbar is now in header */
}

.documents-upload-btn,
.documents-folder-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    font-weight: 500;
    gap: 8px;
    height: 32px;
    box-sizing: border-box;
}

.documents-upload-btn {
    background: #4285f4;
    color: white;
}

.documents-upload-btn:hover {
    background: #3367d6;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
}

.documents-back-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #34a853;
    color: white;
    transition: all 0.2s ease;
    font-weight: 500;
    height: 32px;
    box-sizing: border-box;
}

.documents-back-btn:hover:enabled {
    background: #2d8e47;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
}

.documents-back-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    box-shadow: none;
}

.documents-folder-btn {
    background: #34a853;
    color: white;
}

.documents-folder-btn:hover {
    background: #2d8e47;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .documents-header {
        padding: 12px 16px;
        grid-template-columns: 1fr 0.8fr 0.8fr 60px 32px;
        gap: 12px;
        font-size: 11px;
    }
    
    .document-list-item {
        padding: 8px 16px;
        grid-template-columns: 1fr 0.8fr 0.8fr 60px 32px;
        gap: 12px;
    }
    
    .documents-breadcrumb {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .name-container {
        gap: 12px;
    }
    
    .file-icon-container {
        width: 32px;
        height: 32px;
    }
    
    .file-icon,
    .folder-icon {
        width: 20px;
        height: 20px;
    }
    
    .document-name {
        font-size: 13px;
    }
    
    .owner-avatar {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .owner-name,
    .modified-date,
    .file-size {
        font-size: 12px;
    }
    
    .modified-by {
        font-size: 11px;
    }
    
    .documents-toolbar {
        flex-direction: column;
        gap: 8px;
        margin-left: 0;
        margin-top: 12px;
    }
    
    .documents-upload-btn,
    .documents-folder-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .documents-header {
        display: none; /* Hide header on very small screens */
    }
    
    .document-list-item {
        grid-template-columns: 1fr 32px;
        gap: 8px;
    }
    
    .owner-column,
    .modified-column,
    .size-column {
        display: none; /* Hide extra columns on mobile */
    }
    
    .actions-column {
        justify-self: end;
    }
}

/* Upload Progress Bar */
.document-upload-progress {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 16px;
    min-width: 320px;
    max-width: 400px;
    z-index: 10000;
    transition: all 0.3s ease;
    border: 1px solid #e8eaed;
}

.upload-progress-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.upload-progress-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #4285f4;
    border-radius: 8px;
    flex-shrink: 0;
}

.upload-progress-icon .upload-icon {
    width: 20px;
    height: 20px;
    color: white;
}

.upload-progress-info {
    flex: 1;
    min-width: 0;
}

.upload-file-name {
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-progress-status {
    font-size: 12px;
    color: #5f6368;
    margin-bottom: 8px;
}

.upload-progress-bar-container {
    width: 100%;
}

.upload-progress-bar {
    width: 100%;
    height: 4px;
    background: #e8eaed;
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4285f4, #34a853);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.upload-progress-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5f6368;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.upload-progress-close:hover {
    color: #202124;
}

.upload-progress-close i {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .document-upload-progress {
        bottom: 16px;
        right: 16px;
        left: 16px;
        min-width: auto;
        max-width: none;
    }
}