/**
 * Related Posts Block - Frontend Styles
 */

.qm-related-posts-block {
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.qm-related-posts-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.qm-related-posts-title {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.qm-related-posts-context {
    margin: 0;
}

.qm-related-posts-context small {
    color: var(--qm-text-muted, #666);
    font-size: 12px;
}

/* List Style (Default) */
.qm-related-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.qm-list-item {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.qm-list-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.qm-list-item h5 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 500;
}

.qm-list-item a {
    color: var(--qm-accent-color, #007cba);
    text-decoration: none;
    transition: color 0.2s ease;
}

.qm-list-item a:hover {
    color: #005a8b;
    text-decoration: underline;
}

.qm-post-date {
    font-size: 12px;
    color: var(--qm-text-muted, #666);
    margin: 3px 0;
}

.qm-post-excerpt {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    margin: 5px 0;
}

.qm-post-context {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

/* Grid Style */
.qm-related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.qm-grid-item {
    padding: 15px;
    background: rgba(255,255,255,0.7);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
}

.qm-grid-item h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 500;
}

.qm-grid-item a {
    color: var(--qm-accent-color, #007cba);
    text-decoration: none;
}

.qm-grid-item a:hover {
    text-decoration: underline;
}

/* Compact Style */
.qm-related-posts-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qm-compact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255,255,255,0.7);
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.05);
}

.qm-compact-link {
    color: var(--qm-accent-color, #007cba);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.qm-compact-link:hover {
    text-decoration: underline;
}

.qm-compact-date {
    font-size: 11px;
    color: var(--qm-text-muted, #666);
    margin-left: 10px;
}

/* Footer */
.qm-related-posts-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0,0,0,0.1);
    text-align: center;
}

.qm-view-all-link {
    color: var(--qm-accent-color, #007cba);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.qm-view-all-link:hover {
    text-decoration: underline;
}

/* Alignment Support */
.qm-related-posts-block.alignleft {
    float: left;
    margin-right: 20px;
    max-width: 300px;
}

.qm-related-posts-block.alignright {
    float: right;
    margin-left: 20px;
    max-width: 300px;
}

.qm-related-posts-block.aligncenter {
    margin-left: auto;
    margin-right: auto;
    max-width: 600px;
}

.qm-related-posts-block.alignwide {
    max-width: 1200px;
}

.qm-related-posts-block.alignfull {
    max-width: none;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Error/Empty States */
.qm-related-posts-error,
.qm-related-posts-empty {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .qm-related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .qm-related-posts-block.alignleft,
    .qm-related-posts-block.alignright {
        float: none;
        margin: 20px 0;
        max-width: none;
    }
    
    .qm-compact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .qm-compact-date {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .qm-related-posts-block {
        padding: 15px;
        margin: 15px 0;
    }
    
    .qm-related-posts-title {
        font-size: 16px;
    }
}