﻿/* attachments.css */

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    background: #fff;
    transition: box-shadow .15s ease, transform .15s ease;
}

    .attachment-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,.06);
        transform: translateY(-1px);
    }

.attachment-icon {
    font-size: 20px;
    color: #0dcaf0;
    width: 28px;
    text-align: center;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 0.75rem;
    color: #6c757d;
}

.attachment-actions {
    display: flex;
    gap: 6px;
}

.btn-icon {
    padding: 4px 6px;
    line-height: 1;
}

    .btn-icon i {
        font-size: 14px;
    }

.modal-open {
    overflow: hidden;
}

/* ---------------------------------------------------------------------------
   Stacked attachment card (details on top, 3 equal action buttons below).
   Used by "Saved files" in EditInvoice.razor. Buttons connect flush to each
   other and to the card edges to read as one physical control, with a single
   divider line separating details from actions.
   ------------------------------------------------------------------------ */

.attachment-card--stacked {
    display: block;
    padding: 0;
    overflow: hidden;
}

.attachment-card--stacked .attachment-details {
    padding: 10px 12px;
    border-bottom: 1px solid #ececec;
    min-width: 0;
}

.attachment-card--stacked .attachment-name {
    /* override — already ellipses from parent, just ensure consistent size */
    font-size: 0.9rem;
}

.attachment-action-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.attachment-btn {
    border: 0;
    border-left: 1px solid #ececec;
    background: #fafbfc;
    padding: 8px 6px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

    .attachment-btn:first-child {
        border-left: 0;
    }

    .attachment-btn:hover:not(:disabled) {
        background: #eef3ff;
    }

    .attachment-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.attachment-btn--view {
    color: #0d6efd;
}

    .attachment-btn--view:hover:not(:disabled) {
        background: #e7f1ff;
        color: #0a58ca;
    }

.attachment-btn--download {
    color: #198754;
}

    .attachment-btn--download:hover:not(:disabled) {
        background: #e8f5ee;
        color: #146c43;
    }

.attachment-btn--delete {
    color: #dc3545;
}

    .attachment-btn--delete:hover:not(:disabled) {
        background: #fdecee;
        color: #b02a37;
    }

/* ---------------------------------------------------------------------------
   In-app attachment viewer modal (PDF in iframe, images in <img>).
   ------------------------------------------------------------------------ */

.attachment-viewer-backdrop {
    background: rgba(0, 0, 0, 0.55);
}

.attachment-viewer-content {
    height: 85vh;
}

.attachment-viewer-body {
    flex: 1 1 auto;
    overflow: hidden;
    background: #222;
    display: flex;
    flex-direction: column;
}

.attachment-viewer-iframe {
    border: 0;
    width: 100%;
    height: 100%;
    background: #fff;
}

.attachment-viewer-image-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 12px;
}

.attachment-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #fff;
}

/* PDF.js-backed inline viewer. Scrolls vertically through rendered pages
   rendered as <canvas> elements inside .attachment-viewer-pdf-host. */
.attachment-viewer-pdf-host {
    flex: 1 1 auto;
    overflow: auto;
    background: #2b2b2b;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.attachment-viewer-pdf-host .pdf-viewer-page {
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    max-width: 100%;
    height: auto;
}

.attachment-viewer-pdf-host .pdf-viewer-status {
    color: #ddd;
    padding: 24px;
    font-size: 0.9rem;
}

.attachment-viewer-pdf-host .pdf-viewer-error a {
    color: #8ab4ff;
}
