/*
Theme Name: MTVDB WP
Author: Your Name
Description: A companion theme for The Cinematheque plugin, designed to create a modern, community-focused media database.
Version: 2.0.0
*/

:root {
    --color-page: #000000;
    --color-surface: #121212;
    --color-primary: #ff8c00;
    --color-text-primary: #ffffff;
    --color-text-secondary: #a0a0a0;
    --color-border: #2d2d2d;
}

html.theme-light {
    --color-page: #FFFFFF;
    --color-surface: #ffffff;
    --color-primary: #f59e0b;
    --color-text-primary: #1e293b;
    --color-text-secondary: #64748b;
    --color-border: #e2e8f0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-page);
    color: var(--color-text-primary);
}

/* Component Styles */
.bg-page { background-color: var(--color-page); }
.bg-surface { background-color: var(--color-surface); }
.bg-primary { background-color: var(--color-primary); }
.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.border-custom { border-color: var(--color-border); }
.hover\\:bg-primary\\/20:hover { background-color: color-mix(in srgb, var(--color-primary) 20%, transparent); }

/* Link Actions Styles */
.link-save-btn.is-saved,
.link-follow-btn.is-following {
    color: var(--color-primary);
}

.link-save-btn.is-saved i,
.link-follow-btn.is-following i {
    fill: currentColor;
}

.link-actions-dropdown {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.link-actions-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
}

.link-actions-menu {
    display: none;
}

.link-actions-menu:not(.hidden) {
    display: block;
}

article.hidden-by-user {
    display: none !important;
}

/* Blur effect for NSFW and Spoiler post images */
.blur-sm {
    filter: blur(8px);
    -webkit-filter: blur(8px);
}

/* Most Loved Celebrity Widget Styles */
.most-loved-celebrity-widget {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.most-loved-celebrity-widget * {
    box-sizing: border-box;
}

.most-loved-celebrity-widget .flex.items-end {
    align-items: flex-end;
    width: 100%;
    max-width: 100%;
}

.most-loved-celebrity-widget img {
    transition: transform 0.2s ease;
    max-width: 100%;
    height: auto;
    display: block;
}

.most-loved-celebrity-widget a:hover img {
    transform: scale(1.05);
}

.most-loved-celebrity-widget .fa-crown {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    display: inline-block;
}

/* Ensure all text elements are responsive */
.most-loved-celebrity-widget p,
.most-loved-celebrity-widget span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Make sure flex items don't overflow */
.most-loved-celebrity-widget > div > div {
    min-width: 0;
    max-width: 100%;
}

/* Link Actions Modals */
.cinematheque-modal {
    backdrop-filter: blur(4px);
}

.cinematheque-modal .modal-content {
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.link-actions-modal-close {
    cursor: pointer;
    transition: color 0.2s;
}

.link-actions-modal-close:hover {
    color: var(--color-primary);
}

.link-actions-confirm-ok,
.link-actions-report-submit,
.link-actions-alert-ok {
    transition: opacity 0.2s;
}

.link-actions-confirm-ok:hover,
.link-actions-report-submit:hover,
.link-actions-alert-ok:hover {
    opacity: 0.9;
}

.link-actions-confirm-cancel,
.link-actions-report-cancel {
    transition: background-color 0.2s;
}


/* Custom Speech Bubble for Reviews */
.speech-bubble {
    position: relative;
    background: #000000b8;
    border-radius: .4em;
    padding: 0.5rem;
}
.speech-bubble:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top-color: #000000b8;
    border-bottom: 0;
    border-left: 0;
    margin-left: -5px;
    margin-bottom: -10px;
}

/* Carousel scrollbar hiding */
.carousel-container::-webkit-scrollbar {
    display: none;
}
.carousel-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Base fallback (for browsers that don’t support color-mix) */
.slider-gradient {
  pointer-events: none;
}

/* DARK THEME */
html:not(.theme-light) .slider-gradient {
  background: linear-gradient(
    to top,
    var(--color-page) 0%,
    color-mix(in oklab, var(--color-page) 50%, transparent) 30%,
    transparent 100%
  );
}

/* LIGHT THEME */
html.theme-light .slider-gradient {
  background: linear-gradient(
    to top,
    var(--color-page) 0%,
    color-mix(in oklab, var(--color-page) 50%, transparent) 30%,
    transparent 100%
  );
}

.archivemenu {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background-color: rgb(54 60 72 / 12%);
    border-bottom: 1px solid hsl(0deg 53% 4% / 71%);
    border-radius: 6px;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Visual Selection Indicators --- */
.content-type-btn,
.visibility-option-btn {
    @apply border border-gray-300 rounded-xl p-3 cursor-pointer transition-all duration-200;
}

.content-type-btn:hover,
.visibility-option-btn:hover {
    @apply border-gray-400 bg-gray-50;
}

.content-type-btn.selected,
.visibility-option-btn.selected {
    @apply border-blue-500 bg-blue-50 ring-2 ring-blue-200;
}

/* Chat/Messaging Widget Styles */
.cinematheque-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cinematheque-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.cinematheque-chat-toggle .unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.cinematheque-chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cinematheque-chat-widget.hidden {
    display: none;
}

.cinematheque-chat-widget.minimized {
    height: 50px;
    overflow: hidden;
}

.chat-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 16px;
}

.chat-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.chat-actions button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.chat-actions button:hover {
    background-color: var(--color-border);
    color: var(--color-text-primary);
}

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversations-list.hidden {
    display: none;
}

.conversations-header {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
}

.conversations-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
}

