:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface2: #f5f5f7;
    --surface3: #e8e8ed;
    --border: #d2d2d7;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #aeaeb2;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-light: #e8f0fe;
    --danger: #ff3b30;
    --success: #34c759;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.14);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

h1, h2, h3, .sora {
    font-family: 'Sora', sans-serif;
}

button {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border-radius: var(--radius-md);
    padding: 10px 20px;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 10px 20px;
}

.btn-secondary:hover {
    background: var(--surface2);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 8px 16px;
}

.btn-danger:hover {
    background: rgba(255, 59, 48, 0.05);
}

input, textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    transition: 0.2s;
}

input:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

/* LOGIN SCREEN */
#login-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.login-card {
    background: var(--surface);
    width: 400px;
    padding: 32px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

.login-icon {
    color: var(--accent);
    margin-bottom: 16px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-field {
    position: relative;
    margin-bottom: 20px;
}

.login-field i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.login-field input {
    width: 100%;
    padding-left: 40px;
}

.login-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
    display: none;
}

/* LAYOUT */
#app-container {
    display: flex;
    height: 100vh;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#app-container.visible {
    opacity: 1;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header i {
    color: var(--text-primary);
}

.sidebar-header span {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 16px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s;
    margin-bottom: 4px;
}

.nav-link:hover {
    background: var(--surface2);
    color: var(--accent);
}

.nav-link i {
    width: 16px;
    height: 16px;
}

.section-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    letter-spacing: 1px;
    margin: 24px 12px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.folder-item {
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 4px;
    transition: 0.2s;
}

.folder-item:hover {
    background: var(--surface2);
}

.folder-item.active {
    background: var(--accent-light);
}

.folder-item-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.folder-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.folder-left i {
    color: var(--text-tertiary);
    width: 16px;
}

.folder-item.active .folder-left i, 
.folder-item.active .folder-left span {
    color: var(--accent);
}

.folder-name {
    font-size: 14px;
    color: var(--text-primary);
}

.folder-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-count {
    background: var(--surface3);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    margin-right: 4px;
}

.folder-note-btn {
    color: var(--text-tertiary);
    background: transparent;
    padding: 4px;
    border-radius: 4px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-note-btn:hover {
    background: var(--surface3);
    color: var(--accent);
}

.delete-folder {
    color: var(--text-tertiary);
    opacity: 0;
    transition: 0.2s;
}

.folder-item:hover .delete-folder {
    opacity: 1;
}

.delete-folder:hover {
    color: var(--danger);
}

.add-folder-btn {
    width: 100%;
    height: 36px;
    border: 1px dashed var(--border);
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    margin-top: 12px;
}

.add-folder-btn:hover {
    background: var(--surface2);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.settings-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    background: transparent;
    font-size: 12px;
}

.settings-btn:hover {
    color: var(--text-secondary);
}

.watermark {
    font-size: 10px;
    color: var(--text-tertiary);
    text-align: right;
    margin-top: 12px;
    letter-spacing: 1px;
}

/* MAIN AREA */
.main-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.header-bar {
    position: sticky;
    top: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 24px 28px;
    z-index: 90;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.folder-title-container {
    flex: 1;
}

.folder-title-display {
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    display: inline-block;
}

.folder-title-input {
    font-size: 22px;
    font-weight: 600;
    padding: 2px 8px;
    margin-left: -8px;
    border: none;
    background: var(--surface2);
    display: none;
    width: 100%;
    max-width: 400px;
}

.folder-note {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    resize: none;
    min-height: 48px;
}

.folder-note:focus {
    box-shadow: none;
}

.save-indicator {
    font-size: 11px;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: 0.3s;
}

.channel-add-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.channel-add-input {
    width: 320px;
}

/* GRID */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 24px;
    padding: 28px;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 80px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.empty-state i {
    margin-bottom: 16px;
}

/* CARD */
.channel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(12px);
}

.channel-card.fade-up {
    opacity: 1;
    transform: translateY(0);
}

.channel-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-banner {
    display: none;
}

.notes-trigger {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.notes-trigger:hover {
    color: var(--accent);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.card-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.4;
}

.card-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, var(--surface) 0%, transparent 100%);
}

.card-identity {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
}

.card-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    order: 2;
}

.card-name-box {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.card-name:hover {
    color: var(--accent);
}

.country-tag {
    font-size: 10px;
    background: var(--surface3);
    color: var(--text-secondary);
    padding: 1px 4px;
    border-radius: 4px;
    margin-left: 6px;
}

.stats-container {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-tertiary);
}

.videos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
}

.video-thumb {
    position: relative;
    cursor: pointer;
    transition: 0.2s;
}

.video-thumb:hover {
    opacity: 0.9;
    transform: translateY(-4px);
}

.thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface2);
}

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

.duration-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.8);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 500;
}

.category-badge {
    display: none;
}

.video-info {
    margin-top: 6px;
}

.video-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 31px;
}

