/* Post Editor & Media Library Styles */

/* Fullscreen Modal Override */
.modal-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-card);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.modal-fullscreen .card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-dark);
}

.modal-fullscreen-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    height: calc(100vh - 60px);
}

/* Post Editor Layout */
.post-editor-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.editor-main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    justify-content: center;
    background: var(--bg-main);
}

.editor-container {
    max-width: 800px;
    width: 100%;
}

.editor-sidebar {
    width: 320px;
    border-left: 1px solid var(--border);
    background: var(--bg-card);
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Form Elements */
.title-input {
    width: 100%;
    font-size: 2.5rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    margin-bottom: 1.5rem;
    padding: 0;
}

.title-input::placeholder {
    color: var(--text-muted);
}

.content-editor {
    min-height: 500px;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.content-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

.content-textarea {
    width: 100%;
    min-height: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1.8;
    resize: vertical;
    outline: none;
    padding: 1.5rem;
}

/* Sidebar Widgets */
.sidebar-widget {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.sidebar-widget h4 {
    margin: 0 0 1rem 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Featured Image */
.featured-image-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-card-hover);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    border: 1px dashed var(--border);
    margin-top: 0.5rem;
    position: relative;
    transition: all 0.2s;
}

.featured-image-preview:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.featured-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

/* Media Library */
.media-library-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 90vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    z-index: 1100;
    /* Above post editor */
    display: flex;
    flex-direction: column;
}

.media-library-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.5rem;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding-bottom: 2rem;
    flex: 1;
}

.media-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    background: var(--bg-main);
    transition: all 0.2s;
}

.media-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.media-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-alpha);
}

.media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s;
}

.media-item:hover .media-item-info {
    opacity: 1;
}

.media-upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--bg-main);
    transition: all 0.2s;
    margin-bottom: 1.5rem;
}

.media-upload-area:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

/* Categories & Tags */
.term-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--bg-main);
}

.term-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.term-item:hover {
    background: var(--bg-card-hover);
    border-radius: 4px;
}

.add-term-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tags-input-container {
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-badge {
    background: var(--primary-alpha);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.remove-tag {
    cursor: pointer;
    font-weight: bold;
}

.tag-input {
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    flex: 1;
    min-width: 60px;
}

/* Status Select */
.status-select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
}