﻿/* -----------------------------
   Library subtype navigation
------------------------------ */

.library-subtype-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 25px 0;
    padding-bottom: 18px;
    border-bottom: 1px solid #ddd;
}

.library-subtype-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid #cfd8e3;
    background: #fff;
    color: #0066cc;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
    transition: all 0.15s ease;
}

    .library-subtype-link:hover {
        background: #f0f6ff;
        border-color: #80bfff;
        color: #004c99;
        text-decoration: none;
        transform: translateY(-1px);
    }

    .library-subtype-link.active {
        background: #0066cc;
        border-color: #0066cc;
        color: #fff;
        cursor: default;
        box-shadow: 0 2px 6px rgba(0, 102, 204, 0.25);
    }


/* -----------------------------
   Library table/search styling
------------------------------ */

.library-count {
    margin: 12px 0 16px 0;
    color: #555;
    font-size: 14px;
}

.library-search-panel {
    background: #fff;
    border: 1px solid #eeeeee;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 18px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

    .library-search-panel label {
        margin-right: 8px;
        font-weight: 600;
        color: #1f1b4d;
    }

    .library-search-panel input[type="text"] {
        min-width: 300px;
        max-width: 420px;
        display: inline-block;
        margin-right: 6px;
        border-radius: 6px;
    }

    .library-search-panel .btn {
        border-radius: 6px;
    }

    .library-search-panel a.btn,
    .library-search-panel a {
        margin-left: 4px;
    }

.library-install-note {
    background: #fff8d8;
    border-left: 4px solid #f0ad4e;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 18px;
}

    .library-install-note p {
        margin: 0 0 7px 0;
    }

        .library-install-note p:last-child {
            margin-bottom: 0;
        }

.library-table {
    background: #fff;
    border: 1px solid #eeeeee;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
}

    .library-table table {
        margin-bottom: 0;
        background: #fff;
    }

    .library-table thead th {
        background: #fff;
        border-bottom: 1px solid #e5e5e5;
        color: #1f1b4d;
        font-weight: 600;
        white-space: nowrap;
        padding: 10px 8px;
    }

    .library-table tbody tr {
        background: #fff;
        transition: background 0.12s ease-in-out;
    }

        .library-table tbody tr:hover {
            background: #f8f7ff;
        }

    .library-table tbody td {
        background: #fff;
        border-bottom: 1px solid #eeeeee;
        color: #555;
        vertical-align: middle !important;
        padding: 10px 8px;
    }

    .library-table tbody tr:hover td {
        background: #f8f7ff;
    }

    .library-table tbody tr:last-child td {
        border-bottom: none;
    }

.library-actions {
    white-space: nowrap;
}

    .library-actions form {
        display: inline-block;
        margin: 0;
    }

.library-stream-link {
    margin-left: 8px;
    font-size: 13px;
}

.library-subscribe-form {
    white-space: nowrap;
}

    .library-subscribe-form i {
        display: inline-block;
        margin-right: 8px;
        color: #5cb85c;
    }

.library-pagination {
    margin-top: 18px;
}

    .library-pagination .btn {
        min-width: 90px;
    }


/* -----------------------------
   Portal file cards
------------------------------ */

.portal-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 22px;
    margin-top: 25px;
}

.portal-file-card {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
    min-height: 230px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}

    .portal-file-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    }

.portal-file-card-header {
    padding: 18px 18px 5px 18px;
    text-align: center;
}

.portal-file-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #1f6fbf;
    color: #fff;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.portal-file-card-body {
    padding: 8px 18px 12px 18px;
    text-align: center;
    flex: 1;
}

.portal-file-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin: 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.portal-file-subtitle {
    font-size: 13px;
    color: #555;
    margin: 0 0 6px 0;
}

.portal-file-details {
    font-size: 12px;
    color: #777;
    margin: 0 0 6px 0;
}

.portal-file-date {
    font-size: 12px;
    color: #999;
    margin: 0;
}

.portal-file-actions {
    display: flex;
    gap: 8px;
    padding: 14px 16px 18px 16px;
    justify-content: center;
}

.portal-file-btn {
    border: none;
    border-radius: 4px;
    padding: 7px 13px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    min-width: 82px;
    text-align: center;
}

    .portal-file-btn:hover,
    .portal-file-btn:focus {
        text-decoration: none;
    }

.preview-btn {
    background: #f1f1f1;
    color: #333;
    border: 1px solid #ddd;
}

    .preview-btn:hover {
        background: #e3e3e3;
        color: #222;
    }

.download-btn {
    background: #1f6fbf;
    color: #fff;
}

    .download-btn:hover {
        background: #185a9d;
        color: #fff;
    }


/* -----------------------------
   Preview modal
------------------------------ */

.preview-modal-content {
    border-radius: 8px;
}

.preview-modal-body {
    height: 75vh;
    padding: 0;
}

.preview-loading {
    padding: 20px;
    text-align: center;
    font-weight: 600;
    color: #555;
}

#previewFrame {
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

#previewModal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#previewModal .modal-title {
    margin: 0;
    text-align: left;
}

#previewModal .btn-close {
    margin-left: auto;
}


/* -----------------------------
   Responsive
------------------------------ */

@media (max-width: 768px) {
    .portal-file-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 16px;
    }

    .portal-file-card {
        min-height: 220px;
    }

    .portal-file-actions {
        flex-direction: column;
    }

    .portal-file-btn {
        width: 100%;
    }
}

@media (max-width: 767px) {
    .library-search-panel input[type="text"] {
        width: 100%;
        max-width: none;
        min-width: 0;
        margin: 8px 0;
    }

    .library-search-panel .btn {
        margin-top: 6px;
    }

    .library-actions,
    .library-subscribe-form {
        white-space: normal;
    }
}

@media (max-width: 600px) {
    .library-subtype-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 8px;
        margin: 12px -15px 20px -15px;
        padding: 8px 15px 16px 15px;
        border-bottom: 1px solid #e5e5e5;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

        .library-subtype-nav::-webkit-scrollbar {
            display: none;
        }

    .library-subtype-link {
        flex: 0 0 auto;
        font-size: 14px;
        padding: 8px 14px;
        min-height: 36px;
    }
}

@media (max-width: 480px) {
    .portal-file-grid {
        grid-template-columns: 1fr;
    }
}
