/**
 * Display Form Entries - Optimized Styles
 * Deduplicated lines while preserving all Table, Pagination, and Featured logic.
 */

/* ========================================
   BLOCK & CONTAINER STYLES
   ======================================== */
.wp-block-displayformentries-entries,
.wp-block-displayformentries-entry,
.wp-block-displayformentries-form {
    display: block !important;
    visibility: visible !important;
}

.dfe-edit-cell .dashicons-edit{text-decoration: none !important;}
.dfe-block-fallback, .dfe-no-entries {
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
}
.dfe-block-fallback { margin: 10px 0; }
.dfe-block-fallback p { margin: 5px 0; color: #666; }

.dfe-container { margin: 20px 0; font-family: inherit; }
.dfe-container-single, .dfe-single, .dfe-entry-detail, .dfe-entry-detail-container, .dfe-frontend-edit-container {
    max-width: 800px;
    margin: 0 auto;
}

/* ========================================
   ERROR MESSAGES
   ======================================== */
.dfe-error {
    color: #dc3232;
    background: #fff;
    border-left: 4px solid #dc3232;
    padding: 12px;
    margin: 5px 0 15px 0;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.dfe-no-entries { color: #666; }

/* ========================================
   LIST VIEW STYLES
   ======================================== */
.dfe-list { list-style: none; padding: 0; margin: 0; }
.dfe-list-item, .dfe-entry-item {
    border: 1px solid #ddd;
    margin-bottom: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}
.dfe-list-item:hover, .dfe-entry-item:hover { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); }
.dfe-entries-list { margin: 20px 0; }

/* ========================================
   TABLE VIEW STYLES
   ======================================== */
.dfe-table-container {
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dfe-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; line-height: 1.4; }
.dfe-table th, .dfe-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #e1e5e9; vertical-align: top; color: #333; }
.dfe-table th { background: #f8f9fa; font-weight: 600; color: #495057; position: sticky; top: 0; z-index: 10; }
.dfe-table th:first-child { border-top-left-radius: 8px; }
.dfe-table th:last-child { border-top-right-radius: 8px; }

.dfe-entry-row { transition: background-color 0.2s ease; }
.dfe-entry-row:hover, .dfe-table.dfe-hover tbody tr:hover, .dfe-table tbody tr.dfe-clickable:hover { background-color: #e3f2fd; }

.dfe-field-cell { word-wrap: break-word; max-width: 300px; }
.dfe-table.dfe-striped tbody tr:nth-child(even), .dfe-striped-row { background-color: #f8f9fa; }
.dfe-table.dfe-compact th, .dfe-table.dfe-compact td { padding: 8px 12px; font-size: 13px; }

/* Sortable Table Headers */
.dfe-table.dfe-sortable th.dfe-sortable { cursor: pointer; user-select: none; position: relative; }
.dfe-table.dfe-sortable th.dfe-sortable:hover { background-color: #e9ecef; }
.dfe-table th .dfe-sort-label, .dfe-table th .dfe-sort-icon { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.dfe-sort-icon { font-size: 12px; color: #6c757d; transition: transform 0.2s ease; }
.dfe-sort-label { margin-right: 8px; }
.dfe-table.dfe-sortable th.dfe-sortable:hover .dfe-sort-icon { color: #495057; }

.dfe-table tbody tr.dfe-clickable { cursor: pointer; }
.dfe-empty { opacity: 0.6; font-style: italic; }
.dfe-table-pagination { padding: 12px 16px; font-size: 13px; color: #555; background: #fafafa; border-top: 1px solid #e6e6e6; border-radius: 0 0 10px 10px; }

/* ========================================
   CARD VIEW STYLES
   ======================================== */
.dfe-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin: 20px 0; }
.dfe-card {
    border: 1px solid #ddd;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
        position: relative;
}
.dfe-card:hover { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15); transform: translateY(-2px); }
.dfe-card-image { margin: -20px -20px 15px -20px; border-radius: 8px 8px 0 0; overflow: hidden; max-height: 200px; }
.dfe-card-image img { width: 100%; height: auto; display: block; }
.dfe-card-title { margin: 0 0 15px 0; color: #333; font-size: 1.2em; font-weight: 600; line-height: 1.3; }
.dfe-card-content { flex: 1; display: flex; flex-direction: column;position: relative; }
.dfe-card-content .dfe-field { margin-bottom: 10px; padding: 0; border: none; }
.dfe-card-content .dfe-field-label { font-size: 12px; margin-bottom: 3px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.dfe-card-content .dfe-field-value { font-size: 14px; color: #333; line-height: 1.4; }
.dfe-card .dfe-edit-link { text-align: right; position: absolute;right: 16px;top: 12px;}

.dfe-cards.dfe-cards-2 { grid-template-columns: repeat(2, 1fr); }
.dfe-cards.dfe-cards-3 { grid-template-columns: repeat(3, 1fr); }
.dfe-cards.dfe-cards-4 { grid-template-columns: repeat(4, 1fr); }

/* ========================================
   SINGLE ENTRY STYLES
   ======================================== */
.dfe-single h2 { color: #333; border-bottom: 2px solid #007cba; padding-bottom: 10px; margin-bottom: 20px; }
.dfe-single-item { margin-bottom: 20px; }
.dfe-single-card { background: #fff; border: 1px solid #e6e6e6; border-radius: 12px; padding: 25px; margin: 25px 0; max-width: 800px; position: relative; }
.dfe-single-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.dfe-single-title { font-size: 22px; font-weight: 600; margin: 0; color: #333; }
.dfe-single-fields { margin-top: 10px; }
.dfe-single-field-row { padding: 14px 0; border-bottom: 1px solid #f1f1f1; }
.dfe-single-field-row:last-child { border-bottom: none; }
.dfe-single-field-row .dfe-field-label { color: #555; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.dfe-single-field-row .dfe-field-value { color: #222; font-size: 16px; line-height: 1.5; }

.dfe-single-edit-top, .dfe-single-edit-bottom { text-align: right; margin-top: 15px; }
.dfe-single-edit { position: absolute; top: 12px; right: 12px; z-index: 10; }
.dfe-single-edit a, .dfe-single-entry .dfe-edit-link { display: inline-flex; align-items: center; border-radius: 6px; text-decoration: none !important; transition: all 0.2s ease; }
.dfe-single-entry .dfe-edit-link { gap: 6px; padding: 7px 12px; color: #333 !important; }
.dfe-single-entry .dfe-edit-link:hover, .dfe-single-edit a:hover { background: #e9e9e9; border-color: #ccc; }
.dfe-single-entry .dfe-edit-link img { width: 15px; height: 15px; }

/* ========================================
   FIELD STYLES
   ======================================== */
.dfe-field { margin-bottom: 15px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; transition: all 0.2s ease; }
.dfe-field:last-child { border-bottom: none; }
.dfe-field-label { font-weight: 600; color: #333; margin-bottom: 5px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; display: block; word-wrap: break-word; }
.dfe-field-value { color: #666; line-height: 1.5; font-size: 16px; word-wrap: break-word; transition: all 0.2s ease; }
.dfe-field-required { color: #dc3232; }
.dfe-field-required .dfe-field-label::after { content: ' *'; color: #dc3232; }
.dfe-field-admin-only { color: #666; font-style: italic; }

/* Links within fields */
.dfe-field-email a, .dfe-field-url a, .dfe-field-website a, .dfe-entry-detail-link { color: #007cba; text-decoration: none; }
.dfe-field-email a:hover, .dfe-field-url a:hover, .dfe-field-website a:hover, .dfe-entry-detail-link:hover { text-decoration: underline; }

.dfe-field-fileupload a { display: inline-flex; align-items: center; color: #007cba; text-decoration: none; padding: 4px 8px; border: 1px solid #007cba; border-radius: 4px; font-size: 12px; }
.dfe-field-fileupload a:hover { background-color: #007cba; color: #fff; }

.dfe-list-field { list-style: none; padding: 0; margin: 0; }
.dfe-list-field li { padding: 2px 0; display: flex; align-items: flex-start; }
.dfe-list-field li::before { content: '•'; margin-right: 8px; flex-shrink: 0; }
.dfe-field-value .dfe-empty { color: #6c757d; font-style: italic; }

/* ========================================
   NAVIGATION & SEARCH STYLES
   ======================================== */
.dfe-back-link, .dfe-back-btn, .dfe-back-button { display: inline-flex; align-items: center; border-radius: 4px; transition: all 0.2s ease; text-decoration: none !important; }
.dfe-back-link a, .dfe-back-btn, .dfe-back-link { padding: 8px 12px; background: #f0f0f0; color: #333; }
.dfe-back-button { gap: 8px; padding: 8px 16px; background: #6c757d; color: #fff; font-size: 14px; font-weight: 500; }
.dfe-back-button:hover { background: #5a6268; transform: translateX(-2px); }

.dfe-search, .dfe-table-search { margin-bottom: 20px; display: flex; gap: 10px; align-items: center; }
.dfe-search input[type="text"], .dfe-search-input { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
.dfe-search input[type="submit"] { padding: 8px 16px; background: #007cba; color: #fff; border: none; border-radius: 4px; cursor: pointer; }
.dfe-search-clear { padding: 8px 12px; background: #6c757d; color: #fff; border: none; border-radius: 4px; cursor: pointer; }

/* ========================================
   PAGINATION STYLES
   ======================================== */
.dfe-pagination { margin: 20px 0; text-align: center; }
.dfe-pagination .page-numbers { display: inline-block; padding: 8px 12px; margin: 0 2px; border: 1px solid #ddd; background: #fff; color: #333; text-decoration: none; border-radius: 4px; transition: all 0.2s ease; }
.dfe-pagination .page-numbers.current { background: #007cba; color: #fff; border-color: #007cba; }

.dfe-pagination-compact { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 20px; border-radius: 8px; flex-wrap: wrap; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.dfe-pagination-info { font-size: 14px; font-weight: 500; color: #495057; }
.dfe-pagination-nav, .dfe-pagination-numbers { display: flex; align-items: center; gap: 4px; }

.dfe-pagination-prev, .dfe-pagination-next, .dfe-pagination-num {
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; transition: all 0.2s ease;
}
.dfe-pagination-prev, .dfe-pagination-next { background: #ffffff; color: #0073aa; font-weight: 700; }
.dfe-pagination-num { background: transparent; color: #0073aa; }
.dfe-pagination-num.dfe-pagination-current { background: linear-gradient(135deg, #0073aa 0%, #005a87 100%); color: #ffffff; box-shadow: 0 2px 6px rgba(0, 115, 170, 0.25); pointer-events: none; }
.dfe-pagination-disabled { background: #f8f9fa !important; color: #b4b4b4 !important; cursor: not-allowed; opacity: 0.5; }

/* ========================================
   FEATURED / STARRED ENTRY STYLES
   ======================================== */
.dfe-entry-starred {
    position: relative;
    background-color: #fff9e6 !important;
    border-left: 4px solid #ffd700 !important;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.15);
}
.dfe-entry-starred:hover { background-color: #fff5d6 !important; }

.dfe-entry-starred .dfe-field-cell:first-child::before {
    content: '★ Featured'; position: absolute; top: -8px; left: -8px; background: linear-gradient(135deg, #ffd700, #ffb300); color: #333; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 3px; z-index: 999; text-transform: uppercase;
}

.dfe-card.dfe-entry-starred { border: 2px solid #ffd700; background: linear-gradient(to bottom, #fff9e6, #fff); }
.dfe-card.dfe-entry-starred::after {
    content: 'FEATURED'; position: absolute; top: 15px; right: -25px; background: linear-gradient(45deg, #ffd700, #ffb300); color: #333; font-size: 10px; font-weight: 700; padding: 6px 25px; transform: rotate(45deg); z-index: 1; text-transform: uppercase;
}

.dfe-featured-filter { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 15px; padding: 8px 12px; background: #f8f9fa; border: 1px solid #e1e5e9; border-radius: 6px; }
.dfe-featured-count { padding: 2px 6px; background: #ffd700; color: #333; font-size: 11px; font-weight: 600; border-radius: 10px; }

@keyframes featured-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 215, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}
.dfe-entry-starred.new-featured { animation: featured-pulse 1.5s ease-out; }

/* ========================================
   RESPONSIVE & PRINT STYLES
   ======================================== */
@media (max-width: 768px) {
    .dfe-cards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
    .dfe-table th, .dfe-table td { padding: 8px 10px; font-size: 13px; }
    .dfe-pagination-info, .dfe-pagination-nav { flex: 0 0 100%; text-align: center; justify-content: center; }
}

@media print {
    .dfe-back-link, .dfe-search, .dfe-pagination, .dfe-pagination-compact, .dfe-edit-link { display: none !important; }
    .dfe-container, .dfe-table, .dfe-table th, .dfe-table td { border: 1px solid #000 !important; box-shadow: none !important; }
}