/* Post Bookmarks Plugin Styles */

/* Container and Layout */
.post-bookmarks-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Controls Section */
.pb-controls {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.search-filter-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.pb-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.pb-category-select,
.pb-tag-select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    min-width: 150px;
}

.pb-reset-button {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.pb-reset-button:hover {
    background: #5a6268;
}

.pb-filter-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.pb-filter-controls label {
    font-weight: 500;
    color: #495057;
}

.pb-filter-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Result Count */
.pb-result-count {
    margin-bottom: 15px;
    color: #6c757d;
    font-size: 14px;
}

/* Posts Grid */
.pb-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.post-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post-image-container {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    font-size: 48px;
    color: #6c757d;
}

.post-bookmark-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px !important;
    transition: all 0.2s;
}

.post-bookmark-btn:hover {
    background: rgba(0,0,0,0.9);
}

.post-bookmark-btn.saved {
    background: #28a745;
    color: white;
}

.post-bookmark-btn.saved:hover {
    background: #218838;
}

.post-content {
    padding: 20px;
}

.post-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.3;
}

.post-title a {
    color: #212529;
    text-decoration: none;
}

.post-title a:hover {
    color: #007bff;
}

.post-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #6c757d;
    flex-wrap: wrap;
}

.post-meta a {
    color: #007bff;
    text-decoration: none;
}

.post-meta a:hover {
    text-decoration: underline;
}

.post-excerpt {
    color: #495057;
    line-height: 1.5;
    margin-bottom: 15px;
}

.post-categories {
    margin-bottom: 10px;
}

.post-category {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.post-tags {
    margin-bottom: 15px;
}

.post-tag {
    display: inline-block;
    background: #f8f9fa;
    color: #6c757d;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 11px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.post-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.read-more-btn,
.view-details-btn {
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.read-more-btn {
    background: #007bff;
    color: white;
}

.read-more-btn:hover {
    background: #0056b3;
    color: white;
}

.view-details-btn {
    background: #6c757d;
    color: white;
}

.view-details-btn:hover {
    background: #5a6268;
}

/* No Posts Message */
.no-posts {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 16px;
}

/* Pagination */
.pb-pagination {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.pagination-wrapper {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #007bff;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
}

.pagination-btn:hover {
    background: #e9ecef;
}

.pagination-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #6c757d;
}

/* Modal Styles */
.pb-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.pb-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.pb-close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.pb-close-modal:hover {
    color: #000;
}

.modal-post-header h2 {
    margin: 0 0 10px 0;
    color: #212529;
}

.modal-post-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #6c757d;
    flex-wrap: wrap;
}

.modal-post-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 20px;
}

.modal-post-content {
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-post-categories,
.modal-post-tags {
    margin-bottom: 15px;
    font-size: 14px;
}

.modal-post-actions {
    display: flex;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.modal-read-full-btn {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
}

.modal-read-full-btn:hover {
    background: #0056b3;
    color: white;
}

.modal-bookmark-btn {
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
}

/* Bookmarks System Styles */

/* Floating bookmarks tab */
.bookmarks-tab {
    position: fixed;
    bottom: 250px;
    left: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    overflow: visible;
    flex-direction: column-reverse;
}

.bookmarks-tab-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: #007cba;
    color: #fff;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    user-select: none;
    min-width: 32px;
    min-height: 80px;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    position: relative;
    order: 2;
}

.bookmarks-tab-header:hover {
    background: #005a87;
}

.bookmarks-title {
    font-weight: 600;
    font-size: 11px;
    transform: rotate(0deg);
    pointer-events: none;
    line-height: 1;
}

.bookmarks-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    pointer-events: none;
}

.bookmarks-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s ease;
    pointer-events: none;
}

.bookmarks-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Bookmarks panel - hidden by default */
.bookmarks-panel {
    display: none;
    width: 0;
    max-height: 400px;
    overflow: visible;
    background: #fff;
    border-left: none;
    border-top: 1px solid #ddd;
    border-radius: 8px 0 0 0;
    transition: width 0.3s ease;
    position: relative;
    bottom: 0;
    order: 1;
}

.bookmarks-tab.open {
    border-radius: 8px 8px 8px 0;
}

/* Only show panel when tab is open */
.bookmarks-tab.open .bookmarks-panel {
    display: block;
    width: 280px;
}

.bookmarks-panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bookmarks-panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: #212529;
}

.clear-all-bookmarks {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
}

