/* ==========================================================================
   MediaTasker Task Detail Modal (Classic WordPress Style Adaptation)
   ========================================================================== */

.mediat_viewer-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    border: none;
    padding: 10px;
    margin: 0;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.mediat_viewer-modal[open] {
    opacity: 1;
    visibility: visible;
}

.mediat_viewer-layout {
    background: white;
    border-radius: 12px;
    max-width: 100vw;
    max-height: 100vh;
    height: 100%;
    position: relative;
    display: grid;
    grid-template-columns: 2fr 1fr;
    overflow: hidden;
}

/* Main Content Area */
.mediat_viewer-main {
    background: #f8f9fa;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    min-width: 0;
}

/* Header & Close Button */
.mediat_viewer-header {
    pointer-events: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: auto;
    z-index: 10;
}

.mediat_viewer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #333;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
}

.mediat_viewer-close:hover {
    background: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mediat_viewer-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 0;
    min-width: 0;
}

.mediat_asset-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
}

.mediat_asset-preview {
    max-width: 100%;
    max-height: 100% !important;
    /* Force constraint */
    width: 100%;
    height: auto;
    object-fit: contain;
    transform-origin: center;
    transition: transform 0.3s;
    cursor: grab;
    display: block;
    /* Remove baseline gap */
}

.mediat_asset-preview:active {
    cursor: grabbing;
}

/* Nav Buttons */
.mediat_nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mediat_nav-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mediat_nav-btn.nav-prev {
    left: 16px;
}

.mediat_nav-btn.nav-next {
    right: 16px;
}

.mediat_nav-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #333;
}

/* Viewer Footer / Toolbar */
.mediat_viewer-footer {
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
}

.mediat_footer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mediat_entity-actions {
    display: flex;
    gap: 8px;
    background: #f8f9fa;
    padding: 6px;
    border-radius: 8px;
}

.tool-btn {
    background: white;
    border: 1px solid #eee;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #666;
    position: relative;
}

.tool-btn:hover {
    background: #f0f4f8;
    border-color: #ddd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}



.tool-btn.action-dl:hover {
    color: #2196f3;
}

.tool-btn.action-rm:hover {
    color: #dc3232;
}

/* Tooltips */
.tool-btn::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10;
}

.tool-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Status Controls */
.mediat_modal-status-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mediat_modal-status-buttons {
    display: flex;
    gap: 8px;
}

.mediat_modal-status-btn {
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px;
    white-space: nowrap;
}

.mediat_modal-status-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.mediat_modal-status-btn.pending {
    background: #dc3545;
}

.mediat_modal-status-btn.pending:hover,
.mediat_modal-status-btn.pending.is-active {
    background: #c82333;
}

.mediat_modal-status-btn.in-progress {
    background: #ffc107;
    color: #000;
}

.mediat_modal-status-btn.in-progress:hover,
.mediat_modal-status-btn.in-progress.is-active {
    background: #e0a800;
}

.mediat_modal-status-btn.completed {
    background: #28a745;
}

.mediat_modal-status-btn.completed:hover,
.mediat_modal-status-btn.completed.is-active {
    background: #218838;
}

.mediat_modal-current-status {
    font-size: 13px;
    color: #666;
    padding: 4px 8px;
    border-radius: 6px;
    background: #f5f5f5;
    text-transform: capitalize;
}



/* Sidebar */
.mediat_viewer-sidebar {
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mediat_sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: scroll;
}

.mediat_asset-title {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    white-space: pre-line;
    word-wrap: break-word;
    text-overflow: ellipsis;
}



.mediat_sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

.mediat_sidebar-body::-webkit-scrollbar {
    width: 4px;
}

.mediat_sidebar-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.mediat_sidebar-body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}



/* Discussion Section */
.mediat_discussion-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.mediat_section-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mediat_section-title .dashicons {
    display: none;
}

.mediat_viewer-modal .mediat_thread-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    max-height: 100%;
    min-height: 0;
}

.mediat_viewer-modal .mediat_thread-list::-webkit-scrollbar {
    width: 4px;
}

.mediat_viewer-modal .mediat_thread-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.mediat_viewer-modal .mediat_thread-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

/* Comments */
.mediat_viewer-modal .mediat_thread-item {
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mediat_viewer-modal .mediat_thread-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mediat_viewer-modal .mediat_thread-author {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    margin: 0;
}

.mediat_viewer-modal .mediat_thread-meta span {
    color: #666;
    font-size: 12px !important;
}

.mediat_viewer-modal .mediat_thread-text {
    color: #444;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.mediat_viewer-modal .mediat_thread-text p {
    margin: 0;
}

.mediat_viewer-modal .mediat_thread-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mediat_viewer-modal .mediat_thread-item:hover .mediat_thread-actions {
    opacity: 1;
}

.mediat_viewer-modal .mediat_thread-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mediat_viewer-modal .mediat_edit-comment:hover {
    color: #0073aa;
    background: rgba(0, 115, 170, 0.1);
}

.mediat_viewer-modal .mediat_delete-comment:hover {
    color: #dc3232;
    background: rgba(220, 50, 50, 0.1);
}

.mediat_viewer-modal .mediat_thread-form {
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

.mediat_viewer-modal .mediat_thread-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    resize: vertical;
    transition: all 0.2s ease;
    background: white;
}

.mediat_viewer-modal .mediat_thread-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.mediat_viewer-modal .mediat_thread-submit {
    background: #2196f3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mediat_viewer-modal .mediat_thread-submit:hover {
    background: #1e88e5;
    transform: translateY(-1px);
}

@media (max-width: 1024px) {
    .mediat_viewer-layout {
        grid-template-columns: 1fr !important;
        width: 95vw;
        height: 95vh;
    }

    .mediat_viewer-main,
    .mediat_sidebar-body {
        height: auto;
    }

    .mediat_viewer-sidebar {
        border-left: none;
        border-top: 1px solid #eee;
        max-height: 40vh;
    }
}
