/* Ensure story card uses the same cover-image placeholder as story page */
.story-card .cover-image {
    width: 175px;
    height: 262px;
    background: linear-gradient(to right, var(--accent-color), var(--accent-color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 48px;
}
.story-card .cover-image i {
    color: #fff !important;
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Placeholder styles for story cards */
.story-card-placeholder {
    background: var(--bg-primary);
    padding: 16px;
    display: flex;
    flex-direction: row;
    gap: 16px;
    cursor: default;
    opacity: 0.7;
    min-height: 250px;
    height: 250px;
    width: 100%;
    position: relative;
    /* Use .shadow-md class in HTML for drop shadow */
}
.story-card-placeholder .story-cover {
    width: 175px;
    height: 262px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.story-card-placeholder .story-cover-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #eee 25%, #e6e6e6 50%, #eee 75%);
    animation: story-card-skeleton 1.2s infinite ease-in-out;
}
.story-card-placeholder .story-content {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: stretch;
}
.story-card-placeholder .story-card-header,
.story-card-placeholder .story-badge-row,
.story-card-placeholder .story-title,
.story-card-placeholder .story-author,
.story-card-placeholder .story-word-count,
.story-card-placeholder .story-description {
    background: linear-gradient(90deg, #eee 25%, #e6e6e6 50%, #eee 75%);
    animation: story-card-skeleton 1.2s infinite ease-in-out;
    min-height: 16px;
    margin-bottom: 8px;
    color: transparent;
}
.story-card-placeholder .story-title {
    min-height: 24px;
    width: 60%;
    margin-bottom: 12px;
}
.story-card-placeholder .story-author {
    min-width: 80px;
    width: 30%;
}
.story-card-placeholder .story-word-count {
    min-width: 60px;
    width: 20%;
}
.story-card-placeholder .story-description {
    min-height: 48px;
    width: 90%;
}
.story-card-placeholder .placeholder-badge {
    width: 48px;
    height: 16px;
    margin-right: 8px;
    background: linear-gradient(90deg, #eee 25%, #e6e6e6 50%, #eee 75%);
    animation: story-card-skeleton 1.2s infinite ease-in-out;
}
.story-card-placeholder .placeholder-menu {
    width: 36px;
    height: 36px;
    background: linear-gradient(90deg, #eee 25%, #e6e6e6 50%, #eee 75%);
    animation: story-card-skeleton 1.2s infinite ease-in-out;
}
@keyframes story-card-skeleton {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: 200px 0;
    }
}
.unified-badge {
    display: inline-block;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--badge-draft-bg, #f7c873);
    color: var(--badge-draft-text, #7a4c00);
    border: 1px solid #f7c873;
    vertical-align: middle;
    letter-spacing: 0.02em;
    margin-right: 2px;
}
.unified-badge-draft {
    background: var(--badge-draft-bg, #f7c873);
    color: var(--badge-draft-text, #7a4c00);
    border: 1px solid #f7c873;
}
/* Story Card Component Styles */

.story-card {
    background: var(--bg-primary);
    padding: 16px;
    display: flex;
    flex-direction: row;
    gap: 16px;
    transition: transform 0.2s;
    cursor: pointer;
    overflow: hidden;
    height: 250px;
    width: 100%;
    /* Use .shadow-md class in HTML for drop shadow */
}

.story-card:hover {
    transform: translateY(-2px);
}

.story-card .story-cover {
    width: 175px;
    height: 262px;
    flex-shrink: 0;
    overflow: hidden;
}

.story-card .story-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-card .story-placeholder {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border: 2px dashed rgba(233, 119, 117, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.5rem;
}

.story-card > .d-flex.flex-row.gap-3 {
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: stretch;
    flex: 1 1 0%;
    min-width: 0;
}

.story-card .story-content {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: stretch;
}

.story-card .story-card-header,
.story-card .story-badge-row,
.story-card .story-title,
.story-card .story-author,
.story-card .story-stats,
.story-card .story-description,
.story-card .story-tags,
.story-card .story-meta {
    width: 100%;
    box-sizing: border-box;
}

.story-card .story-title {
    font-size: 1.15rem;
    color: var(--accent-color);
    font-weight: 600;
    line-height: 1.1;
    margin-top: 0.25rem;
}

.story-card-header {
    min-height: 32px;
}

.story-badge-row {
    min-height: 28px;
    margin-bottom: 0;
}

.story-card .story-author {
    font-size: 0.9rem;
    color: var(--accent-color);
    margin: 0;
    font-weight: 500;
}

.story-card .story-author-link,
.story-card .story-author-link:visited {
    color: var(--accent-color);
    text-decoration: none;
}

.story-card .story-author-link:hover,
.story-card .story-author-link:focus-visible {
    color: var(--accent-color);
    text-decoration: underline;
}

.story-card .story-collection {
    margin: 0 0 0.35rem 0;
    font-size: 0.85rem;
}

.story-card .story-collection-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-color);
    text-decoration: none;
}

.story-card .story-collection-link:hover,
.story-card .story-collection-link:focus-visible {
    color: var(--accent-color);
    text-decoration: underline;
}

.story-card .story-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 4.8em; /* ~3 lines, adjust as needed */
    max-height: 4.8em; /* ~3 lines, adjust as needed */
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    line-clamp: unset;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    word-break: break-word;
    hyphens: auto;
}

.story-card .story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0;
    white-space: normal;
    overflow-x: auto;
    overflow-y: auto;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    max-height: 1.6em; /* ~1 row, adjust as needed */
    position: relative;
}

/* Gradient fade for scrollable tags */
.story-card .story-tags::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 12px;
    pointer-events: none;
    background: linear-gradient(to top, var(--bg-primary, #fff) 60%, transparent 100%);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s;
}
.story-card .story-tags.scrollable::after {
    opacity: 1;
}

.story-card .story-tag {
    background: rgba(233, 119, 117, 0.1);
    color: var(--accent-color);
    font-size: 0.7rem;
    padding: 2px 6px;
    border: 1px solid rgba(233, 119, 117, 0.3);
    font-weight: 500;
    white-space: nowrap;
}

.story-card .story-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(233, 119, 117, 0.1);
}

.story-card .story-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.story-card .story-stats {
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 500;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.story-card .story-tags::-webkit-scrollbar {
    height: 8px;
    width: 8px;
    background: transparent !important;
}

.story-card .story-tags::-webkit-scrollbar-thumb {
    background: var(--accent-color, #e97775);
}

.story-card .story-tags::-webkit-scrollbar-track {
    background: transparent !important;
}

.story-card .story-tags::-webkit-scrollbar-corner {
    background: transparent !important;
}

.story-card .story-likes-views {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 500;
    display: flex;
    gap: 16px;
    align-items: center;
}
.story-card .story-likes-views .likes,
.story-card .story-likes-views .views,
.story-card .story-likes-views .words {
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Story Card Three Dots Menu Styling (reuse profile style) */
.story-card .dropdown.ms-2 {
    position: relative;
}
.story-card .dropdown.ms-2 .btn {
    background: transparent !important;
    color: var(--text-primary) !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    transition: background 0.2s, color 0.2s, border 0.2s;
}
.story-card .dropdown.ms-2 .btn:hover,
.story-card .dropdown.ms-2 .btn:focus {
    background: var(--accent-color) !important;
    color: var(--text-primary) !important;
    border: none !important;
}
.story-card .dropdown.ms-2 .btn i {
    color: var(--text-primary) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    font-size: 1.2rem !important;
}
.story-card .dropdown-menu {
    min-width: 180px;
    background: var(--bg-secondary);
    padding: 0px;
    margin-top: 8px;
    z-index: 1000;
}
.story-card .dropdown-menu .dropdown-item {
    color: var(--text-primary);
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    background: none;
    transition: background 0.2s, color 0.2s;
}
.story-card .dropdown-menu .dropdown-item:hover,
.story-card .dropdown-menu .dropdown-item:focus {
    background: rgba(233, 119, 117, 0.08);
    color: var(--accent-color);
}
.story-card .dropdown-menu .dropdown-item.text-danger {
    color: var(--accent-color);
}

@media (max-width: 600px) {
  .story-card .story-cover {
    width: 80px;
    height: 120px;
  }
}