.clear-all-bookmarks:hover {
    background: #c82333;
}

/* Bookmarks list */
.bookmarks-list {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    /* Ensure scrolling works properly */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.no-bookmarks {
    text-align: center;
    padding: 30px 20px;
    color: #6c757d;
    font-style: italic;
}

.bookmark-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.bookmark-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.bookmark-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
}

.bookmark-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bookmark-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    font-size: 24px;
    color: #6c757d;
}

.bookmark-content {
    flex: 1;
    min-width: 0;
}

.bookmark-title {
    font-weight: 600;
    font-size: 14px;
    color: #212529;
    margin-bottom: 5px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.bookmark-meta {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
}

.bookmark-author,
.bookmark-date {
    margin-right: 10px;
}

.bookmark-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.bookmark-category {
    background: #e9ecef;
    color: #495057;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
}

.bookmark-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

.remove-bookmark {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    background: #dc3545;
    color: white;
    border: none;
    font-weight: bold;
}

.remove-bookmark:hover {
    background: #c82333;
}

/* Bookmarks notification */
.bookmarks-notification {
    position: fixed;
    bottom: 300px;
    left: 60px;
    background: #28a745;
    color: #fff;
    padding: 12px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1051;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    max-width: 300px;
}

.bookmarks-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Custom scrollbar for bookmarks list */
.bookmarks-list::-webkit-scrollbar {
    width: 8px;
}

.bookmarks-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.bookmarks-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
    border: 1px solid #f1f1f1;
}

.bookmarks-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.bookmarks-list::-webkit-scrollbar-thumb:active {
    background: #333;
}

/* Mobile responsiveness for bookmarks */
@media (max-width: 768px) {
    .bookmarks-tab {
        left: 0;
        bottom: 20px;
        flex-direction: row;
        border-radius: 8px;
        width: auto;
        max-width: 90vw;
    }
    
    .bookmarks-tab-header {
        border-radius: 8px 0 0 8px;
        min-height: 50px;
        min-width: 60px;
        flex-direction: row;
        gap: 8px;
        order: 1;
    }
    
    .bookmarks-panel {
        width: calc(100vw - 80px);
        max-width: 320px;
        max-height: 300px;
        border-radius: 0 8px 8px 0;
        border-top: none;
        border-left: 1px solid #ddd;
        order: 2;
    }
    
    .bookmarks-tab.open .bookmarks-panel {
        width: calc(100vw - 80px);
        max-width: 320px;
    }
    
    .bookmarks-list {
        max-height: 250px;
        padding: 8px;
    }
    
    .bookmark-item {
        padding: 8px;
        gap: 8px;
    }
    
    .bookmark-image {
        width: 50px;
        height: 50px;
    }
    
    .bookmark-title {
        font-size: 13px;
        -webkit-line-clamp: 1;
    }
    
    .bookmarks-notification {
        bottom: 80px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* Mobile responsiveness for main content */
@media (max-width: 768px) {
    .post-bookmarks-container {
        padding: 15px;
    }
    
    .pb-posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .search-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pb-search,
    .pb-category-select,
    .pb-tag-select {
        width: 100%;
        min-width: auto;
    }
    
    .pb-filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .pb-filter-controls select {
        width: 100%;
    }
    
    .post-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .post-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .pb-modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }
    
    .modal-post-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .bookmarks-tab {
        /* Mobile styles already defined above */
    }
}

/* Extra small mobile devices */
@media (max-width: 395px) {
    .bookmarks-panel {
        width: calc(100vw - 70px);
        max-width: 280px;
    }
    
    .bookmarks-tab.open .bookmarks-panel {
        width: calc(100vw - 70px);
        max-width: 280px;
    }
    
    .bookmarks-panel-header {
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .bookmarks-panel-header h3 {
        font-size: 14px;
        text-align: center;
        margin-bottom: 0;
    }
    
    .clear-all-bookmarks {
        padding: 6px 12px;
        font-size: 11px;
        width: 100%;
        text-align: center;
    }
    
    .bookmark-item {
        padding: 6px;
        gap: 6px;
    }
    
    .bookmark-image {
        width: 40px;
        height: 40px;
    }
    
    .bookmark-title {
        font-size: 12px;
        line-height: 1.2;
    }
    
    .bookmark-categories {
        display: none;
    }
    
    .remove-bookmark {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
}

/* Loader */
#loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Modal open body class */
body.modal-open {
    overflow: hidden;
}

/* Clear All Confirmation Modal */
.clear-all-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.clear-all-modal-overlay.show {
    opacity: 1;
}

.clear-all-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    transition: transform 0.3s ease;
    overflow: hidden;
}

.clear-all-modal-overlay.show .clear-all-modal {
    transform: translate(-50%, -50%) scale(1);
}

.clear-all-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clear-all-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #212529;
}

.clear-all-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.clear-all-modal-close:hover {
    background: #f8f9fa;
    color: #495057;
}

.clear-all-modal-body {
    padding: 24px;
}

.clear-all-modal-body p {
    margin: 0 0 12px 0;
    font-size: 16px;
    line-height: 1.5;
    color: #495057;
}

.clear-all-warning {
    color: #dc3545 !important;
    font-weight: 500;
    font-size: 14px !important;
}

.clear-all-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.clear-all-cancel-btn,
.clear-all-confirm-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 80px;
}

