/**
 * Publish Modal Styles
 * Standalone styles for the PublishModal component
 */

.publish-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.publish-modal {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    background: var(--drive-surface, #1a1a1a);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.publish-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--drive-border, #2a2a2a);
}

.publish-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--drive-text, #ffffff);
}

.publish-modal-title i {
    color: var(--drive-primary, #4a9eff);
}

.publish-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--drive-text-secondary, #888);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.publish-modal-close:hover {
    background: var(--drive-surface-hover, rgba(255, 255, 255, 0.1));
    color: var(--drive-text, #ffffff);
}

.publish-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.publish-preview {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px auto;
}

.publish-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.publish-preview i {
    font-size: 48px;
    color: var(--drive-text-secondary, #666);
}

.publish-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.publish-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.publish-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--drive-text-secondary, #888);
}

.publish-input {
    padding: 10px 14px;
    background: var(--drive-bg, #0f0f0f);
    border: 1px solid var(--drive-border, #333);
    border-radius: 8px;
    color: var(--drive-text, #ffffff);
    font-size: 14px;
}

.publish-input:focus {
    outline: none;
    border-color: var(--drive-primary, #4a9eff);
}

.publish-input::placeholder {
    color: var(--drive-text-secondary, #666);
}

.publish-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.publish-access-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.publish-radio {
    cursor: pointer;
}

.publish-radio input {
    display: none;
}

.publish-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--drive-bg, #0f0f0f);
    border: 1px solid var(--drive-border, #333);
    border-radius: 8px;
    font-size: 14px;
    color: var(--drive-text, #ffffff);
}

.publish-radio input:checked + .publish-radio-label {
    border-color: var(--drive-primary, #4a9eff);
    background: rgba(74, 158, 255, 0.1);
}

.publish-radio-label i {
    font-size: 14px;
    color: var(--drive-text-secondary, #888);
}

.publish-radio input:checked + .publish-radio-label i {
    color: var(--drive-primary, #4a9eff);
}

.publish-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--drive-text, #ffffff);
}

.publish-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--drive-primary, #4a9eff);
}

.publish-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--drive-border, #2a2a2a);
    background: var(--drive-surface, #1a1a1a);
}

.publish-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.publish-btn-secondary {
    background: transparent;
    color: var(--drive-text, #ffffff);
    border: 1px solid var(--drive-border, #333);
}

.publish-btn-secondary:hover {
    background: var(--drive-surface-hover, rgba(255, 255, 255, 0.1));
}

.publish-btn-primary {
    background: var(--drive-primary, #4a9eff);
    color: #ffffff;
}

.publish-btn-primary:hover:not(:disabled) {
    background: #3a8eef;
}

.publish-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tier Selection */
.publish-tier-selection {
    margin-top: 8px;
}

.publish-tiers {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.publish-tier-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--drive-bg, #0f0f0f);
    border: 1px solid var(--drive-border, #333);
    border-radius: 8px;
    cursor: pointer;
}

.publish-tier-checkbox:hover {
    border-color: var(--drive-border-hover, #444);
}

.publish-tier-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--drive-primary, #4a9eff);
}

.publish-tier-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
}

.publish-tier-name {
    font-size: 14px;
    color: var(--drive-text, #ffffff);
}

.publish-tier-price {
    font-size: 12px;
    color: var(--drive-text-secondary, #888);
}

.publish-no-tiers {
    font-size: 13px;
    color: var(--drive-text-secondary, #888);
    font-style: italic;
}

/* Media Set Preview */
.publish-preview-set {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--drive-bg, #0f0f0f);
    border-radius: 8px;
    margin-bottom: 16px;
}

.publish-preview-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--drive-text, #ffffff);
}

.publish-preview-label i {
    color: var(--drive-primary, #4a9eff);
}

.publish-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
}

.publish-preview-item {
    position: relative;
    aspect-ratio: 1;
    background: var(--drive-surface, #1a1a1a);
    border-radius: 6px;
    overflow: hidden;
}

.publish-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.publish-preview-item i.fa-file {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: var(--drive-text-secondary, #888);
}

.publish-preview-item.is-video::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
}

.publish-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #ffffff;
    z-index: 1;
}

.publish-preview-more {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    background: var(--drive-surface, #1a1a1a);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--drive-text-secondary, #888);
}

/* ===== File Selection Section ===== */
.publish-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.publish-section-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--drive-text-secondary, #888);
}

.publish-files-container {
    background: var(--drive-bg, #0f0f0f);
    border: 1px solid var(--drive-border, #333);
    border-radius: 8px;
    padding: 12px;
}

/* Empty state */
.publish-files-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    gap: 12px;
    color: var(--drive-text-secondary, #888);
}

.publish-files-empty i {
    font-size: 32px;
    opacity: 0.5;
}

.publish-files-empty p {
    margin: 0;
    font-size: 14px;
}

.publish-add-files-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--drive-primary, #4a9eff);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.publish-add-files-btn:hover {
    background: #3a8eef;
}

/* Files header */
.publish-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.publish-files-count {
    font-size: 13px;
    font-weight: 500;
    color: var(--drive-text, #fff);
}

.publish-edit-files-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: transparent;
    color: var(--drive-primary, #4a9eff);
    border: 1px solid var(--drive-primary, #4a9eff);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.publish-edit-files-btn:hover {
    background: rgba(74, 158, 255, 0.1);
}

/* Files grid */
.publish-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}

.publish-file-item {
    position: relative;
    aspect-ratio: 1;
    background: var(--drive-surface, #1a1a1a);
    border-radius: 6px;
    overflow: hidden;
    cursor: default;
}

.publish-file-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.publish-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.publish-file-thumb i {
    font-size: 24px;
    color: var(--drive-text-secondary, #666);
}

/* Video badge */
.publish-file-video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.publish-file-video-badge i {
    font-size: 10px;
    color: #fff;
    margin-left: 2px;
}

/* Remove button */
.publish-file-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
}

.publish-file-item:hover .publish-file-remove {
    opacity: 1;
}

.publish-file-remove i {
    font-size: 10px;
    color: #fff;
}

.publish-file-remove:hover {
    background: #e53935;
}

/* Order number */
.publish-file-order {
    position: absolute;
    bottom: 4px;
    left: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Drag handle */
.publish-file-drag-handle {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    cursor: grab;
}

.publish-file-drag-handle i {
    font-size: 10px;
    color: #fff;
}

.publish-file-item:hover .publish-file-drag-handle {
    opacity: 1;
}

/* Dragging states */
.publish-file-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.publish-file-item.drag-over {
    outline: 2px solid var(--drive-primary, #4a9eff);
    outline-offset: -2px;
}

/* Hint text */
.publish-files-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--drive-text-secondary, #666);
}

.publish-files-hint i {
    font-size: 11px;
}

/* Mobile */
@media (max-width: 600px) {
    .publish-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .publish-modal {
        max-width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
    }

    .publish-access-options {
        flex-direction: column;
    }

    .publish-radio-label {
        width: 100%;
    }

    .publish-modal-footer {
        flex-direction: column;
        gap: 10px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    }

    .publish-btn {
        width: 100%;
        justify-content: center;
    }

    .publish-files-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }

    .publish-file-remove,
    .publish-file-drag-handle {
        opacity: 1;
    }
}

/* Searchable Community Dropdown */
.community-search-dropdown {
    position: relative;
    width: 100%;
}

.community-search-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--drive-input-bg, #1a1a1a);
    border: 1px solid var(--drive-border, #333);
    border-radius: 6px;
    cursor: pointer;
    color: var(--drive-text, #fff);
    font-size: 14px;
}

.community-search-selected:hover {
    border-color: var(--drive-primary, #4a9eff);
}

.community-search-selected.open {
    border-color: var(--drive-primary, #4a9eff);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.community-search-selected i {
    color: var(--drive-text-secondary, #888);
    font-size: 12px;
}

.community-selected-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.community-search-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--drive-surface, #1e1e1e);
    border: 1px solid var(--drive-primary, #4a9eff);
    border-top: none;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    z-index: 100;
    max-height: 250px;
    display: flex;
    flex-direction: column;
}

.community-search-input-wrap {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--drive-border, #333);
    gap: 8px;
}

.community-search-input-wrap i {
    color: var(--drive-text-secondary, #888);
    font-size: 14px;
}

.community-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--drive-text, #fff);
    font-size: 14px;
    outline: none;
}

.community-search-input::placeholder {
    color: var(--drive-text-secondary, #666);
}

.community-search-list {
    overflow-y: auto;
    max-height: 200px;
}

.community-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--drive-text, #fff);
}

.community-search-item:hover {
    background: var(--drive-hover, #2a2a2a);
}

.community-search-item.selected {
    background: var(--drive-primary-dim, rgba(74, 158, 255, 0.15));
}

.community-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.community-item-posts {
    font-size: 12px;
    color: var(--drive-text-secondary, #888);
    margin-left: 12px;
    flex-shrink: 0;
}
