/**
 * PeepSo Digital Library - Frontend Styles
 */

/* =====================
   Upload Button
   ===================== */
.pdl-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: #185FA5;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.pdl-upload-btn:hover {
    background: #0C447C;
}

/* =====================
   Upload Modal Overlay
   ===================== */
.pdl-upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pdl-upload-modal {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    animation: pdlSlideUp 0.25s ease-out;
}

@keyframes pdlSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================
   Upload Header
   ===================== */
.pdl-upload-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.pdl-upload-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #E6F1FB;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #185FA5;
    flex-shrink: 0;
}

.pdl-upload-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
}

.pdl-upload-subtitle {
    font-size: 13px;
    color: #666;
    margin: 2px 0 0;
}

.pdl-upload-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.pdl-upload-close:hover {
    color: #333;
}

/* =====================
   Form Elements
   ===================== */
.pdl-form-group {
    margin-bottom: 16px;
}

.pdl-form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pdl-form-half {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.pdl-custom-fields-row {
    flex-wrap: wrap;
}

.pdl-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

.pdl-required {
    color: #d63638;
}

.pdl-input,
.pdl-textarea,
.pdl-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.pdl-input:focus,
.pdl-textarea:focus,
.pdl-select:focus {
    border-color: #185FA5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.1);
}

.pdl-textarea {
    resize: vertical;
}

.pdl-select {
    appearance: auto;
}

/* =====================
   Drag & Drop Zone
   ===================== */
.pdl-dropzone {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 32px 20px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    margin-bottom: 20px;
}

.pdl-dropzone:hover,
.pdl-dropzone.pdl-dragover {
    border-color: #185FA5;
    background: #f0f6fc;
}

.pdl-dropzone-icon {
    color: #999;
    margin-bottom: 8px;
}

.pdl-dropzone-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin: 0 0 4px;
}