.clear-all-cancel-btn {
    background: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

.clear-all-cancel-btn:hover {
    background: #5a6268;
    border-color: #545b62;
}

.clear-all-confirm-btn {
    background: #dc3545;
    color: white;
}

.clear-all-confirm-btn:hover {
    background: #c82333;
}

/* Mobile responsiveness for modal */
@media (max-width: 768px) {
    .clear-all-modal {
        max-width: 95%;
        margin: 20px;
    }
    
    .clear-all-modal-header,
    .clear-all-modal-body,
    .clear-all-modal-footer {
        padding: 16px;
    }
    
    .clear-all-modal-footer {
        flex-direction: column;
    }
    
    .clear-all-cancel-btn,
    .clear-all-confirm-btn {
        width: 100%;
    }
}

/* Star bookmark icons - only the small star symbols next to titles */
.post-bookmark-star {
    background: none !important;
    border: none !important;
    color: #ccc !important;
    font-size: 30px !important;
    margin-left: 8px !important;
    cursor: pointer !important;
    transition: color 0.2s !important;
    padding: 0 !important;
    vertical-align: middle !important;
}

/* Golden color for saved stars */
.post-bookmark-star.saved,
.post-bookmark-star[style*="color: rgb(255, 193, 7)"],
.post-bookmark-star[style*="color: #ffc107"] {
    color: #ffc107 !important;
}

/* More specific selector for star buttons */
button.post-bookmark-star {
    background: none !important;
    border: none !important;
    color: #ccc !important;
    font-size: 30px !important;
    margin-left: 8px !important;
    cursor: pointer !important;
    transition: color 0.2s !important;
    padding: 0 !important;
    vertical-align: middle !important;
}

/* Golden color for saved stars - more specific selector */
button.post-bookmark-star.saved,
button.post-bookmark-star[style*="color: rgb(255, 193, 7)"],
button.post-bookmark-star[style*="color: #ffc107"] {
    color: #ffc107 !important;
}

/* Reset font-size for Save Post buttons to normal size */
.post-bookmark-btn,
.post-bookmark-star.post-bookmark-btn {
    font-size: 12px !important;
}

/* Override for Save Post buttons that might have star class */
button.post-bookmark-btn,
button.post-bookmark-star.post-bookmark-btn,
.post-bookmark-btn {
    font-size: 12px !important;
    padding: 8px 12px !important;
    margin-left: 0 !important;
    background: rgba(0,0,0,0.7) !important;
    color: white !important;
    border: none !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    vertical-align: baseline !important;
}

/* Specific styling for Save Post buttons in entry titles */
.entry-title .post-bookmark-star.post-title-bookmark-btn {
    font-size: 14px !important;
    padding: 0px 10px 0px 10px !important;
    color: #fff !important;
}

.entry-title .post-bookmark-star.post-title-bookmark-btn:hover {
    font-size: 14px !important;
    padding: 0px 10px 0px 10px !important;
    color: #fff !important;
    background: rgba(0,0,0,0.9) !important;
}

.entry-title .post-bookmark-star.post-title-bookmark-btn:active {
    font-size: 14px !important;
    padding: 0px 10px 0px 10px !important;
    color: #fff !important;
    background: rgba(0,0,0,1) !important;
}

.entry-title .post-bookmark-star.post-title-bookmark-btn.saved {
    font-size: 14px !important;
    padding: 0px 10px 0px 10px !important;
    color: #fff !important;
    background: #28a745 !important;
} 