/* ========================================
   Posts - List, Detail, Voting, Tags
   ======================================== */

/* Posts */
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 18px 14px 0px;
    display: flex;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    border-left: none;
    transition: all 0.15s ease;
    overflow: hidden;
}

.post-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--border);
}

/* Combined vote + type icon column */
.post-vote-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    width: 36px;
    flex-shrink: 0;
    align-self: stretch;
    margin: -14px 4px -14px 0;
    padding: 12px 0;
    background: var(--border-light);
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--text-muted);
}

.post-vote-icon .vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    opacity: 0.7;
}

.post-vote-icon .vote-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.post-vote-icon .vote-btn.active {
    opacity: 1;
}

.post-vote-icon .vote-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.post-vote-icon .score {
    font-weight: 700;
    font-size: 13px;
    color: inherit;
    opacity: 0.9;
}

.post-vote-icon .type-icon {
    margin-top: auto;
    opacity: 0.5;
}

.post-vote-icon .type-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Board color variants for post-vote-icon */
.post-vote-icon[class*="board-color-"] {
    color: #374151;
}

/* Sort and View Controls */
.sort-and-create {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

div.sort-and-create {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
}

.sort-and-create .sort-links {
    margin-bottom: 0;
}

.sort-and-create a {
    white-space: nowrap;
}

/* Image Grid */
.post-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.post-grid-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    transition: all 0.2s ease;
}

.post-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.post-grid-image {
    display: block;
    width: 100%;
    height: 100%;
}

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

.post-grid-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 50px 12px 12px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.post-grid-item:hover .post-grid-overlay {
    opacity: 1;
}

.post-grid-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.grid-vote-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: #fff;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-vote-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.grid-vote-btn.voted {
    background: var(--primary);
}

.grid-vote-score {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

.post-grid-info {
    display: block;
    flex: 1;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.post-grid-info:hover .post-grid-title {
    text-decoration: underline;
}

.post-grid-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-grid-meta {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

.post-grid-meta a {
    color: rgba(255,255,255,0.9);
}

.post-grid-meta a:hover {
    color: #fff;
    text-decoration: underline;
}

.grid-empty {
    grid-column: 1 / -1;
}

/* Post Vote (detail page) */
.post-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 40px;
}

.post-vote .vote-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 2px 8px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.post-vote .vote-btn:hover {
    background: var(--border-light);
    color: var(--primary);
}

.post-vote .vote-btn.active {
    color: var(--primary);
}

.post-vote .vote-btn.active.upvote {
    color: var(--accent);
}

.post-vote .vote-btn.active.downvote {
    color: var(--danger);
}

.post-vote .score {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

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

.post-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}

.post-title a {
    color: var(--text);
}

.post-title a:hover {
    color: var(--primary);
}

.post-domain {
    font-size: 13px;
    color: var(--text-light);
    margin-left: 8px;
}

.post-meta {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.post-meta a {
    color: var(--text-muted);
}

.post-meta a:hover {
    color: var(--primary);
}

.post-meta span {
    color: var(--text-light);
}

.comment-count {
    font-weight: 600;
}

/* Post Tags */
.post-tags {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--border-light);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}

[data-theme="dark"] .post-tag {
    background: var(--border);
}

.post-tag:hover {
    background: var(--primary-light);
    color: #fff;
}

.post-tag.active {
    background: var(--primary);
    color: #fff;
}

/* Post Labels (board-specific categorization) */
.post-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #fff;
    background: var(--label-color);
    opacity: 0.85;
    margin-right: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.post-label-sm {
    font-size: 11px;
    padding: 1px 6px;
    margin-right: 4px;
}

/* Labels in post title context */
.post-title .post-label {
    position: relative;
    top: -1px;
}

.post-grid-title .post-label {
    display: block;
    width: fit-content;
    margin-bottom: 4px;
}

.post-video-title .post-label {
    margin-right: 8px;
}

/* Post Detail */
.post-detail {
    margin-bottom: 24px;
}

.post-detail .post-item {
    padding: 0px 20px 20px 20px;
    border-left: 1px solid var(--border-light);
}

.post-detail .post-title {
    font-size: 24px;
    margin-bottom: 12px;
}

.post-detail .post-title a {
    color: var(--primary);
}

.post-body {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text);
    line-height: 1.7;
}

/* Post Author Avatar */
.post-author-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 2px;
}

/* Sticky Posts */
.post-item.sticky {
    background: var(--border-light);
}

.post-item.sticky .post-vote-icon {
    background: var(--accent);
    color: #fff;
}

.sticky-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sticky-indicator svg {
    width: 14px;
    height: 14px;
}

/* Sticky option in create/edit forms */
.sticky-option {
    background: var(--border-light);
    border-radius: var(--radius);
    padding: 8px 12px 0px 12px;
    margin-top: 8px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
}

.pin-icon {
    color: var(--text-muted);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-text .pin-icon {
    color: var(--accent);
}

.sticky-option .help-text {
    margin: 8px 0 0 28px;
    font-size: 13px;
}

/* Sticky post in grid view */
.post-grid-item.sticky {
    border: 2px solid var(--accent);
}

.post-grid-item.sticky::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    z-index: 10;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='12' y1='17' x2='12' y2='22'%3E%3C/line%3E%3Cpath d='M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}
