/* 다크 모드 기본 테마 - 영상 업로드 관리 UI */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #0f3460;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --accent: #7c3aed;
    --accent-hover: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --border: #2d2d44;
    --shadow: rgba(0, 0, 0, 0.3);

    /* 별칭 */
    --bg: var(--bg-primary);
    --surface: var(--bg-card);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px 24px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.header h1 {
    font-size: 1.5em;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 예약 설정 패널 */
.schedule-settings {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.settings-header h3 {
    margin-bottom: 4px;
}

.settings-header small {
    color: var(--text-secondary);
}

.settings-content {
    margin-top: 12px;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.setting-row label {
    min-width: 120px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.setting-row input {
    flex: 1;
}

.setting-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.stats {
    display: flex;
    gap: 16px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 0.85em;
}

.stat-value {
    font-weight: 700;
}

.stat.pending .stat-value {
    color: var(--warning);
}

.stat.completed .stat-value {
    color: var(--success);
}

.stat.uploaded .stat-value {
    color: var(--info);
}

/* 탭 */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab:hover {
    background: var(--bg-input);
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* 입력 모드 탭 */
.upload-section {
    margin-bottom: 16px;
}

.input-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.mode-tab {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.add-form {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}

/* 폼 */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.form-row:last-child {
    margin-bottom: 0;
}

input,
select,
textarea {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9em;
    font-family: inherit;
    resize: vertical;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}

.input-sheet {
    width: 130px;
}

.input-url {
    flex: 2;
    min-width: 180px;
}

.input-subtitle {
    flex: 1;
    min-width: 120px;
}

.input-small {
    width: 70px;
}

.input-schedule {
    flex: 1;
    min-width: 150px;
}

.input-full {
    width: 100%;
}

/* 드롭존 */
.drop-zone {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(124, 58, 237, 0.1);
}

.drop-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.drop-zone p {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.upload-form {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    border: 1px solid var(--border);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-group label {
    font-size: 0.75em;
    color: var(--text-secondary);
}

.selected-file {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.selected-file span {
    color: var(--accent);
}

/* 버튼 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* ===== 영상 카드 그리드 ===== */
.video-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 날짜별 섹션 */
.date-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.date-label {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
}

.date-count {
    font-size: 0.85em;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 4px 10px;
    border-radius: 12px;
}

.date-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.date-cards .video-card {
    width: 180px;
    flex-shrink: 0;
}

.video-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.video-card.uploaded {
    opacity: 0.6;
}

/* 썸네일 영역 */
.card-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: #000;
    cursor: pointer;
    overflow: hidden;
}

.card-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumbnail .play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s;
}

.card-thumbnail:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    font-size: 3em;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* 상태 뱃지 */
.card-status {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

.card-status.pending {
    background: rgba(245, 158, 11, 0.9);
    color: #000;
}

.card-status.processing {
    background: rgba(59, 130, 246, 0.9);
    color: #fff;
}

.card-status.completed {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
}

.card-status.uploaded {
    background: rgba(124, 58, 237, 0.9);
    color: #fff;
}

.card-status.error {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
}

/* 카드 정보 */
.card-info {
    padding: 12px;
}

.card-subtitle {
    font-size: 0.95em;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-schedule {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.card-sheet {
    font-size: 0.75em;
    color: var(--accent);
    margin-bottom: 8px;
}

/* 자세히 보기 */
.card-details {
    display: none;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.card-details.open {
    display: block;
}

.card-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    margin-bottom: 4px;
}

.card-detail-row span:first-child {
    color: var(--text-secondary);
}

/* 카드 액션 */
.card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.card-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
}

.card-btn.primary {
    background: var(--accent);
    color: white;
}

.card-btn.success {
    background: var(--success);
    color: white;
}

.card-btn.info {
    background: var(--info);
    color: white;
}

.card-btn.secondary {
    background: var(--bg-input);
    color: var(--text-primary);
}

.card-btn.danger {
    background: var(--danger);
    color: white;
}

.card-btn:hover {
    opacity: 0.9;
}

.toggle-details {
    width: 100%;
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8em;
    cursor: pointer;
}

.toggle-details:hover {
    color: var(--text-primary);
}

/* 빈 상태 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 4em;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 로딩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 모달 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    border: 1px solid var(--border);
    position: relative;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--danger);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
}

.video-modal-content {
    max-width: 900px;
    padding: 12px;
    background: #000;
}

.video-modal-content video {
    width: 100%;
    max-height: 80vh;
    border-radius: 6px;
}

/* 자막 미리보기 모달 */
.preview-modal-content {
    max-width: 700px;
    padding: 20px;
}

.preview-modal-content h3 {
    margin-bottom: 16px;
}

.preview-container {
    position: relative;
    height: 60vh;
    aspect-ratio: 9 / 16;
    width: auto;
    max-width: 100%;
    margin: 0 auto 16px auto;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.preview-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: 8px;
    margin-bottom: 12px;
}

.control-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    cursor: pointer;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.control-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.video-controls span {
    font-size: 0.85em;
    color: var(--text-secondary);
    min-width: 40px;
}

#video-timeline {
    flex: 1;
    accent-color: var(--accent);
    cursor: pointer;
}

.preview-subtitle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: clamp(14px, 4vw, 28px);
    font-weight: 600;
    color: #000;
    background: white;
    padding: 8px 20px;
    border-radius: 12px;
    max-width: 85%;
    white-space: pre;
    line-height: 1.3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.preview-controls label {
    min-width: 120px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.preview-controls input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
}

.preview-controls span {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    color: var(--accent);
}

.preview-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.preview-field {
    flex: 1;
}

.preview-field label {
    display: block;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.preview-field input {
    width: 100%;
}

/* 반응형 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .tabs,
    .actions {
        flex-wrap: wrap;
    }

    .form-row {
        flex-direction: column;
    }

    .input-sheet,
    .input-url,
    .input-subtitle,
    .input-small,
    .input-schedule {
        width: 100%;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .preview-container {
        max-height: 40vh;
    }
}

/* ===== 사이드바 레이아웃 ===== */
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* 사이드바 */
.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 10;
}

.logo {
    padding: 0 10px 20px 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.logo h2 {
    font-size: 1.4em;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-btn .icon {
    font-size: 1.2em;
}

/* 메인 콘텐츠 */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg);
    position: relative;
}

.page-section {
    display: none;
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

.page-section.active {
    display: block;
}

/* 기존 container 스타일 재정의 (페이지 내부용) */
.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 쓰레드 미디어 미리보기 */
.media-preview-area {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 15px;
    min-height: 120px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    align-items: center;
    padding-left: 10px;
}

.media-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.media-item img,
.media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* 쓰레드 업로드 기록 */
.threads-history-section h3 {
    margin-bottom: 16px;
    font-size: 1.2em;
    color: var(--text-primary);
}

.threads-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.history-card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.history-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.history-media {
    position: relative;
    height: 160px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.history-media video,
.history-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-media-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
}

.history-content {
    padding: 12px;
}

.history-text {
    font-size: 0.9em;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    color: var(--text-secondary);
}

.history-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}
/* ý ú */
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.system-controls { margin-bottom: 20px; padding: 15px; background: rgba(239, 68, 68, 0.1); border-radius: 8px; border: 1px solid rgba(239, 68, 68, 0.2); text-align: center; }

.data-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.data-table th, .data-table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: rgba(0,0,0,0.2); color: var(--text-secondary); }

.job-status-running { color: var(--warning); font-weight: bold; }
.job-status-completed { color: var(--success); }


/* ̸ ̳  (9:16 , ڸ ġ ) */
.preview-container { width: 100%; aspect-ratio: 9/16; max-height: 60vh; background: #000; position: relative; overflow: hidden; margin: 0 auto; border-radius: 8px; display: flex; justify-content: center; align-items: center; border: 1px solid var(--border); }
.preview-container video { width: 100%; height: 100%; object-fit: contain; }
.preview-subtitle { position: absolute; left: 50%; transform: translate(-50%, -50%); width: 90%; text-align: center; color: white; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); pointer-events: none; white-space: pre; z-index: 10; font-family: 'Inter', sans-serif; }


/* ̸ ̳ ѹ ( ũ) */
.preview-container { width: 100%; aspect-ratio: auto; min-height: 400px; max-height: 60vh; background: transparent; position: relative; border: 1px solid var(--border); display: flex; justify-content: center; align-items: center; border-radius: 8px; }
.preview-container video { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-subtitle { position: absolute; left: 50%; transform: translateX(-50%); width: 100%; text-align: center; color: white; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); pointer-events: none; white-space: pre; z-index: 10; font-family: 'Inter', sans-serif; }


/* ڸ Ÿ ѹ (ٹٲ ) */
.preview-subtitle { white-space: pre-wrap; word-break: break-all; }


/* ڸ Ÿ  ( ) */
.preview-subtitle { background: transparent !important; color: white !important; text-shadow: 2px 2px 4px black; border: none; padding: 0; width: auto; max-width: 90%; }


/* ڸ Ÿ   ( ڽ) */
.preview-subtitle { background: white !important; color: black !important; padding: 10px 20px; border-radius: 20px; text-shadow: none; width: auto; max-width: 90%; white-space: pre-wrap; word-break: break-all; font-family: 'Inter', sans-serif; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

/* =====  ̸    (Splie View) ===== */
.preview-container-inline {
    display: flex;
    gap: 20px;
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.preview-left {
    flex: 3; /*   */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-video-wrapper {
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    padding-top: 56.25%; /* 16:9   (ʿ  ) */
}

.preview-video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-right {
    flex: 2; /*    */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preview-controls-overlay {
    background: rgba(0, 0, 0, 0.6);
    padding: 10px;
    border-radius: 8px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-controls-overlay button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.preview-controls-overlay input[type="range"] {
    flex: 1;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.setting-row-inline { /* renamed to avoid conflict */
    display: flex;
    gap: 10px;
}

.preview-actions {
    margin-top: auto; /* ϴ  */
    display: flex;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.preview-actions button {
    flex: 1;
}

/* ===== ¡ ( û) ===== */
.drop-zone {
    min-height: 500px !important;
    border-width: 3px !important;
}

.drop-zone .drop-icon {
    font-size: 5rem !important;
    margin-bottom: 20px !important;
}

.drop-zone p {
    font-size: 1.5rem !important;
}

.preview-container-inline {
    min-height: 500px;
}

.preview-video-wrapper {
    padding-top: 0 !important;
    height: 100%;
    min-height: 500px;
}

.preview-left {
    flex: 1;
}

.preview-right {
    flex: 1;
    justify-content: center;
}

/* ===== ¥ ׷ Ÿ ===== */
.date-group {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.date-group-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.date-group-title .count {
    font-size: 0.9rem;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
}

.date-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ī ̾ƿ   */
.video-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 200px; /* ּ   */
}

.video-card-content {
    flex: 1; /*   ä */
    display: flex;
    flex-direction: column;
}

.video-actions {
    margin-top: auto; /* ư ϴ б */
    padding-top: 15px;
}

/* ===== ī UI  ( û) ===== */
.card-video-preview video {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
    background: black;
    max-height: 200px;
    object-fit: contain;
}

.video-info .subtitle {
    font-weight: bold;
    color: white;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}

.video-info .highlight {
    color: var(--accent);
    font-weight: bold;
}

.btn-more {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    width: 100%;
    margin-top: 5px;
    cursor: pointer;
    padding: 5px;
}

.btn-more:hover {
    color: white;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

.video-details {
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 8px;
    margin-top: 5px;
    font-size: 0.9rem;
}

/* =====  ī  ( û) ===== */
.video-card {
    background: #1e1e24; /*    */
    border: 1px solid rgba(255, 255, 255, 0.08); /* ̹ ׵θ */
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.video-id {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.video-info .subtitle {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.info-row {
    font-size: 0.95rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-row .label {
    width: auto;
    min-width: unset;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-row .value {
    color: var(--text-primary);
}

.info-row .value.highlight {
    color: var(--accent);
    font-weight: 500;
}

.video-details {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-more {
    margin-top: 10px;
    padding: 8px 0;
    width: 100%;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-more:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.video-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Ϸ  ׼ ư */
.completed-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.published-time {
    font-size: 0.9rem;
    color: var(--success);
    font-weight: 500;
}

/* ===== 캘린더 뷰 스타일 ===== */
.view-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.view-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.calendar-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 2px;
    background: var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.calendar-header {
    background: var(--surface);
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.calendar-header.today {
    background: var(--accent);
    color: white;
}

.calendar-time-label {
    background: var(--surface);
    padding: 16px 8px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-cell {
    background: var(--bg);
    min-height: 80px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.calendar-cell:hover {
    background: rgba(124, 58, 237, 0.1);
}

.calendar-cell.has-video {
    background: rgba(124, 58, 237, 0.15);
}

.calendar-video {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-video:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.calendar-video .video-id {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.75rem;
}

.calendar-video .video-subtitle {
    color: var(--text);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-video .video-status {
    font-size: 0.7rem;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.calendar-video .video-status.pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.calendar-video .video-status.completed {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.unassigned-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.unassigned-section h3 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: var(--text-secondary);
}

.unassigned-videos {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.unassigned-video {
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 12px;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.2s;
}

.unassigned-video:hover {
    border-color: var(--accent);
    border-style: solid;
}

.unassigned-video .video-id {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
}

.unassigned-video .video-subtitle {
    color: var(--text);
    font-size: 0.85rem;
    margin-top: 4px;
}

.empty-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 20px;
    text-align: center;
}

/* Threads media preview sizing */
.media-preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.media-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: grab;
}

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

.media-preview-item.dragging {
    opacity: 0.5;
    border-color: var(--accent);
}

.preview-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.preview-delete-btn:hover {
    background: #dc2626;
}

.selected-for-swap {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Status badge in header */
.video-status-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.video-status-badge.status-pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.video-status-badge.status-success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.video-status-badge.status-done {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.video-status-badge.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.btn-warning {
    background: #f59e0b;
    color: white;
    border: none;
}

.btn-warning:hover {
    background: #d97706;
}

/* Video link buttons */
.video-links {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.2s;
}

.youtube-link {
    background: rgba(255, 0, 0, 0.15);
    color: #ff4444;
}

.youtube-link:hover {
    background: rgba(255, 0, 0, 0.25);
}

.instagram-link {
    background: rgba(225, 48, 108, 0.15);
    color: #e1306c;
}

.instagram-link:hover {
    background: rgba(225, 48, 108, 0.25);
}

/* Horizontal scroll for video grid */
.date-group-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.video-card {
    flex: 0 0 280px;
    min-width: 280px;
}

/* Compact layout */
.sidebar {
    width: 180px !important;
    min-width: 180px !important;
}

.main-content {
    padding: 16px !important;
}

.date-group {
    margin-bottom: 16px;
}

.date-group-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

/* 5 cards visible - smaller cards */
.video-card {
    flex: 0 0 180px !important;
    min-width: 180px !important;
    padding: 10px;
}

.video-title {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-schedule {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.card-video-preview video {
    max-height: 120px;
}

.video-actions {
    margin-top: 8px;
}

.video-actions .btn {
    padding: 4px 8px;
    font-size: 0.7rem;
}

.video-links {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.link-btn {
    padding: 2px 6px !important;
    font-size: 0.8rem !important;
}

/* Date navigation header */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 16px;
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 16px;
}

.date-nav-btn {
    background: var(--accent);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.date-nav-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.date-nav-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
}

/* Video list layout */
.video-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.video-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.list-preview {
    flex: 0 0 160px;
    height: 90px;
    background: var(--bg);
    border-radius: 6px;
    overflow: hidden;
}

.list-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-preview .no-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

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

.list-title {
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-schedule {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.list-links {
    display: flex;
    gap: 6px;
}

.list-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Unassigned section */
.unassigned-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.section-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Fix video preview aspect ratio */
.list-preview {
    flex: 0 0 200px;
    height: auto;
    min-height: 112px;
    max-height: 180px;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.list-preview video {
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: contain;
    display: block;
}

/* Detail rows in list */
.list-details {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 0.8rem;
}

.detail-row {
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-row a {
    color: var(--accent);
}

.btn-more {
    margin-top: 6px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
}

.btn-more:hover {
    text-decoration: underline;
}

/* Inline schedule edit */
.list-schedule-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-edit-schedule {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    color: var(--accent);
}

.btn-edit-schedule:hover {
    background: var(--accent);
    color: white;
}

/* Ratio converter styles */
.ratio-converter {
    max-width: 900px;
    margin: 0 auto;
}

.ratio-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 60px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.ratio-drop-zone:hover {
    border-color: var(--accent);
    background: rgba(124, 58, 237, 0.05);
}

.ratio-preview-row {
    display: flex;
    gap: 24px;
    margin-top: 20px;
}

.ratio-video-preview {
    flex: 1;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.ratio-video-preview video {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.ratio-settings {
    flex: 0 0 250px;
}

.ratio-settings h4 {
    margin-bottom: 16px;
}

.ratio-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.ratio-btn {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.ratio-btn:hover {
    border-color: var(--accent);
}

.ratio-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

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

.ratio-result-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

#ratio-result-video {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
}

/* Fix preview container padding */
#file-preview-container {
    background: #000 !important;
    padding: 0 !important;
}

#file-preview-container video,
#inline-preview-video {
    width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000;
}

.video-preview-wrapper {
    background: #000;
    padding: 0;
}

/* Fix - make container dark gray to distinguish from video black */
#file-preview-container {
    background: #1a1a2e !important;
}

.video-preview-wrapper {
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 8px;
}

/* Preview Consistency Fix (Manual Override) */
.preview-video-wrapper { aspect-ratio: 9/16 !important; max-width: 337.5px !important; margin: 0 auto !important; height: auto !important; padding-top: 0 !important; overflow: hidden; position: relative; background: #000; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.preview-video-wrapper video { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; object-fit: contain !important; }
.video-placeholder { z-index: 5; }
.preview-subtitle { z-index: 10; }

/* Subtitle No-Wrap Override */
.preview-subtitle { white-space: nowrap !important; word-break: normal !important; max-width: none !important; width: auto !important; overflow: visible !important; }

/* Allow manual Enter line breaks, but no auto-wrap */
.preview-subtitle { white-space: pre-line !important; word-break: normal !important; }

/* FINAL: No size limit, manual line breaks only */
.preview-subtitle { max-width: unset !important; width: auto !important; overflow: visible !important; white-space: pre !important; word-break: keep-all !important; }

/* ============================================
   CLEAN CARD UI REDESIGN
   ============================================ */

.video-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s ease;
}

.video-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Thumbnail */
.list-preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a2e;
}

.list-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Info Section */
.list-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.list-schedule {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-schedule .btn-edit-schedule {
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: none;
    cursor: pointer;
}

/* Details - inline compact */
.list-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    padding: 0;
    margin: 0;
    border: none !important;
    background: none !important;
}

.detail-row {
    display: inline;
}

/* Links */
.list-links {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.link-btn {
    padding: 3px 10px;
    font-size: 11px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
}

.youtube-link {
    background: rgba(255, 0, 0, 0.15);
    color: #ff6b6b;
}

.instagram-link {
    background: rgba(225, 48, 108, 0.15);
    color: #f472b6;
}

/* Actions */
.list-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.list-actions .btn {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.list-actions .btn-primary {
    background: #6366f1;
    color: white;
}

.list-actions .btn-info {
    background: #3b82f6;
    color: white;
}

.list-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.list-actions .btn-warning {
    background: #f59e0b;
    color: white;
}

.list-actions .btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.list-actions .btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

/* Fix thumbnail aspect ratio to 9:16 */
.list-preview { width: 50px !important; height: 89px !important; aspect-ratio: 9/16 !important; }
.list-preview video { object-fit: contain !important; background: #000; }

/* ============================================
   SITE-WIDE CLEAN DESIGN
   ============================================ */

/* Global reset */
body {
    background: #0f0f1a !important;
    color: #e0e0e0 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* Container */
.container {
    max-width: 1000px !important;
    margin: 0 auto !important;
    padding: 20px !important;
}

/* Header */
.header h1 {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: #fff !important;
    margin-bottom: 20px !important;
}

/* Tabs */
.tabs {
    display: flex !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
}

.tab {
    padding: 8px 16px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    background: transparent !important;
    color: rgba(255,255,255,0.6) !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    font-size: 13px !important;
}

.tab:hover, .tab.active {
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    color: #818cf8 !important;
}

/* Buttons */
.btn {
    padding: 10px 20px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.btn-info {
    background: #3b82f6 !important;
    color: white !important;
}

.btn-primary {
    background: #6366f1 !important;
    color: white !important;
}

.btn:hover {
    transform: translateY(-1px) !important;
    filter: brightness(1.1) !important;
}

/* Actions bar */
.actions {
    margin-bottom: 16px !important;
}

/* Preview container */
.preview-container-inline {
    background: rgba(255,255,255,0.02) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
    border-radius: 12px !important;
    padding: 20px !important;
    margin-bottom: 20px !important;
}

/* Inputs */
input, select, textarea {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 6px !important;
    color: #fff !important;
    padding: 8px 12px !important;
}

input:focus, select:focus, textarea:focus {
    border-color: #6366f1 !important;
    outline: none !important;
}

/* Setting labels */
.setting-group label {
    font-size: 12px !important;
    color: rgba(255,255,255,0.5) !important;
    margin-bottom: 4px !important;
}

/* Video grid */
.video-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

/* ============================================
   TIMELINE LAYOUT (BUFFER STYLE)
   ============================================ */

.timeline-group {
    margin-bottom: 30px;
}

.timeline-header {
    font-size: 14px;
    font-weight: 600;
    color: #818cf8; /* Indigo accent */
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-row {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
}

.timeline-time {
    width: 80px;
    flex-shrink: 0;
    text-align: right;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    padding-top: 14px; /* Align with card content */
}

.time-meridiem {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 2px;
}

.time-hour {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.timeline-content {
    flex: 1;
    min-width: 0; /* Prevent flex overflow */
}

/* Remove margin from items inside timeline */
.timeline-content .video-list-item {
    margin-bottom: 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
}

/* ===== THREADS UPLOAD STYLES ===== */
.threads-editor {
    display: flex;
    gap: 30px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.threads-media-section {
    flex: 1;
    min-width: 300px;
}

.threads-form-section {
    flex: 1;
    min-width: 300px;
}

.threads-carousel {
    background: var(--bg-secondary);
    border-radius: 8px;
    min-height: 200px;
    padding: 15px;
}

.carousel-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 180px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.carousel-drop-zone:hover,
.carousel-drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.carousel-drop-zone .drop-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.carousel-drop-zone p {
    color: var(--text-secondary);
    text-align: center;
}

.carousel-items {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.carousel-item {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.carousel-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.carousel-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.carousel-item video,
.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 40%, transparent 60%, rgba(0,0,0,0.5) 100%);
    display: flex;
    justify-content: space-between;
    padding: 5px;
}

.carousel-item-overlay .item-order {
    background: var(--primary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.carousel-item-overlay .item-type {
    font-size: 14px;
}

.carousel-item-overlay .btn-remove-item {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.carousel-item:hover .btn-remove-item {
    opacity: 1;
}

.carousel-add-btn {
    width: 100px;
    height: 100px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.carousel-add-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.threads-preview-player {
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
}

.threads-preview-player video {
    width: 100%;
    max-height: 300px;
    background: black;
}

/* Threads History */
.threads-list-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.threads-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.threads-history-item {
    display: flex;
    gap: 15px;
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    transition: transform 0.2s;
}

.threads-history-item:hover {
    transform: translateX(5px);
}

.history-media {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.history-media video,
.history-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-media .media-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.history-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.history-text {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.history-meta {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 5px;
}

/* Page section display */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .threads-editor {
        flex-direction: column;
    }
}
