/* image-studio.css - Online SEO Article Image Studio for congcu.one (v8.0 Tabbed Studio & Visual 4-Slot Filmstrip) */
/* Impeccable Design System v3.0 dark-mode tokens & balanced 1-screen 2-column layout */

/* Studio Layout Container */
.studio-container {
    display: grid;
    grid-template-columns: minmax(420px, 500px) 1fr;
    gap: 20px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    margin-bottom: 36px;
}

/* Left Controls Column */
.studio-controls-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

/* Right Sticky Preview Column */
.studio-preview-col {
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    z-index: 10;
}

/* Studio Section Cards */
.studio-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.studio-tabbed-shell {
    padding: 14px 16px 16px;
}

/* 3-Tab Top Bar in Left Column */
.studio-main-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: var(--bg-input);
    padding: 5px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.studio-main-tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 8px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.studio-main-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.studio-main-tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35);
}

.studio-main-tab-btn .tab-icon {
    font-size: 0.92rem;
    line-height: 1;
}

.studio-tab-pane {
    display: none;
}

.studio-tab-pane.active {
    display: block;
    animation: studioFadeIn 0.18s ease;
}

@keyframes studioFadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Compact Control Blocks */
.compact-control-block {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.compact-control-block:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.compact-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.compact-block-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Mode Switcher (Mẫu A vs Mẫu B) */
.mode-toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.mode-btn:hover {
    color: var(--text-main);
}

.mode-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(14, 165, 233, 0.35);
}

.mode-btn-tag {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    font-family: var(--font-mono);
    text-transform: uppercase;
}

/* Group Tabs for Categories */
.category-group-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    padding: 3px;
    border-radius: 7px;
    border: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: thin;
}

.cat-group-btn {
    padding: 5px 9px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.16s ease;
    text-align: center;
    white-space: nowrap;
}

.cat-group-btn:hover {
    color: var(--text-main);
}

.cat-group-btn.active {
    background: var(--bg-elevated);
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Compact Category Grid */
.category-nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
    gap: 6px;
    margin-bottom: 6px;
}

.cat-node-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 7px 8px;
    gap: 6px;
    border-radius: 7px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    text-align: center;
    white-space: nowrap;
}

.cat-node-btn:hover {
    border-color: var(--border-strong);
    color: var(--text-main);
}