.pdl-dropzone-subtext {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.pdl-dropzone-browse {
    color: #185FA5;
    text-decoration: underline;
    cursor: pointer;
}

.pdl-dropzone-info {
    font-size: 12px;
    color: #999;
    margin: 8px 0 0;
}

/* =====================
   File Preview
   ===================== */
.pdl-file-preview {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.pdl-file-preview-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.pdl-file-preview-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdl-file-preview-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdl-file-icon {
    color: #185FA5;
    flex-shrink: 0;
}

.pdl-file-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    word-break: break-all;
}

.pdl-file-size {
    font-size: 12px;
    color: #999;
}

.pdl-file-status {
    font-size: 12px;
    font-weight: 500;
    color: #1D9E75;
}

.pdl-file-status.pdl-uploading {
    color: #185FA5;
}

.pdl-file-status.pdl-error {
    color: #d63638;
}

.pdl-file-remove {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.pdl-file-remove:hover {
    color: #d63638;
}

/* Progress bar */
.pdl-progress-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.pdl-progress-fill {
    height: 100%;
    width: 0%;
    background: #1D9E75;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.pdl-progress-fill.pdl-uploading {
    background: #185FA5;
}

/* =====================
   Messages
   ===================== */
.pdl-upload-error {
    background: #fce8e8;
    color: #d63638;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.pdl-upload-success {
    background: #e1f5ee;
    color: #0F6E56;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* =====================
   Form Actions
   ===================== */
.pdl-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.pdl-btn {
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    transition: all 0.2s;
    font-family: inherit;
}

.pdl-btn:hover {
    background: #f5f5f5;
}

.pdl-btn-primary {
    background: #185FA5;
    color: #fff;
    border-color: #185FA5;
}

.pdl-btn-primary:hover {
    background: #0C447C;
}

.pdl-btn-primary:disabled {
    background: #a0c4e8;
    border-color: #a0c4e8;
    cursor: not-allowed;
}

/* =====================
   Responsive
   ===================== */
@media screen and (max-width: 600px) {
    .pdl-upload-modal {
        padding: 16px;
        max-height: 95vh;
    }

    .pdl-form-row {
        flex-direction: column;
    }

    .pdl-form-half {
        min-width: 100%;
    }

    .pdl-dropzone {
        padding: 24px 16px;
    }
}

/* =====================
   LIBRARY PAGE
   ===================== */

/* Header */
.pdl-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.pdl-library-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
}

/* Search row */
.pdl-search-row {
    margin-bottom: 10px;
}

/* Filters row: category + sort side by side */
.pdl-filters-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.pdl-filters-row .pdl-filter-select {
    flex: 1;
}

.pdl-search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.pdl-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.pdl-search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.pdl-search-input:focus {
    border-color: #185FA5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 95, 165, 0.1);
}

.pdl-filter-select {
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: #fff;
    min-width: 140px;
}

/* Category pills */
.pdl-category-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pdl-pill {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
    user-select: none;
}

.pdl-pill:hover {
    background: #eee;
}

.pdl-pill-active {
    background: #185FA5;
    color: #fff;
    border-color: #185FA5;
}

.pdl-pill-active:hover {
    background: #0C447C;
}

/* File Cards */
.pdl-file-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.pdl-file-card:hover {
    border-color: #ccc;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.pdl-file-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

/* Type badge */
.pdl-file-type-badge {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pdl-file-type-badge span {
    font-size: 13px;
    font-weight: 600;
}

/* Card content */
.pdl-file-card-content {
    flex: 1;
    min-width: 0;
}

.pdl-file-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.pdl-file-card-title {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdl-file-card-title:hover {
    color: #185FA5;
}

.pdl-file-card-size {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

.pdl-file-card-desc {
    font-size: 13px;
    color: #666;
    margin: 0 0 8px;
    line-height: 1.4;
}

/* Meta items */
.pdl-file-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pdl-meta-item {
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

a.pdl-meta-item:hover {
    color: #185FA5;
}

/* Tag pills */
.pdl-tag-pill {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Download button */
.pdl-file-card-action {
    flex-shrink: 0;
    margin-left: 8px;
}

.pdl-download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
    background: #185FA5;
    border: none;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    font-weight: 500;
}

.pdl-download-btn:hover {
    background: #0C447C;
    color: #fff;
}

/* Empty state */
.pdl-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #999;
}

.pdl-empty-state p {
    margin: 0;
    font-size: 15px;
}

/* Loading */
.pdl-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

/* Pagination */
.pdl-pagination {
    margin-top: 24px;
}

.pdl-pagination-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.pdl-page-link {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
    user-select: none;
}

.pdl-page-link:hover {
    background: #f0f0f0;
}

.pdl-page-active {
    background: #185FA5;
    color: #fff;
    border-color: #185FA5;
    cursor: default;
}

.pdl-page-active:hover {
    background: #185FA5;
}

.pdl-page-dots {
    padding: 8px 6px;
    font-size: 13px;
    color: #999;
}

/* =====================
   Library Responsive
   ===================== */
@media screen and (max-width: 600px) {
    .pdl-library-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pdl-filters-row {
        flex-direction: column;
    }

    .pdl-filter-select {
        min-width: auto;
        width: 100%;
    }

    .pdl-file-card-inner {
        flex-direction: column;
    }

    .pdl-file-type-badge {
        width: 36px;
        height: 36px;
    }

    .pdl-file-card-action {
        margin-left: 0;
        width: 100%;
    }

    .pdl-download-btn {
        justify-content: center;
        width: 100%;
    }

    .pdl-file-card-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}

/* =====================
   SINGLE FILE PAGE
   ===================== */

/* Back link */
.pdl-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #185FA5;
    text-decoration: none;
    margin-bottom: 20px;
}
.pdl-back-link:hover {
    text-decoration: underline;
}

/* Main card */
.pdl-single-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 24px 28px;
}

/* Header */
.pdl-single-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.pdl-single-type-badge {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pdl-single-type-badge span {
    font-size: 16px;
    font-weight: 700;
}

.pdl-single-header-content {
    flex: 1;
    min-width: 0;
}

.pdl-single-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #1a1a1a;
    word-break: break-word;
}

.pdl-single-header-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pdl-single-filename {
    font-size: 13px;
    color: #666;
    font-family: monospace;
}

.pdl-single-filesize {
    font-size: 13px;
    color: #999;
}

/* Download button large */
.pdl-single-download {
    margin-bottom: 24px;
}

.pdl-download-btn-large {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #185FA5;
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}
.pdl-download-btn-large:hover {
    background: #0C447C;
    color: #fff;
}

/* Sections */
.pdl-single-section {
    margin-bottom: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.pdl-single-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pdl-single-description {
    font-size: 15px;
    color: #444;
    line-height: 1.6;
}

/* Details table */
.pdl-single-details {
    width: 100%;
    border-collapse: collapse;
}

.pdl-single-details td {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.pdl-single-details tr:last-child td {
    border-bottom: none;
}

.pdl-detail-label {
    color: #888;
    width: 140px;
    font-weight: 500;
}

.pdl-detail-link {
    color: #185FA5;
    text-decoration: none;
}
.pdl-detail-link:hover {
    text-decoration: underline;
}

/* Tags large */
.pdl-single-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pdl-tag-pill-large {
    padding: 4px 14px;
    font-size: 13px;
    border-radius: 14px;
}

/* Delete own file */
.pdl-single-owner-actions {
    margin-top: 20px;
    text-align: right;
}

.pdl-btn-delete-own {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #d63638;
    background: #fff;
    color: #d63638;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.pdl-btn-delete-own:hover {
    background: #d63638;
    color: #fff;
}

/* Single error */
.pdl-single-error {
    text-align: center;
    padding: 48px 20px;
    color: #999;
    font-size: 15px;
}

/* Single responsive */
@media screen and (max-width: 600px) {
    .pdl-single-card {
        padding: 16px 18px;
    }

    .pdl-single-header {
        flex-direction: column;
        gap: 12px;
    }

    .pdl-single-type-badge {
        width: 44px;
        height: 44px;
    }

    .pdl-detail-label {
        width: 100px;
    }
}

/* Uploader autocomplete */
.pdl-uploader-search-wrap {
    position: relative;
    flex: 1;
}

.pdl-uploader-input {
    width: 100%;
    padding-right: 30px !important;
}

.pdl-uploader-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    z-index: 2;
}
.pdl-uploader-clear:hover {
    color: #d63638;
}

.pdl-uploader-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.pdl-suggestion-item {
    padding: 9px 14px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.pdl-suggestion-item:hover {
    background: #f0f6fc;
    color: #185FA5;
}

.pdl-suggestion-item svg {
    color: #999;
    flex-shrink: 0;
}

.pdl-suggestion-item:hover svg {
    color: #185FA5;
}

/* Clickable uploader name in cards */
.pdl-filter-by-uploader {
    color: #185FA5 !important;
    cursor: pointer;
    font-weight: 500;
}
.pdl-filter-by-uploader:hover {
    text-decoration: underline;
}
