/* Documents Grid */
#docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.doc-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.doc-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

/* Preview Area */
.doc-preview {
    height: 180px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.doc-preview canvas {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.doc-preview .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Document Info */
.doc-info {
    padding: 15px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    /* Verification: this centers vertically */
    justify-content: flex-start;
    /* Verification: this aligns left */
    background: linear-gradient(to bottom, transparent, rgba(6, 182, 212, 0.05));
    min-height: 60px;
    /* Ensure consistent height */
}

.doc-icon {
    color: var(--color-primary);
    flex-shrink: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-meta {
    flex: 1;
    min-width: 0;
    /* Text truncation fix */
}

.doc-meta h3 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    color: var(--color-text);
    /* Multi-line truncation */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    /* Standard property */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.4;
    word-break: break-word;
    transition: max-height 0.3s ease;
}

/* Show full name on hover */
.doc-card:hover .doc-meta h3 {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

.doc-meta p {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

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

.preview-error,
.no-preview {
    color: var(--color-text-muted);
    font-size: 12px;
}

.fallback-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
}

/* LIST VIEW STYLES */
.docs-list-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
}

.doc-list-header,
.doc-list-item {
    display: grid;
    grid-template-columns: 50px 1fr 150px 100px;
    align-items: center;
    padding: 10px 15px;
    gap: 10px;
}

.doc-list-header {
    color: var(--color-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.doc-list-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.doc-list-item:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--color-primary);
    transform: translateX(5px);
}

.doc-list-item .col-name {
    color: var(--color-text);
    font-weight: 500;
}

.doc-list-item .col-date,
.doc-list-item .col-size {
    color: var(--color-text-muted);
    font-size: 13px;
}

.download-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.doc-list-item:hover .download-btn {
    color: var(--color-primary);
}