.video-meta {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Rich Editor Styles */
.editor-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--surface2);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.editor-toolbar button {
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.editor-toolbar button:hover {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
}

.editor-toolbar i {
    width: 14px;
    height: 14px;
}

.color-dot {
    border-radius: 50%;
}
.color-dot.red { background: #ff3b30; }
.color-dot.blue { background: #0071e3; }
.color-dot.green { background: #34c759; }
.color-dot.black { background: #1d1d1f; }

.notebook-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg);
    border-radius: var(--radius-lg);
}

.notebook-section {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.notebook-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-at-label {
    color: var(--danger);
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Sora', sans-serif;
    margin-bottom: 10px;
    display: block;
}

.rich-editor {
    width: 100%;
    min-height: 150px;
    background: var(--surface);
    padding: 5px 0;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
}

.rich-editor:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.delete-channel {
    color: var(--text-tertiary);
    background: transparent;
}

.delete-channel:hover {
    color: var(--danger);
}

.move-dropdown {
    position: relative;
}

.move-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: transparent;
}

.move-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 140px;
    display: none;
    z-index: 10;
}

.move-menu.show {
    display: block;
}

.move-option {
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.1s;
}

.move-option:hover {
    background: var(--surface2);
}

/* MODALS */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 92vw;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    position: relative;
    transform: scale(0.96);
    transition: 0.2s;
}

.modal-overlay.show .modal-card {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: transparent;
    color: var(--text-tertiary);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
    line-height: 1.4;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Video Player Modal Special */
.video-modal {
    max-width: 720px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    margin-top: 20px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* TOASTS */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: 0.3s;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
    transform: translateX(100%);
    opacity: 0;
}

.toast-icon {
    width: 20px;
    height: 20px;
}

.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
.toast-info i { color: var(--accent); }

.toast-text {
    font-size: 13px;
    font-weight: 500;
}

/* RESPONSIVE */
.hamburger {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        transition: 0.3s;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .hamburger {
        display: block;
        background: transparent;
        color: var(--text-primary);
        margin-right: 16px;
    }
    
    .channel-grid {
        grid-template-columns: 1fr;
    }
    
    .channel-add-input {
        width: 100%;
    }
}

.api-pool-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.api-item {
    background: var(--surface2);
    padding: 12px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid transparent;
    transition: 0.2s;
    cursor: pointer;
}

.api-item:hover {
    border-color: var(--border);
}

.api-item.active {
    background: var(--accent-light);
    border-color: var(--accent);
}

.api-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.api-details {
    display: flex;
    flex-direction: column;
}

.api-key-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.api-key-masked {
    font-size: 11px;
    color: var(--text-tertiary);
    font-family: monospace;
}

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

/* ==========================================================================
   TABS NAVIGATION
   ========================================================================== */
.main-tabs {
    display: flex;
    gap: 4px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    z-index: 80;
}

.tab-btn {
    padding: 12px 20px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.tab-btn:hover {
    color: var(--accent);
    background: rgba(0, 113, 227, 0.04);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   COMPETITOR VIDEO DOCUMENT VIEW
   ========================================================================== */
.doc-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    flex-wrap: wrap;
}

.doc-video-input {
    flex: 1;
    min-width: 280px;
}

.word-document-wrapper {
    flex: 1;
    background: #e8e8ed;
    padding: 32px 16px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
}

.word-page {
    background: #ffffff;
    width: 100%;
    max-width: 800px;
    min-height: 1056px;
    padding: 60px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    color: #333333;
}

.doc-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.doc-title:focus {
    border-bottom-color: var(--accent);
}

.doc-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.doc-hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin-bottom: 30px;
}

.doc-video-list {
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex: 1;
}

.doc-video-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 24px;
}

.doc-video-block:last-child {
    border-bottom: none;
}

.doc-video-card {
    display: flex;
    gap: 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    padding: 12px;
    position: relative;
}

.doc-video-card:hover .doc-video-delete {
    opacity: 1;
}

.doc-video-thumb-wrapper {
    width: 180px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

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

.doc-video-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

.doc-video-title-link {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-video-title-link:hover {
    color: var(--accent);
}

.doc-video-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.doc-video-delete {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--danger);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.doc-video-delete:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.doc-video-note-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.doc-video-note-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.doc-video-note-editor {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.6;
    background: #fafafa;
    outline: none;
    resize: vertical;
}

.doc-video-note-editor:focus {
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.doc-footer-info {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 40px;
    text-align: center;
}

/* Print styling helper */
@media print {
    body * {
        visibility: hidden;
    }
    .word-document-wrapper, .word-page, .word-page * {
        visibility: visible;
    }
    .word-document-wrapper {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
        padding: 0;
    }
    .word-page {
        box-shadow: none;
        padding: 0;
        width: 100%;
        min-height: 100%;
    }
    .doc-video-delete {
        display: none !important;
    }
    .doc-video-note-editor {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        resize: none !important;
    }
}

/* ==========================================================================
   COMMUNITY POST PLANNER VIEW
   ========================================================================== */
.community-planner-layout {
    display: flex;
    height: 100%;
    overflow: hidden;
}

.community-form-card {
    width: 400px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
}

.form-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control-full {
    width: 100%;
}

.text-area-large {
    min-height: 120px;
    resize: vertical;
}

.media-upload-preview {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    background: var(--surface2);
}

.media-upload-preview img, .media-upload-preview video {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    display: block;
}

.media-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.media-preview-remove:hover {
    background: var(--danger);
}

.poll-options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.poll-option-row {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.poll-option-header {
    display: flex;
    gap: 8px;
    align-items: center;
}

.poll-option-input {
    flex: 1;
    padding: 6px 10px;
    font-size: 13px;
}

.remove-poll-option {
    color: var(--danger);
    background: transparent;
    padding: 4px;
    cursor: pointer;
    border: none;
}

.poll-option-image-input {
    font-size: 11px;
}

.poll-image-preview {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    background: white;
}

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

.community-feed-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.feed-header {
    padding: 20px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feed-count-badge {
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}

.community-feed-list {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Feed post cards */
.feed-post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.feed-post-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feed-post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-post-date {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.feed-post-type-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
}

.feed-post-type-tag.image { background: #e3f2fd; color: #1e88e5; }
.feed-post-type-tag.gif { background: #f3e5f5; color: #8e24aa; }
.feed-post-type-tag.video { background: #ffebee; color: #e53935; }
.feed-post-type-tag.poll { background: #e8f5e9; color: #43a047; }

.feed-post-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    background: var(--surface2);
    padding: 12px;
    padding-right: 48px;
    border-radius: var(--radius-md);
    position: relative;
}

.feed-post-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
}

.feed-post-copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* Post media preview */
.feed-post-media {
    width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface2);
}

.feed-post-media img, .feed-post-media video {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Post poll preview */
.feed-post-poll {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface2);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.feed-post-poll-choice {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.feed-post-poll-text {
    font-size: 13px;
    font-weight: 500;
}

.feed-post-poll-img {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.feed-post-poll-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.feed-post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

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

.feed-post-download-btn {
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.feed-post-download-btn:hover {
    background: var(--accent);
    color: white;
}

.feed-post-delete-btn {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.feed-post-delete-btn:hover {
    background: rgba(255, 59, 48, 0.05);
}

/* ==========================================================================
   DESKTOP SCROLL & HEIGHT OPTIMIZATION
   ========================================================================== */
@media (min-width: 769px) {
    .main-area {
        overflow: hidden; /* Prevent double scrollbars on desktop */
    }
    
    .tab-content {
        height: calc(100vh - 130px);
        overflow: hidden;
    }
    
    #tab-channels {
        overflow-y: auto;
    }
    
    #tab-research {
        overflow-y: hidden;
    }
    
    .word-document-wrapper {
        height: 100%;
        overflow-y: auto;
    }
    
    #tab-community {
        overflow-y: hidden;
    }
    
    .community-planner-layout {
        height: 100%;
    }
    
    .community-form-card {
        height: 100%;
        overflow-y: auto;
    }
    
    .community-feed-column {
        height: 100%;
        overflow: hidden;
    }
    
    .community-feed-list {
        height: calc(100% - 60px);
        overflow-y: auto;
    }
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVENESS
   ========================================================================== */
@media (max-width: 768px) {
    /* Main Tabs navigation horizontal scroll on mobile */
    .main-tabs {
        padding: 0 16px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        display: flex !important; /* Force flex show when active */
    }
    
    .main-tabs::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    
    .tab-btn {
        padding: 12px 14px;
        flex-shrink: 0;
    }

    /* Competitor video document controls */
    .doc-controls {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .doc-video-input {
        width: 100%;
    }
    
    .doc-controls > div {
        display: flex;
        justify-content: stretch;
        gap: 8px;
        width: 100%;
    }
    
    .doc-controls > div > button {
        flex: 1;
    }

    /* Word document canvas on tablet/mobile */
    .word-document-wrapper {
        padding: 12px 8px;
    }
    
    .word-page {
        padding: 24px 16px;
        min-height: auto;
        box-shadow: none;
        border-radius: var(--radius-md);
    }
    
    .doc-title {
        font-size: 22px;
    }

    /* Community post planner layout */
    .community-planner-layout {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }
    
    .community-form-card {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px;
        overflow-y: visible;
        height: auto;
    }
    
    .community-feed-column {
        flex: none;
        height: auto;
    }
    
    .feed-header {
        padding: 16px;
    }
    
    .community-feed-list {
        padding: 16px;
        overflow-y: visible;
        height: auto;
    }
}

@media (max-width: 576px) {
    /* Document video cards stack on small mobile screens */
    .doc-video-card {
        flex-direction: column;
        gap: 12px;
    }
    
    .doc-video-thumb-wrapper {
        width: 100%;
        max-height: 180px;
    }
    
    .doc-video-details {
        gap: 8px;
    }
    
    .doc-video-delete {
        opacity: 1; /* Always show delete on mobile/touch screens */
        top: 8px;
        right: 8px;
    }
    
    /* Channel Grid (Original view responsive spacing) */
    .channel-grid {
        padding: 16px;
        grid-template-columns: 1fr;
    }
}
