/* EWA Post Manager Styles */
.ewa-post-manager {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
}

/* Filter Controls */
.ewa-filter-controls {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.ewa-filter-controls h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.ewa-filter-group {
    display: inline-block;
    margin-right: 20px;
    margin-bottom: 10px;
    vertical-align: top;
}

.ewa-filter-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.ewa-filter-group input[type="text"],
.ewa-filter-group select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    min-width: 150px;
}

.ewa-filter-button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    margin-top: 10px;
}

.ewa-filter-button:hover {
    background: #005a87;
}

/* Bulk Actions */
.ewa-bulk-actions {
    background: #e8f4f8;
    border: 1px solid #bee5eb;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.ewa-bulk-actions h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.ewa-bulk-controls {
    margin-bottom: 15px;
}

.ewa-bulk-controls select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 10px;
    font-size: 14px;
    min-width: 200px;
}

.ewa-bulk-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
}

.ewa-bulk-button:hover {
    background: #218838;
}

.ewa-bulk-button.ewa-bulk-remove {
    background: #dc3545;
}

.ewa-bulk-button.ewa-bulk-remove:hover {
    background: #c82333;
}

.ewa-select-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 10px;
}

.ewa-select-button:hover {
    background: #5a6268;
}

/* Posts Container */
.ewa-posts-container {
    margin-bottom: 30px;
}

.ewa-post-item {
    display: flex;
    border: 1px solid #ddd;
    margin-bottom: 15px;
    border-radius: 5px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ewa-post-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Checkbox column */
.ewa-post-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    background: #f8f9fa;
    border-right: 1px solid #ddd;
}

.ewa-post-select {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Post content */
.ewa-post-content {
    flex: 1;
    padding: 20px;
}

.ewa-post-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.ewa-post-thumb {
    width: 80px;
    height: 80px;
    margin-right: 15px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.ewa-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ewa-post-thumb.ewa-no-thumb {
    background: #f0f0f0;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
    text-align: center;
}

.ewa-post-info {
    flex: 1;
}

.ewa-post-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
    font-weight: bold;
}

.ewa-post-meta {
    color: #666;
    font-size: 13px;
}

.ewa-post-meta span {
    margin-right: 15px;
}

/* Categories Section */
.ewa-categories-section {
    margin-bottom: 15px;
}

.ewa-category-group {
    margin-bottom: 15px;
}

.ewa-category-label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #444;
    font-size: 14px;
}

.ewa-category-count {
    font-weight: normal;
    color: #666;
    font-size: 12px;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
}

.ewa-category-display {
    margin-bottom: 5px;
}

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

.ewa-app-category-tag {
    display: inline-block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 6px 30px 6px 12px; /* Increased right padding for button space */
    border-radius: 4px;
    font-size: 13px;
    margin-right: 8px;
    margin-bottom: 6px;
    position: relative;
    vertical-align: top;
    min-width: 60px; /* Ensure minimum width */
    box-sizing: border-box;
}

.ewa-app-category-tag .category-name {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 0; /* Remove extra padding since parent has it */
    margin-right: 0;
}

.ewa-remove-category {
    position: absolute !important;
    right: 6px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    color: #721c24 !important;
    font-size: 14px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    width: 18px !important;
    height: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.2s !important;
    line-height: 1 !important;
    z-index: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    user-select: none !important;
}

.ewa-remove-category:hover {
    background: rgba(114, 28, 36, 0.1) !important;
    color: #721c24 !important;
    transform: translateY(-50%) scale(1.1) !important;
    border: none !important;
}

.ewa-remove-category:focus {
    outline: 2px solid #721c24 !important;
    outline-offset: 2px !important;
    background: rgba(114, 28, 36, 0.1) !important;
    border: none !important;
}

.ewa-no-categories,
.ewa-no-app-categories {
    color: #999;
    font-style: italic;
    font-size: 13px;
}

.ewa-app-categories-container {
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px;
    background: #f8f9fa;
}

.ewa-current-app-categories {
    margin-bottom: 12px;
    min-height: 25px;
}

.ewa-app-category-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ewa-app-category-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    max-width: 250px;
}

.ewa-add-category-button {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.ewa-add-category-button:hover {
    background: #138496;
}

.ewa-add-category-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Post Actions */
.ewa-post-actions {
    display: flex;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.ewa-edit-link,
.ewa-view-link {
    display: inline-block;
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.ewa-edit-link {
    background: #ffc107;
    color: #212529;
}

.ewa-edit-link:hover {
    background: #e0a800;
    color: #212529;
}

.ewa-view-link {
    background: #6c757d;
    color: white;
}

.ewa-view-link:hover {
    background: #5a6268;
    color: white;
}

/* Pagination */
.ewa-pagination {
    text-align: center;
    margin-top: 30px;
}

.ewa-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    background: white;
    border: 1px solid #ddd;
    color: #0073aa;
    text-decoration: none;
    border-radius: 4px;
}

.ewa-pagination .page-numbers:hover {
    background: #0073aa;
    color: white;
}

.ewa-pagination .page-numbers.current {
    background: #0073aa;
    color: white;
}

/* No Posts Message */
.ewa-no-posts {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    color: #6c757d;
    font-size: 16px;
}

/* Loading states */
.ewa-loading {
    opacity: 0.6;
    pointer-events: none;
}

.ewa-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success/Error messages */
.ewa-message {
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-weight: bold;
}

.ewa-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ewa-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive design */
@media (max-width: 768px) {
    .ewa-post-item {
        flex-direction: column;
    }
    
    .ewa-post-checkbox {
        width: 100%;
        height: 40px;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    
    .ewa-post-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .ewa-post-thumb {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .ewa-filter-group {
        display: block;
        margin-bottom: 15px;
    }
    
    .ewa-bulk-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .ewa-bulk-controls select {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
}