.conversations-items {
    padding: 8px 0;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 12px;
    margin-bottom: 4px;
}

.conversation-item:hover {
    background-color: var(--color-border);
}

.conv-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.conv-info {
    flex: 1;
    min-width: 0;
}

.conv-name {
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.conv-unread-badge {
    background-color: var(--color-primary);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

.conv-preview {
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.conv-time {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

.conv-mark-unread-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s, background-color 0.2s;
}

.conv-mark-unread-btn:hover {
    opacity: 1;
    background-color: var(--color-border);
    color: var(--color-text-primary);
}

.conversation-item:hover .conv-mark-unread-btn {
    opacity: 0.8;
}

.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-view.hidden {
    display: none;
}

.chat-view-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    gap: 12px;
    background-color: var(--color-surface);
}

.chat-back-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.chat-back-btn:hover {
    background-color: var(--color-border);
    color: var(--color-text-primary);
}

.chat-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-user-name {
    font-weight: 600;
    color: var(--color-text-primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    max-width: 75%;
}

.message-own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-other {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-own .message-content {
    align-items: flex-end;
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.message-text {
    padding: 8px 12px;
    border-radius: 12px;
    background-color: var(--color-border);
    color: var(--color-text-primary);
    word-wrap: break-word;
}

.message-own .message-text {
    background-color: var(--color-primary);
    color: white;
}

.message-time {
    font-size: 11px;
    color: var(--color-text-secondary);
    padding: 0 4px;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-surface);
}

#chat-message-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background-color: var(--color-page);
    color: var(--color-text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 120px;
}

#chat-message-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.send-btn {
    padding: 8px 16px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: opacity 0.2s;
}

.send-btn:hover {
    opacity: 0.9;
}

.loading-conversations,
.empty-state,
.error {
    padding: 24px;
    text-align: center;
    color: var(--color-text-secondary);
}

/* Hide floating chat button when widget is open */
.cinematheque-chat-widget:not(.hidden) ~ .cinematheque-chat-toggle {
    display: none;
}

@media (max-width: 640px) {
    .cinematheque-chat-widget {
        right: 10px;
        bottom: 80px;
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
    }
}

/* Nested Comments Styling */
.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-list ol,
.comment-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-item {
    margin-bottom: 0.25rem;
    position: relative;
}

.comment-body {
    background-color: transparent;
    border: none;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
    margin-left: 0.75rem; /* Space for collapse button */
}

.comment-wrapper {
    display: flex;
    gap: 0.5rem;
    position: relative;
}

/* Collapse button on the left edge */
.comment-collapse-btn {
    position: absolute;
    left: -0.5rem;
    top: 0.25rem;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    padding: 0;
    transition: all 0.2s ease;
    flex-shrink: 0;
    pointer-events: auto;
}

.comment-collapse-btn:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.comment-collapse-btn:hover i {
    color: white;
}

.comment-collapse-btn i {
    color: var(--color-text-primary);
    width: 1rem;
    height: 1rem;
}

.comment-item.collapsed .comment-icon-minus {
    display: none !important;
}

.comment-item.collapsed .comment-icon-plus {
    display: block !important;
}

.comment-item:not(.collapsed) .comment-icon-plus {
    display: none !important;
}

.comment-item:not(.collapsed) .comment-icon-minus {
    display: block !important;
}

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

.comment-header-section {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.comment-author-avatar {
    flex-shrink: 0;
}

.comment-author-avatar img {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
}

.comment-meta-section {
    flex: 1;
    min-width: 0;
}

.comment-author-info {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.comment-author-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

.comment-author-name a {
    color: inherit;
    text-decoration: none;
}

.comment-author-name a:hover {
    text-decoration: underline;
}

.comment-timestamp {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.comment-text-content {
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
    line-height: 1.4;
    word-wrap: break-word;
    font-size: 0.875rem;
}

.comment-text-content p {
    margin-bottom: 0.25rem;
}

.comment-text-content p:last-child {
    margin-bottom: 0;
}

.comment-image,
.comment-gif {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.comment-image img,
.comment-gif img {
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
    display: block;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.25rem;
    border-top: none;
}

.comment-action-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.comment-action-btn:hover:not(:disabled) {
    background-color: var(--color-primary);
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
}

.comment-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.comment-action-btn i {
    width: 1rem;
    height: 1rem;
}

/* Nested comments with vertical line */
.comment-item .children {
    margin-left: 0;
    padding-left: 1rem;
    border-left: 1px solid var(--color-border);
    margin-top: 0.25rem;
    position: relative;
}

.comment-item .children::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--color-border);
}

/* Ensure nested comments are properly indented */
.comment-list .comment-list {
    margin-left: 0;
    padding-left: 1rem;
    border-left: 1px solid var(--color-border);
}

/* Inline reply form styling */
.comment-inline-reply-form {
    margin-top: 0.5rem;
    margin-left: 0.75rem;
    padding-left: 1rem;
    border-left: 1px solid var(--color-border);
}

.comment-inline-reply-form .bg-surface {
    background-color: transparent;
    border: none;
    padding: 0.5rem 0;
}

.comment-inline-reply-form #comment-form-expanded {
    border-top: none;
}

.comment-inline-reply-form .p-6 {
    padding: 0.5rem 0;
}

