/**
 * Joyn TV Show - Manager Styles
 * 프론트엔드 관리 인터페이스
 */

/* ========================================
   Manager Base
   ======================================== */
.jts-manager {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    border-radius: 12px;
    padding: 24px;
    position: relative;
}

/* Header */
.jts-manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.jts-manager-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.jts-manager-title i {
    color: #3b82f6;
}

.jts-manager-actions {
    display: flex;
    gap: 10px;
}

/* ========================================
   Buttons
   ======================================== */
.jts-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.jts-btn-primary {
    background: #3b82f6;
    color: #fff;
}

.jts-btn-primary:hover {
    background: #2563eb;
}

.jts-btn-outline {
    background: transparent;
    border: 1px solid #3d3d3d;
    color: #fff;
}

.jts-btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #555;
}

.jts-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

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

.jts-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
}

.jts-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.jts-btn-icon.jts-delete-parent:hover,
.jts-btn-icon.jts-delete-child:hover,
.jts-btn-icon.jts-delete-video:hover {
    color: #ef4444;
}

/* ========================================
   Tabs
   ======================================== */
.jts-manager-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid #2d2d2d;
    padding-bottom: 8px;
}

.jts-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px 8px 0 0;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.jts-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.jts-tab-btn.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.jts-tab-content {
    display: none;
}

.jts-tab-content.active {
    display: block;
}

/* ========================================
   Categories Manager
   ======================================== */
.jts-categories-manager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .jts-categories-manager {
        grid-template-columns: 1fr;
    }
}

.jts-section-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #fff;
}

.jts-children-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.jts-children-header .jts-section-title {
    margin: 0;
}

/* Lists */
.jts-parents-list,
.jts-children-list,
.jts-videos-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 200px;
    padding: 16px;
    background: #0f0f0f;
    border-radius: 8px;
    border: 1px solid #2d2d2d;
}

.jts-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
    text-align: center;
}

.jts-empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.jts-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Item Base */
.jts-parent-item,
.jts-child-item,
.jts-video-item-manage {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.jts-parent-item:hover,
.jts-child-item:hover,
.jts-video-item-manage:hover {
    border-color: #3d3d3d;
}

.jts-parent-item.selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Drag Handle */
.jts-drag-handle {
    display: flex;
    align-items: center;
    color: #6b7280;
    cursor: grab;
}

.jts-drag-handle:active {
    cursor: grabbing;
}

/* Parent Item */
.jts-parent-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.jts-parent-info .jts-parent-icon {
    font-size: 20px;
    color: var(--parent-color, #3b82f6);
}

.jts-parent-info .jts-parent-name {
    font-size: 14px;
    font-weight: 500;
}

/* Child Item */
.jts-child-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.jts-child-info .jts-child-name {
    font-size: 14px;
}

/* Badge */
.jts-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 8px;
    background: #2d2d2d;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
}

/* Item Actions */
.jts-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.jts-parent-item:hover .jts-item-actions,
.jts-child-item:hover .jts-item-actions,
.jts-video-item-manage:hover .jts-item-actions {
    opacity: 1;
}

/* ========================================
   Videos Manager
   ======================================== */
.jts-video-category-select {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.jts-select-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jts-select-group label {
    font-size: 13px;
    color: #9ca3af;
}

.jts-select-group select {
    padding: 10px 14px;
    background: #0f0f0f;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    min-width: 180px;
}

.jts-select-group select:disabled {
    opacity: 0.5;
}

/* Video Item Manage */
.jts-video-thumb-sm {
    position: relative;
    width: 80px;
    height: 45px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.jts-video-thumb-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jts-video-thumb-sm .jts-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #2d2d2d;
    color: #6b7280;
}

.jts-shorts-badge-sm {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ff0000;
    border-radius: 2px;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
}

.jts-video-details {
    flex: 1;
    min-width: 0;
}

.jts-video-details .jts-video-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jts-video-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
}

/* ========================================
   Modals
   ======================================== */
.jts-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.jts-modal.active {
    display: flex;
}

.jts-modal-content {
    width: 100%;
    max-width: 480px;
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
}

.jts-modal-wide {
    max-width: 640px;
}

.jts-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #2d2d2d;
}

.jts-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.jts-modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.jts-modal-close:hover {
    color: #fff;
}

.jts-modal-body {
    padding: 20px;
}

.jts-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #2d2d2d;
}

/* Form */
.jts-form-group {
    margin-bottom: 16px;
}

.jts-form-group:last-child {
    margin-bottom: 0;
}

.jts-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

.jts-form-group label .required {
    color: #ef4444;
}

.jts-form-group input[type="text"],
.jts-form-group input[type="url"],
.jts-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: #0f0f0f;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
}

.jts-form-group input:focus,
.jts-form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.jts-form-group input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 4px;
    background: #0f0f0f;
    border: 1px solid #2d2d2d;
    border-radius: 8px;
    cursor: pointer;
}

.jts-form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
}

.jts-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.jts-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.jts-thumbnail-preview {
    margin-top: 10px;
}

.jts-thumbnail-preview img {
    max-width: 200px;
    border-radius: 4px;
}

/* ========================================
   Loading Overlay
   ======================================== */
.jts-loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.jts-loading-overlay.active {
    display: flex;
}

.jts-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.jts-loading-spinner i {
    font-size: 32px;
    animation: jts-spin 1s linear infinite;
}

@keyframes jts-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   Shorts Checkbox
   ======================================== */
.jts-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.2s;
}

.jts-checkbox-label:hover {
    border-color: #ec4899;
    background: rgba(236, 72, 153, 0.1);
}

.jts-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
    accent-color: #ec4899;
    cursor: pointer;
}

.jts-checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 500;
    color: #fff;
}

.jts-checkbox-text i {
    margin-right: 6px;
    color: #ec4899;
}

.jts-checkbox-text small {
    font-weight: 400;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Checkbox Row (추천/인기) */
.jts-checkbox-row {
    display: flex;
    gap: 12px;
}

.jts-checkbox-row .jts-checkbox-label {
    flex: 1;
    padding: 12px 14px;
}

/* Featured checkbox (추천) */
.jts-checkbox-featured:hover {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.jts-checkbox-featured i {
    color: #f59e0b;
}

/* Popular checkbox (인기) */
.jts-checkbox-popular:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.jts-checkbox-popular i {
    color: #ef4444;
}