.cat-node-btn.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.cat-node-icon {
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.cat-node-icon svg {
    width: 15px !important;
    height: 15px !important;
}

/* Sub-categories container (Sports / Esports) */
.sub-category-wrapper {
    background: var(--bg-input);
    border: 1px dashed var(--border-strong);
    border-radius: 7px;
    padding: 8px 10px;
    margin-top: 6px;
    display: none;
}

.sub-category-wrapper.active {
    display: block;
}

.sub-cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.sub-cat-pill {
    padding: 4px 9px;
    font-size: 0.72rem;
    border-radius: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.sub-cat-pill:hover {
    color: var(--text-main);
    border-color: var(--border-strong);
}

.sub-cat-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* Bookmaker Color Palettes Selector */
.palette-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.palette-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 7px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.73rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.palette-btn:hover {
    border-color: var(--border-strong);
    color: var(--text-main);
}

.palette-btn.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.palette-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

/* 6 Layout Series Quick Filter Bar */
.series-filter-bar {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 8px;
    scrollbar-width: thin;
}

.series-filter-pill {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.69rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.series-filter-pill:hover {
    color: var(--text-main);
    border-color: var(--border-strong);
}

.series-filter-pill.active {
    background: rgba(56, 189, 248, 0.16);
    border-color: #38bdf8;
    color: #38bdf8;
}

/* Active Slot Target Banner above Gallery */
.active-slot-target-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 0.73rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.btn-mini-action {
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-mini-action:hover {
    background: rgba(245, 158, 11, 0.26);
    border-color: #fbbf24;
}

/* Template Gallery Grid */
.template-gallery-count {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.template-gallery-scroll {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}

.template-item {
    aspect-ratio: 2 / 1;
    border-radius: 8px;
    border: 2px solid var(--border);
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.18s ease;
}

.template-item:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.template-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 14px var(--primary-glow);
}

.template-item-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    color: #fff;
    font-size: 0.67rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Slot Assignment Badges on Gallery Thumbnails */
.template-slot-badges {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: flex-end;
    pointer-events: none;
}

.tpl-used-badge {
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 800;
    font-family: var(--font-mono);
    background: rgba(15, 23, 42, 0.88);
    color: #38bdf8;
    border: 1px solid #38bdf8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.tpl-used-badge.is-active-slot {
    background: #0ea5e9;
    color: #fff;
    border-color: #fff;
}

/* Typography & 28 Vietnamese Google Fonts Grid */
.font-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.expanded-font-grid {
    max-height: 235px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
}

.font-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 6px;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 0;
}

.font-option-btn .font-btn-sample {
    font-size: 0.88rem;
    line-height: 1.2;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.font-option-btn .font-btn-sub {
    font-family: var(--font-sans, 'Be Vietnam Pro', sans-serif) !important;
    font-size: 0.62rem;
    font-weight: 500 !important;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.font-option-btn:hover {
    color: var(--text-main);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.font-option-btn.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.font-option-btn.active .font-btn-sample {
    color: #38bdf8;
}

.font-option-btn.active .font-btn-sub {
    color: #7dd3fc;
}

/* Logo & Badge Controls */
.logo-controls-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.file-upload-zone {
    border: 1px dashed var(--border-strong);
    background: var(--bg-input);
    border-radius: 7px;
    padding: 8px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
}

.file-upload-zone:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.file-upload-zone input[type="file"] {
    display: none;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.74rem;
    cursor: pointer;
}

/* Visual 4-Slot Filmstrip (Right Column Top) */
.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-md);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.preview-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 7px;
}

.preview-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    padding: 3px 8px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Visual 4-Slot Cards Grid */
.visual-slot-filmstrip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
    background: transparent;
    padding: 0;
    border: none;
}

.visual-slot-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    border-radius: 9px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
    min-width: 0;
}

.visual-slot-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.visual-slot-card.active {
    background: rgba(14, 165, 233, 0.12);
    border-color: #38bdf8;
    box-shadow: 0 0 14px rgba(14, 165, 233, 0.28);
}

.slot-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.slot-card-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.visual-slot-card.active .slot-card-title {
    color: #38bdf8;
}

.slot-card-mode {
    font-size: 0.62rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-weight: 700;
    flex-shrink: 0;
}

.slot-card-mode.mode-a {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

.slot-card-mode.mode-b {
    background: rgba(56, 189, 248, 0.16);
    color: #7dd3fc;
}

.slot-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    border-radius: 6px;
    background-color: #090d16;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.slot-card-tpl-badge {
    position: absolute;
    bottom: 3px;
    left: 4px;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
}

.slot-card-dice {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
}

.slot-card-dice:hover {
    background: var(--primary);
    border-color: #fff;
    transform: scale(1.08);
}

/* Inline Title Editor Bar above Canvas */
.inline-title-editor-bar {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.inline-title-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.74rem;
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.inline-title-input-row {
    display: grid;
    grid-template-columns: 1fr 215px;
    gap: 8px;
    align-items: center;
}

.inline-title-input {
    font-size: 0.86rem !important;
    font-weight: 700 !important;
    padding: 7px 10px !important;
}

.inline-font-select {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    padding: 7px 8px !important;
    cursor: pointer;
}

/* 800x400 Canvas Wrapper */
.canvas-wrapper {
    position: relative;
    aspect-ratio: 2 / 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
}

#studioCanvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Unified Export Action Bar below Canvas */
.canvas-action-bar.unified-export-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.unified-export-bar .btn-primary,
.unified-export-bar .btn-batch-gold {
    flex: 1 1 180px;
    font-size: 0.82rem;
    padding: 9px 12px;
}

.btn-batch-gold {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #f59e0b;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.3);
    transition: all 0.18s ease;
}

.btn-batch-gold:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.unified-export-bar .btn-secondary {
    font-size: 0.78rem;
    padding: 8px 11px;
}

.canvas-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* Tab 3 Visual Batch List */
.visual-batch-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.visual-batch-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
}

.visual-batch-thumb-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.visual-batch-thumb {
    width: 100%;
    aspect-ratio: 2 / 1;
    border-radius: 5px;
    background-color: #090d16;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border-strong);
    position: relative;
    cursor: pointer;
}

.visual-batch-num {
    position: absolute;
    bottom: 2px;
    left: 3px;
    font-size: 0.6rem;
    font-family: var(--font-mono);
    font-weight: 700;
    background: rgba(0, 0, 0, 0.8);
    color: #38bdf8;
    padding: 1px 4px;
    border-radius: 3px;
}

.btn-pick-visual {
    border: 1px solid var(--border-strong);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 0.66rem;
    font-weight: 600;
    padding: 3px 4px;
    cursor: pointer;
}

.btn-pick-visual:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.visual-batch-text-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.batch-input-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.batch-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.badge-thumb {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.badge-body {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info);
    border: 1px solid var(--info-border);
}

/* Mobile Responsive Optimization (<= 960px) */
@media (max-width: 960px) {
    .studio-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .studio-preview-col {
        order: -1;
        position: relative;
        top: 0;
    }

    .visual-slot-filmstrip {
        grid-template-columns: repeat(2, 1fr);
    }

    .inline-title-input-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .studio-main-tabs {
        grid-template-columns: 1fr;
    }

    .category-nodes-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .palette-selector-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
