/* ==========================================================
   Slider Documents – public document listing page + preview modal
   ========================================================== */

/* --- Page header --- */
.sd-page-header {
    background: linear-gradient(135deg, #1a5632 0%, #2d8a4e 100%);
    padding: 40px 0;
    margin-bottom: 30px;
    color: #fff;
}
.sd-page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
}
.sd-page-header .sd-doc-count {
    font-size: 16px;
    opacity: .85;
}
.sd-page-header .sd-description {
    font-size: 14px;
    opacity: .75;
    margin-top: 6px;
}

/* --- Document cards --- */
.sd-documents-section {
    padding-bottom: 60px;
}
.sd-card {
    background: #fff;
    border: 1px solid #e3e6ef;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    transition: box-shadow .2s ease, transform .15s ease;
    display: flex;
    align-items: center;
    gap: 16px;
}
.sd-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    transform: translateY(-2px);
}
.sd-card__icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}
.sd-card__icon--xlsx { background: #1d6f42; }
.sd-card__icon--xls  { background: #1d6f42; }
.sd-card__icon--pdf  { background: #d32f2f; }
.sd-card__icon--docx { background: #2b579a; }
.sd-card__icon--doc  { background: #2b579a; }
.sd-card__icon--default { background: #607d8b; }

.sd-card__info {
    flex: 1;
    min-width: 0;
}
.sd-card__name {
    font-size: 15px;
    font-weight: 600;
    color: #2b2f36;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-card__meta {
    font-size: 13px;
    color: #6c757d;
}
.sd-card__meta span + span::before {
    content: '·';
    margin: 0 6px;
}
.sd-card__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.sd-card__actions .btn {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
}
.sd-btn-preview {
    background: #f0f4f8;
    color: #2b579a;
    border: 1px solid #d0d5dd;
}
.sd-btn-preview:hover {
    background: #e2e8f0;
    color: #1a3d6e;
}
.sd-btn-download {
    background: #1a5632;
    color: #fff;
    border: 1px solid #1a5632;
}
.sd-btn-download:hover {
    background: #145228;
    color: #fff;
}

/* --- Empty state --- */
.sd-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}
.sd-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ced4da;
}

/* --- Preview modal --- */
.sd-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}
.sd-modal-backdrop.active {
    display: flex;
}
.sd-modal {
    background: #fff;
    border-radius: 12px;
    width: 95vw;
    max-width: 1100px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    transition: width 0.3s, max-width 0.3s, height 0.3s, max-height 0.3s, border-radius 0.3s;
}
.sd-modal.sd-modal--fullscreen {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
}
.sd-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e3e6ef;
    background: #f8f9fa;
}
.sd-modal__header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-modal__close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .15s;
}
.sd-modal__close:hover {
    background: #e9ecef;
    color: #333;
}
.sd-modal__body {
    flex: 1;
    overflow: auto;
    padding: 24px;
}
.sd-modal__loading {
    text-align: center;
    padding: 60px;
    color: #6c757d;
}
.sd-modal__loading i {
    font-size: 32px;
    animation: sd-spin 1s linear infinite;
}
@keyframes sd-spin {
    to { transform: rotate(360deg); }
}

/* Excel table inside modal */
.sd-modal__body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    color: #212529 !important;
    background-color: #ffffff !important;
}
.sd-modal__body table th,
.sd-modal__body table td {
    border: 1px solid #dee2e6 !important;
    padding: 6px 10px;
    text-align: left;
    white-space: nowrap;
    color: #212529 !important;
}
.sd-modal__body table th {
    background: #e9ecef !important;
    color: #212529 !important;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}
.sd-modal__body table tr:nth-child(even) td {
    background: #f8f9fa !important;
}
.sd-modal__body table tr:nth-child(odd) td {
    background: #ffffff !important;
}
.sd-modal__body .sd-sheet-tab {
    display: inline-block;
    padding: 6px 14px;
    margin: 0 4px 12px 0;
    border-radius: 6px;
    background: #e9ecef;
    color: #495057;
    font-size: 13px;
    cursor: pointer;
    border: none;
}
.sd-modal__body .sd-sheet-tab.active {
    background: #1a5632;
    color: #fff;
}

/* PDF preview inside modal */
.sd-modal__body iframe {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: 6px;
}
.sd-modal--fullscreen .sd-modal__body iframe {
    height: calc(100vh - 120px);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sd-page-header {
        padding: 24px 0;
    }
    .sd-page-header h1 {
        font-size: 22px;
    }
    .sd-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .sd-card__actions {
        width: 100%;
    }
    .sd-card__actions .btn {
        flex: 1;
        text-align: center;
    }
    .sd-modal {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .sd-modal__body {
        padding: 12px;
    }
    .sd-modal__body table {
        font-size: 11px;
    }
    .sd-modal__body table th,
    .sd-modal__body table td {
        padding: 4px 6px;
    }
}

@media (max-width: 480px) {
    .sd-card__name {
        font-size: 14px;
    }
    .sd-card__actions .btn {
        font-size: 12px;
        padding: 5px 10px;
    }
}
