/* Document Manager Frontend Styles */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

.dm-frontend-wrap {
    font-family: 'DM Sans', sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===========================
   HEADER BAR
   =========================== */
.dm-header-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.dm-search-wrap {
    flex: 1;
    min-width: 240px;
    position: relative;
    display: flex;
    align-items: center;
}
.dm-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #b0b8c8;
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 2;
    line-height: 1;
    width: 16px;
    height: 16px;
    overflow: hidden;
}
.dm-search-icon svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px;
    min-height: 16px;
    max-width: 16px;
    max-height: 16px;
    display: block;
    flex-shrink: 0;
}
.dm-search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1.5px solid #dde3ed;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    line-height: 1.4;
    height: 42px;
}
.dm-search-input::placeholder {
    color: #b0b8c8;
    font-size: 14px;
}
.dm-search-input:focus {
    border-color: #3a7bd5;
    box-shadow: 0 0 0 3px rgba(58,123,213,0.12);
}

.dm-view-toggle {
    display: flex;
    border: 1.5px solid #dde3ed;
    border-radius: 8px;
    overflow: hidden;
    height: 42px;
    flex-shrink: 0;
}
.dm-view-btn {
    padding: 0 13px;
    border: none;
    background: #fff;
    cursor: pointer;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.dm-view-btn:first-child { border-right: 1px solid #dde3ed; }
.dm-view-btn.active { background: #3a7bd5; color: #fff; }
.dm-view-btn:hover:not(.active) { background: #f0f4ff; color: #3a7bd5; }

/* ===========================
   CATEGORY TABS
   =========================== */
.dm-cat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.dm-cat-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border: 1.5px solid #dde3ed;
    border-radius: 30px;
    background: #fff;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    color: #555;
    line-height: 1;
}
.dm-cat-tab:hover { border-color: #3a7bd5; color: #3a7bd5; background: #f0f4ff; }
.dm-cat-tab.active { background: #3a7bd5; border-color: #3a7bd5; color: #fff; }
.dm-cat-count {
    background: rgba(255,255,255,0.25);
    border-radius: 20px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}
.dm-cat-tab:not(.active) .dm-cat-count { background: #eef2fb; color: #3a7bd5; }

/* ===========================
   RESULTS INFO
   =========================== */
.dm-results-info {
    font-size: 13px;
    color: #888;
    margin-bottom: 14px;
    min-height: 20px;
}

/* ===========================
   LOADING
   =========================== */
.dm-loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    grid-column: 1 / -1;
}
.dm-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e8edf5;
    border-top-color: #3a7bd5;
    border-radius: 50%;
    animation: dm-spin 0.7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes dm-spin { to { transform: rotate(360deg); } }

/* ===========================
   GRID LAYOUT
   =========================== */
.dm-documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.dm-documents-grid.dm-list-view {
    grid-template-columns: 1fr;
    gap: 10px;
}

/* ===========================
   DOCUMENT CARD — GRID
   =========================== */
.dm-doc-card {
    background: #fff;
    border-radius: 14px;
    border: 1.5px solid #e8edf5;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    animation: dm-fade-in 0.3s ease both;
}
.dm-doc-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(58,123,213,0.12);
    border-color: #c5d6f0;
}
@keyframes dm-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dm-doc-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 0;
}

.dm-doc-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    letter-spacing: 0.5px;
    color: #fff;
    line-height: 1.4;
}
.dm-type-pdf                { background: #e74c3c; }
.dm-type-doc, .dm-type-docx { background: #2980b9; }
.dm-type-ppt, .dm-type-pptx { background: #e67e22; }
.dm-type-xls, .dm-type-xlsx { background: #27ae60; }
.dm-type-zip, .dm-type-rar  { background: #8e44ad; }
.dm-type-txt                { background: #7f8c8d; }
.dm-type-generic            { background: #95a5a6; }

.dm-doc-featured-badge {
    font-size: 16px;
    line-height: 1;
    color: #f5b731;
    flex-shrink: 0;
}

.dm-doc-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 14px;
    margin: 14px 16px 0;
    flex-shrink: 0;
}
.dm-doc-icon-wrap svg { width: 30px; height: 30px; }

.dm-doc-pdf-wrap    { background: #fdf0ef; color: #e74c3c; }
.dm-doc-word-wrap   { background: #eef5fb; color: #2980b9; }
.dm-doc-ppt-wrap    { background: #fdf5ec; color: #e67e22; }
.dm-doc-excel-wrap  { background: #eafaf1; color: #27ae60; }
.dm-doc-zip-wrap    { background: #f5eefa; color: #8e44ad; }
.dm-doc-txt-wrap    { background: #f5f5f5; color: #7f8c8d; }
.dm-doc-generic-wrap{ background: #f0f4f8; color: #7f8c8d; }

.dm-doc-body {
    padding: 12px 16px 14px;
    flex: 1;
}
.dm-doc-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 6px;
    line-height: 1.35;
}
.dm-doc-excerpt {
    font-size: 13px;
    color: #888;
    line-height: 1.55;
    margin: 0 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dm-doc-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}
.dm-doc-cat-tag {
    padding: 2px 9px;
    background: #e8f0fe;
    color: #3a7bd5;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
}

.dm-doc-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: #aaa;
    flex-wrap: wrap;
}
.dm-doc-meta-item {
    display: flex;
    align-items: center;
    gap: 3px;
}
.dm-doc-meta-item svg { width: 12px; height: 12px; flex-shrink: 0; }

.dm-doc-footer {
    padding: 10px 16px;
    border-top: 1px solid #f0f4ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.dm-doc-size {
    font-size: 12px;
    color: #c0c8d8;
    font-family: 'DM Mono', monospace;
    white-space: nowrap;
}

.dm-doc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dm-btn-share-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid #dde3ed;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    color: #aab4c4;
    transition: all 0.15s;
    padding: 0;
    flex-shrink: 0;
}
.dm-btn-share-card svg { width: 15px; height: 15px; }
.dm-btn-share-card:hover {
    border-color: #3a7bd5;
    color: #3a7bd5;
    background: #f0f4ff;
}

.dm-btn-download-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 36px;
    background: #3a7bd5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.dm-btn-download-card:hover { background: #2d6bc4; color: #fff; }
.dm-btn-download-card svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ===========================
   LIST VIEW CARD
   =========================== */
.dm-list-view .dm-doc-card {
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    gap: 14px;
    min-height: 80px;
}
.dm-list-view .dm-doc-card-top {
    padding: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    flex-shrink: 0;
}
.dm-list-view .dm-doc-icon-wrap {
    margin: 0;
    width: 48px;
    height: 48px;
    border-radius: 10px;
}
.dm-list-view .dm-doc-icon-wrap svg { width: 24px; height: 24px; }
.dm-list-view .dm-doc-body {
    padding: 0;
    flex: 1;
    min-width: 0;
}
.dm-list-view .dm-doc-footer {
    border-top: none;
    padding: 0;
    flex-shrink: 0;
}
.dm-list-view .dm-doc-excerpt { -webkit-line-clamp: 1; margin-bottom: 6px; }
.dm-list-view .dm-doc-cats { margin-bottom: 6px; }
.dm-list-view .dm-doc-featured-badge { display: none; }
.dm-list-view .dm-doc-size { display: none; }

/* ===========================
   EMPTY STATE
   =========================== */
.dm-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
    grid-column: 1 / -1;
}
.dm-empty-state svg { width: 56px; height: 56px; margin-bottom: 14px; opacity: 0.35; }
.dm-empty-state p { font-size: 15px; margin: 0; }

/* ===========================
   PAGINATION
   =========================== */
.dm-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}
.dm-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid #dde3ed;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.15s;
    color: #555;
    line-height: 1;
}
.dm-page-btn:hover { border-color: #3a7bd5; color: #3a7bd5; background: #f0f4ff; }
.dm-page-btn.active { background: #3a7bd5; border-color: #3a7bd5; color: #fff; font-weight: 600; }
.dm-page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.dm-page-ellipsis { color: #ccc; padding: 0 4px; }

/* ===========================
   LOCKED DOCS
   =========================== */
.dm-doc-card.dm-locked { opacity: 0.72; }
.dm-doc-card.dm-locked .dm-btn-download-card { background: #aab4c4; }
.dm-doc-card.dm-locked .dm-btn-download-card:hover { background: #8e9aaa; }

/* ===========================
   DOWNLOAD MODAL
   =========================== */
.dm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,20,40,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
    animation: dm-overlay-in 0.2s ease;
    box-sizing: border-box;
}
@keyframes dm-overlay-in { from { opacity: 0; } to { opacity: 1; } }

.dm-modal {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(10,20,40,0.25);
    animation: dm-modal-in 0.25s ease;
}
@keyframes dm-modal-in {
    from { transform: scale(0.94) translateY(14px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.dm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid #f0f4ff;
}
.dm-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1e3a5f;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dm-modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: #f0f4ff;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.15s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}
.dm-modal-close:hover { background: #dde8f8; color: #333; }

.dm-modal-body {
    padding: 20px 22px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.dm-modal-icon {
    flex-shrink: 0;
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dm-modal-icon svg { width: 26px; height: 26px; }

.dm-modal-info { flex: 1; min-width: 0; }
.dm-modal-info p {
    margin: 0 0 10px;
    font-size: 14px;
    color: #333;
    font-weight: 600;
    line-height: 1.4;
}
.dm-modal-meta {
    font-size: 12px;
    color: #aaa;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.dm-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid #f0f4ff;
}
.dm-btn-cancel {
    padding: 0 20px;
    height: 40px;
    border: 1.5px solid #dde3ed;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    color: #666;
    transition: all 0.15s;
    line-height: 1;
}
.dm-btn-cancel:hover { background: #f8fafc; border-color: #c5cfe0; }

.dm-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 22px;
    height: 40px;
    background: #3a7bd5;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}
.dm-btn-download:hover { background: #2d6bc4; color: #fff; }
.dm-btn-download svg { flex-shrink: 0; }

/* ===========================
   SHARE MODAL
   =========================== */
.dm-share-modal { max-width: 460px; }

.dm-share-doc-info {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    background: #f8fafc;
    border-bottom: 1px solid #eef1f7;
}
.dm-share-doc-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dm-share-doc-icon svg { width: 22px; height: 22px; }
.dm-share-doc-info strong {
    display: block;
    font-size: 14px;
    color: #1e3a5f;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 2px;
}
.dm-share-doc-info span {
    font-size: 11px;
    color: #aab4c4;
    font-family: 'DM Mono', monospace;
    font-weight: 500;
}

.dm-share-label {
    margin: 0 0 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #b0b8c8;
}

.dm-share-platforms {
    padding: 18px 22px;
    border-bottom: 1px solid #eef1f7;
}
.dm-share-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.dm-share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    border: 1.5px solid transparent;
    line-height: 1;
}
.dm-share-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.dm-share-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.dm-share-facebook { background: #1877F2; color: #fff; }
.dm-share-twitter  { background: #000;    color: #fff; }
.dm-share-linkedin { background: #0A66C2; color: #fff; }
.dm-share-whatsapp { background: #25D366; color: #fff; }
.dm-share-telegram { background: #26A5E4; color: #fff; }
.dm-share-email    { background: #f8fafc; color: #444; border-color: #dde3ed; }

.dm-share-copy-wrap {
    padding: 18px 22px 20px;
}
.dm-share-copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.dm-share-link-input {
    flex: 1;
    padding: 0 13px;
    height: 40px;
    border: 1.5px solid #dde3ed;
    border-radius: 9px;
    font-size: 12px;
    font-family: 'DM Mono', monospace;
    color: #555;
    background: #f8fafc;
    outline: none;
    min-width: 0;
    box-sizing: border-box;
}
.dm-share-link-input:focus { border-color: #3a7bd5; }

.dm-share-copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 40px;
    background: #3a7bd5;
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.dm-share-copy-btn:hover { background: #2d6bc4; }
.dm-share-copy-btn.dm-copied { background: #27ae60; }
.dm-share-copy-btn svg { flex-shrink: 0; }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 680px) {
    .dm-documents-grid { grid-template-columns: 1fr; }
    .dm-cat-tabs { gap: 6px; }
    .dm-cat-tab { font-size: 12px; padding: 6px 12px; }
    .dm-share-buttons { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .dm-list-view .dm-doc-card {
        flex-wrap: wrap;
        gap: 10px;
        padding: 14px;
    }
    .dm-list-view .dm-doc-footer {
        width: 100%;
        justify-content: flex-end;
        padding-top: 10px;
        border-top: 1px solid #f0f4ff;
    }
    .dm-list-view .dm-doc-size { display: block; }
    .dm-btn-download-card { flex: 1; justify-content: center; }
}
