/* ── CẤU HÌNH TỔNG QUAN & BIẾN SỐ (DESIGN SYSTEM) ── */
:root {
    --bg-app: #08090c;
    --bg-sidebar: #0f1118;
    --bg-card: rgba(22, 26, 37, 0.65);
    --bg-input: #1b1f2e;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow-cyan: #00f0ff;
    --border-glow-magenta: #ff007f;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-primary: #00f0ff;
    --color-primary-hover: #00c8d7;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-canva: #7d2ae8;
    --color-capcut: #000000;
    
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --shadow-glow: 0 0 15px rgba(0, 240, 255, 0.25);
    --shadow-glow-magenta: 0 0 15px rgba(255, 0, 127, 0.25);
    --radius: 12px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── RESET & CƠ BẢN ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* ── BỐ CỤC CHÍNH (APP CONTAINER) ── */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.brand-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px var(--color-primary));
}

.brand-text h1 {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(90deg, #00f0ff, #ff007f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text p {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

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

.filter-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ── BUTTONS & FORMS CƠ BẢN ── */
.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background-color: transparent;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.btn.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(0, 240, 255, 0.02));
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #00c0cf);
    color: #050508;
    border: none;
    box-shadow: 0 4px 14px rgba(0, 240, 255, 0.2);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: #050508;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.3);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

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

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

.btn-sm:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* ── CANVA & CAPCUT BUTTONS ── */
.btn-canva {
    background: linear-gradient(135deg, var(--color-canva), #6a1fd1);
    border: none;
    box-shadow: 0 4px 14px rgba(125, 42, 232, 0.2);
}

.btn-canva:hover {
    background: #8e3cff;
    transform: translateY(-1px);
}

.btn-capcut {
    background-color: #ffffff;
    color: #000000;
    border: none;
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.1);
}

.btn-capcut:hover {
    background-color: #e5e5e5;
    transform: translateY(-1px);
}

.btn-publish {
    background: linear-gradient(135deg, var(--border-glow-magenta), #d8006c);
    border: none;
    box-shadow: 0 4px 14px rgba(255, 0, 127, 0.2);
}

.btn-publish:hover {
    background-color: #ff2d97;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 0, 127, 0.35);
}

/* ── SIDEBAR FOOTER ── */
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer p {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.connection-status::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.connection-status.online::before {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.connection-status.offline::before {
    background-color: var(--color-danger);
}

/* ── MAIN CONTENT ── */
.main-content {
    flex-grow: 1;
    padding: 32px;
    overflow-y: auto;
    height: 100vh;
}

.view-header {
    margin-bottom: 32px;
}

.view-header h2 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 6px;
}

.view-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ── VIEW 1: NEWS GRID (PIPELINE) ── */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* ── GLASSMORPHISM CARD (TIN TỨC CARD) ── */
.news-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition);
}

.news-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.card-header-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 12px;
}

.badge-source {
    background-color: rgba(255, 255, 255, 0.08);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
}

.badge-game {
    font-weight: 700;
    color: var(--color-primary);
}

.card-media-preview {
    width: 100%;
    margin-bottom: 14px;
    border-radius: 6px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-media-preview img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    cursor: zoom-in;
    transition: var(--transition);
}

.news-card:hover .card-media-preview img {
    transform: scale(1.04);
}

.news-card h3 {

    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
}

.card-original-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-translation-box {
    background-color: rgba(0, 240, 255, 0.03);
    border-left: 2px solid var(--color-primary);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 16px;
    border-radius: 0 4px 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.card-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── VIEW 2: EDITOR WORKSPACE ── */
.editor-header {
    display: flex;
    align-items: center;
    gap: 24px;
}

.back-nav {
    flex-shrink: 0;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.workspace-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.pane-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
}

.pane-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    color: var(--text-primary);
}

.info-field {
    margin-bottom: 16px;
}

.info-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control.text-raw {
    height: 100px;
    resize: none;
    font-size: 13px;
    color: var(--text-secondary);
}

textarea.form-control {
    height: 140px;
    resize: vertical;
}

textarea.form-control.text-caption {
    height: 200px;
}

.translation-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.select-sm {
    width: auto;
    padding: 4px 8px;
    font-size: 12px;
}

/* ── MEDIA PREVIEW ── */
#media-preview-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

#media-preview-container img, 
#media-preview-container video {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
}

/* ── AI CONTROLS GRID ── */
.ai-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

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

.form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ── INTEGRATIONS ── */
.editor-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.edited-assets-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.asset-preview-box {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
}

.asset-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-preview-box.ready {
    border-color: var(--color-success);
    color: var(--color-success);
    border-style: solid;
}

/* ── CHECKBOX PLATFORMS ── */
.platforms-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

.checkbox-container input {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: inline-block;
    transition: var(--transition);
    position: relative;
}

.checkbox-container input:checked + .custom-checkbox {
    border-color: var(--color-primary);
    background-color: rgba(0, 240, 255, 0.1);
}

.checkbox-container input:checked + .custom-checkbox::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 700;
}

/* ── MODAL CANVA ── */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    width: 85%;
    height: 85%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

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

.modal-body {
    flex-grow: 1;
    position: relative;
}

.canva-mockup {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    background-color: rgba(0, 0, 0, 0.4);
}

/* ── LOADING & SPINNER ── */
.loading-spinner {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* ── LIGHTBOX MODAL ── */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 6, 8, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: var(--transition);
}

.lightbox-img {
    max-width: 92%;
    max-height: 92%;
    border-radius: var(--radius);
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 240, 255, 0.1);
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.close-lightbox {
    position: absolute;
    top: 24px;
    right: 32px;
    color: var(--text-primary);
    font-size: 44px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    z-index: 210;
}

.close-lightbox:hover {
    color: var(--color-primary);
    transform: scale(1.1);
    text-shadow: 0 0 10px var(--color-primary);
}

/* ── THUMBNAIL RESULTS FOR IMAGE SEARCH ── */
.image-search-thumb {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    height: 70px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.image-search-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.image-search-thumb:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
}

.image-search-thumb:hover img {
    transform: scale(1.05);
}

.image-search-thumb::after {
    content: "Chọn";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 240, 255, 0.85);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    padding: 2px 0;
    transform: translateY(100%);
    transition: var(--transition);
}

.image-search-thumb:hover::after {
    transform: translateY(0);
}
