/* ==========================================================================
   Prompt1k - OpenArt AI Suite Studio Theme (Dark Luxury Glassmorphism)
   Matching https://openart.ai/suite/create-image/gpt-image-2-5
   ========================================================================== */

:root {
    --oa-bg-main: #0c0b10;
    --oa-bg-sidebar: #13121b;
    --oa-bg-card: #1b1a25;
    --oa-bg-card-hover: #222130;
    --oa-bg-input: #171622;
    --oa-border: rgba(255, 255, 255, 0.08);
    --oa-border-hover: rgba(255, 255, 255, 0.18);
    --oa-border-active: #ec4899;
    --oa-text-main: #f8fafc;
    --oa-text-muted: #94a3b8;
    --oa-text-dim: #64748b;
    --oa-pink: #ec4899;
    --oa-purple: #a855f7;
    --oa-gradient-btn: linear-gradient(135deg, #ec4899 0%, #d946ef 50%, #8b5cf6 100%);
    --oa-gradient-btn-hover: linear-gradient(135deg, #f43f5e 0%, #ec4899 50%, #a855f7 100%);
    --oa-radius: 12px;
    --oa-radius-sm: 8px;
    --oa-radius-lg: 16px;
    --oa-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   4-ISLAND BENTO ARCHITECTURE (OpenArt Luxury Dark Floating Islands)
   Separated into 4 distinct blocks with ambient glow and rounded corners:
   - Khối 1: Header (.king-headerf)
   - Khối 2: Menu trái (.leftmenu)
   - Khối 3: Ô chọn tạo ảnh (.openart-studio-sidebar)
   - Khối 4: Ô các ảnh đã tạo (.openart-studio-canvas)
   ========================================================================== */

/* 0. Base Page Viewport Lock & Deep Dark Canvas */
html.king-lnight:has(.openart-studio-viewport),
body.king-template-create,
body.king-template-ai_design,
body.king-template-edit-image,
body.king-template-upscale,
body.king-template-upscale-image {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #09080e !important;
    background: #09080e !important;
}

/* 1. KHỐI 1: HEADER (Top Bar Floating Island) */
body.king-template-create .king-headerf,
body.king-template-ai_design .king-headerf,
body.king-template-edit-image .king-headerf,
body.king-template-upscale .king-headerf,
body.king-template-upscale-image .king-headerf {
    position: fixed !important;
    top: 10px !important;
    left: calc(var(--mj-sidebar-width, 220px) + 20px) !important;
    right: 10px !important;
    width: calc(100% - var(--mj-sidebar-width, 220px) - 30px) !important;
    height: 56px !important;
    max-height: 56px !important;
    min-height: 56px !important;
    margin: 0 !important;
    padding: 0 20px !important;
    background: #13121b !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 20px rgba(236, 72, 153, 0.03) !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    z-index: 50 !important;
    transition: all 0.3s ease !important;
}

body.king-template-create .king-headerf:hover,
body.king-template-ai_design .king-headerf:hover,
body.king-template-edit-image .king-headerf:hover,
body.king-template-upscale .king-headerf:hover,
body.king-template-upscale-image .king-headerf:hover {
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.65), 0 0 16px rgba(236, 72, 153, 0.05) !important;
}

body.king-template-create .king-header,
body.king-template-ai_design .king-header,
body.king-template-edit-image .king-header,
body.king-template-upscale .king-header,
body.king-template-upscale-image .king-header {
    height: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* 2. KHỐI 2: MENU TRÁI (Left Sidebar Floating Island) */
body.king-template-create .leftmenu,
body.king-template-ai_design .leftmenu,
body.king-template-edit-image .leftmenu,
body.king-template-upscale .leftmenu,
body.king-template-upscale-image .leftmenu {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    bottom: 10px !important;
    height: calc(100vh - 20px) !important;
    max-height: calc(100vh - 20px) !important;
    width: var(--mj-sidebar-width, 220px) !important;
    background: #13121b !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03) !important;
    box-sizing: border-box !important;
    z-index: 100 !important;
    padding: 20px 14px 16px 14px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    transition: all 0.3s ease !important;
}

body.king-template-create .leftmenu:hover,
body.king-template-ai_design .leftmenu:hover,
body.king-template-edit-image .leftmenu:hover,
body.king-template-upscale .leftmenu:hover,
body.king-template-upscale-image .leftmenu:hover {
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(236, 72, 153, 0.04) !important;
}

/* 3. THÙNG CHỨA KHỐI 3 & KHỐI 4 (#king-body-wrapper & .openart-studio-viewport) */
body.king-template-create #king-body-wrapper,
body.king-template-ai_design #king-body-wrapper,
body.king-template-edit-image #king-body-wrapper,
body.king-template-upscale #king-body-wrapper,
body.king-template-upscale-image #king-body-wrapper {
    position: fixed !important;
    top: 76px !important; /* 10px top + 56px header + 10px gap */
    left: calc(var(--mj-sidebar-width, 220px) + 20px) !important;
    right: 10px !important;
    bottom: 10px !important;
    width: calc(100% - var(--mj-sidebar-width, 220px) - 30px) !important;
    height: calc(100vh - 86px) !important;
    max-height: calc(100vh - 86px) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

body.king-template-create #container,
body.king-template-ai_design #container,
body.king-template-edit-image #container,
body.king-template-upscale #container,
body.king-template-upscale-image #container,
.king-main.openart-studio-page,
.king-main.openart-studio-page .king-main-in,
.king-main.openart-studio-page .king-part-custom,
.king-main.openart-studio-page .king-inner {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.openart-studio-viewport {
    display: flex !important;
    gap: 10px !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    width: 100% !important;
    background-color: transparent !important;
    overflow: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (max-width: 991px) {
    .openart-studio-viewport {
        flex-direction: column !important;
        height: auto !important;
        overflow-y: auto !important;
    }
}

/* 4. KHỐI 3: Ô CHỌN TẠO ẢNH (Sidebar Floating Island) */
.openart-studio-sidebar {
    width: 440px !important;
    min-width: 440px !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    background: #13121b !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 16px rgba(236, 72, 153, 0.03) !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    z-index: 10 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

.openart-studio-sidebar:hover {
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(236, 72, 153, 0.05) !important;
}

@media (max-width: 991px) {
    .openart-studio-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        border-right: none !important;
        border-bottom: 1px solid var(--oa-border) !important;
    }
}

.sidebar-scrollable-inner {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-scrollable-inner::-webkit-scrollbar {
    width: 5px;
}
.sidebar-scrollable-inner::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
.sidebar-scrollable-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* 1. Top Category Tabs (Video | Image | Audio | Character | World) */
.studio-top-tabs-wrapper {
    padding: 12px 14px 4px 14px;
    flex-shrink: 0;
}

.studio-top-tabs {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.35);
    padding: 3px;
    border-radius: var(--oa-radius-sm);
    border: 1px solid var(--oa-border);
    gap: 3px;
}

.studio-tab-item {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--oa-text-muted);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 2px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.studio-tab-item:hover {
    color: var(--oa-text-main);
    background: rgba(255, 255, 255, 0.05);
}

.studio-tab-item.active {
    color: #fff;
    background: #252433;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Studio Mode Views (Create vs Edit Image) */
.sidebar-mode-view {
    display: none;
    height: 100%;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.sidebar-mode-view.active {
    display: flex;
}

/* Edit Mode Header Card */
.edit-mode-card {
    margin: 4px 14px 4px 14px;
    min-height: 52px;
}
.edit-avatar-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35);
}
.tool-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.tool-help-circle {
    font-size: 12px;
    color: var(--oa-text-dim);
    cursor: pointer;
    transition: color 0.15s;
}
.tool-help-circle:hover {
    color: var(--oa-pink);
}

/* OpenArt Canvas Workspace */
.openart-canvas-workspace {
    position: relative;
    flex: 1;
    min-height: 340px;
    background: #09080e;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin: 4px 14px 8px 14px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.45);
}

.canvas-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
    padding: 8px;
    box-sizing: border-box;
}

.canvas-stage {
    position: relative;
    display: inline-block;
    user-select: none;
    transform-origin: center center;
    transition: transform 0.08s ease-out;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    border-radius: 8px;
    overflow: hidden;
    background: repeating-conic-gradient(#15141f 0% 25%, #100f19 0% 50%) 50% / 16px 16px;
    flex-shrink: 0 !important;
    margin: auto;
}

#canvasBaseImage {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    object-fit: contain;
}

#canvasMaskLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 10;
    opacity: 0.5 !important;
}

.canvas-viewport.panning #canvasMaskLayer {
    cursor: grab !important;
}

.canvas-viewport.is-panning #canvasMaskLayer {
    cursor: grabbing !important;
}

/* Brush Cursor Preview */
.canvas-brush-cursor {
    position: fixed;
    border-radius: 50%;
    border: 1.5px solid rgba(236, 72, 153, 0.9);
    background: rgba(236, 72, 153, 0.25);
    pointer-events: none;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 9999;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

/* Floating Vertical Toolbars */
.canvas-floating-toolbar {
    position: absolute;
    top: 12px;
    z-index: 30;
    background: rgba(19, 18, 27, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.toolbar-left {
    left: 10px;
}

.toolbar-right {
    right: 10px;
}

.c-tool-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--oa-text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.c-tool-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.c-tool-btn.active {
    color: #ec4899;
    background: rgba(236, 72, 153, 0.18);
    border-color: rgba(236, 72, 153, 0.4);
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.25);
}

.c-tool-btn.tool-btn-danger:hover {
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.18);
}

.toolbar-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 3px 4px;
}

/* Brush Size Popover */
.brush-size-btn-wrapper {
    position: relative;
}

.brush-size-popover {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #1c1b28;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
    width: 150px;
    display: none;
    z-index: 100;
}

.brush-size-popover.open {
    display: block;
}

.popover-size-header {
    font-size: 11px;
    color: var(--oa-text-muted);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

.popover-size-header strong {
    color: var(--oa-pink);
}

.brush-slider-input {
    width: 100%;
    accent-color: var(--oa-pink);
    cursor: pointer;
    margin: 4px 0;
}

.brush-preview-dot-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin-top: 4px;
}

.brush-preview-dot {
    background: rgba(236, 72, 153, 0.35);
    border: 1.5px solid var(--oa-pink);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    transition: width 0.1s, height 0.1s;
}

/* Canvas Empty State */
.canvas-empty-state {
    width: 260px;
    max-width: 85%;
    padding: 20px 14px;
    text-align: center;
    border: 1.5px dashed rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 auto;
}

.canvas-empty-state:hover {
    border-color: var(--oa-pink);
    background: rgba(236, 72, 153, 0.04);
}

.empty-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(236, 72, 153, 0.15);
    color: var(--oa-pink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin: 0 auto 10px auto;
}

.empty-upload-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--oa-text-main);
    margin: 0 0 4px 0;
}

.empty-upload-hint {
    font-size: 11px;
    color: var(--oa-text-dim);
    margin: 0 0 12px 0;
    line-height: 1.35;
}

.btn-choose-file-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    background: #222131;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 11.5px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.canvas-empty-state:hover .btn-choose-file-pill {
    background: var(--oa-pink);
    border-color: var(--oa-pink);
}

/* OpenArt Edit Bottom Card */
.openart-edit-bottom-card {
    background: #171622;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 12px;
    margin: 0 14px 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex-shrink: 0;
}

.edit-prompt-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.edit-ref-slot {
    width: 52px;
    min-width: 52px;
    height: 52px;
    background: #1b1a26;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--oa-text-muted);
    font-size: 10px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.edit-ref-slot:hover {
    border-color: var(--oa-pink);
    color: #fff;
}

.edit-ref-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.edit-ref-preview {
    position: absolute;
    inset: 0;
}

.edit-ref-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-edit-ref {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.edit-prompt-input-wrapper {
    flex: 1;
}

#edit-prompt-input {
    width: 100%;
    height: 52px;
    background: #13121b;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 8px 10px;
    color: #f8fafc;
    font-size: 12.5px;
    resize: none;
    box-sizing: border-box;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}

#edit-prompt-input:focus {
    border-color: var(--oa-pink);
}

.edit-mode-pills-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pills-left-group {
    display: flex;
    gap: 6px;
}

.edit-mode-pill-btn {
    height: 30px;
    padding: 0 12px;
    border-radius: 8px;
    background: #1f1e2c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--oa-text-muted);
    font-size: 11.5px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edit-mode-pill-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.16);
}

.edit-mode-pill-btn.active {
    background: rgba(236, 72, 153, 0.18);
    border-color: #ec4899;
    color: #fff;
    box-shadow: 0 0 12px rgba(236, 72, 153, 0.3);
}

.edit-mode-pill-btn.loading i {
    animation: fa-spin 1s infinite linear;
}

.btn-clear-edit-prompt {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}

.btn-clear-edit-prompt:hover {
    color: #f43f5e;
}

.edit-action-model-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.edit-model-dropdown {
    position: relative;
}

.edit-model-dropdown .btn-edit-model {
    height: 36px;
    padding: 0 12px;
    background: #1f1e2c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    outline: none;
}

.edit-model-dropdown .openart-dropdown-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    z-index: 1000;
    min-width: 200px;
    background: #1c1b28;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    list-style: none;
    margin: 0;
}

.edit-model-dropdown.open .openart-dropdown-menu,
.edit-model-dropdown.show .openart-dropdown-menu {
    display: block !important;
}

.edit-model-dropdown .openart-dropdown-menu li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    color: var(--oa-text-muted);
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.edit-model-dropdown .openart-dropdown-menu li a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.edit-model-dropdown .openart-dropdown-menu li.active a {
    color: var(--oa-pink);
    background: rgba(236, 72, 153, 0.15);
}

.edit-model-dropdown .badge-mini {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--oa-text-dim);
}

.btn-openart-edit-generate {
    flex: 1;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 50%, #f43f5e 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(236, 72, 153, 0.45);
    transition: all 0.2s ease;
}

.btn-openart-edit-generate:hover {
    box-shadow: 0 6px 22px rgba(236, 72, 153, 0.65);
    transform: translateY(-1px);
}

.btn-openart-edit-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* OpenArt Bottom Dock (Chat | Tools) */
.openart-bottom-dock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 4px 14px 10px 14px;
    flex-shrink: 0;
}

.dock-tab-btn {
    height: 34px;
    padding: 0 20px;
    border-radius: 20px;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--oa-text-muted);
}

.dock-tab-btn:hover {
    color: #fff;
}

.dock-tab-btn.active {
    background: #f8fafc;
    color: #0c0b10;
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.25);
}

.dock-badge-new {
    position: absolute;
    top: -5px;
    right: 6px;
    background: #84cc16;
    color: #000;
    font-size: 8.5px;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 4px;
}

/* 2. Studio Action Cards (Tool, File Type, Style) */
.studio-action-card {
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: 12px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    min-height: 52px;
}

.studio-action-card:hover {
    background: var(--oa-bg-card-hover);
    border-color: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.action-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.card-icon-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.tool-avatar {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(168, 85, 247, 0.2));
    color: var(--oa-pink);
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.filetype-avatar {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(14, 165, 233, 0.2));
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.style-avatar {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(217, 70, 239, 0.2));
    color: #c084fc;
    border: 1px solid rgba(192, 132, 252, 0.3);
}

.card-text-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-badge-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--oa-text-dim);
    text-transform: uppercase;
    margin-bottom: 1px;
}

.card-main-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--oa-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.card-sub-hint {
    font-size: 11px;
    color: var(--oa-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
    margin-top: 1px;
}

.action-card-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.badge-select-indicator {
    font-size: 10px;
    font-weight: 600;
    color: var(--oa-text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chevron-nav {
    font-size: 12px;
    color: var(--oa-text-dim);
    transition: transform 0.2s ease;
}

.studio-action-card:hover .chevron-nav {
    color: var(--oa-text-main);
    transform: translateX(2px);
}

/* 3. Prompt Wrapper & OpenArt Visual Reference Box */
.studio-prompt-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
}

.prompt-section-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 0.3px;
    margin: 0;
}

.prompt-char-count {
    font-size: 11.5px;
    color: var(--oa-text-dim);
}

.prompt-editor-card {
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.25s ease;
}

.prompt-editor-card:focus-within {
    border-color: rgba(236, 72, 153, 0.5);
    box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.25), 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* OpenArt Visual References Card with Magenta Neon Glow */
.openart-ref-card {
    background: rgba(18, 16, 26, 0.92);
    border: 1.5px solid #ec4899;
    border-radius: 12px;
    box-shadow: 0 0 14px rgba(236, 72, 153, 0.35), inset 0 0 10px rgba(236, 72, 153, 0.06);
    padding: 9px 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    user-select: none;
}

.openart-ref-card:hover {
    border-color: #f43f5e;
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.55), inset 0 0 12px rgba(236, 72, 153, 0.1);
    background: rgba(24, 20, 36, 0.95);
}

.ref-card-main-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Realistic Fan Stack Graphic */
.ref-stack-visual {
    width: 44px;
    height: 34px;
    position: relative;
    flex-shrink: 0;
}

.ref-fan-stack {
    position: relative;
    width: 100%;
    height: 100%;
}

.fan-card {
    position: absolute;
    width: 20px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    top: 2px;
    transition: transform 0.25s ease;
}

.fan-card-1 {
    left: 0;
    transform: rotate(-10deg);
    background: linear-gradient(135deg, #10b981, #059669);
    z-index: 1;
}

.fan-card-2 {
    left: 6px;
    transform: rotate(-3deg);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    z-index: 2;
}

.fan-card-3 {
    left: 12px;
    transform: rotate(4deg);
    background: linear-gradient(135deg, #ec4899, #be185d);
    z-index: 3;
}

.fan-card-4 {
    left: 18px;
    transform: rotate(11deg);
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    z-index: 4;
}

.openart-ref-card:hover .fan-card-1 { transform: rotate(-14deg) translateX(-2px); }
.openart-ref-card:hover .fan-card-4 { transform: rotate(15deg) translateX(2px); }

.ref-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ref-title-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ref-main-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ref-optional-pill {
    font-size: 9.5px;
    font-weight: 600;
    color: #ec4899;
    background: rgba(236, 72, 153, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.ref-sub-hint {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ref-counter-pill {
    font-size: 11px;
    font-weight: 700;
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.ref-counter-pill.has-refs {
    background: rgba(236, 72, 153, 0.2);
    border-color: #ec4899;
    color: #fff;
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
}

/* Uploaded Thumbnails Strip (Up to 4 images) */
.ref-thumbnails-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.ref-thumbnails-list {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ref-thumb-item {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    background: #000;
}

.ref-thumb-item .thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.btn-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 17px;
    height: 17px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-thumb-remove:hover {
    background: #ef4444;
    border-color: #ef4444;
}

.btn-add-more-refs {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    border: 1.5px dashed rgba(236, 72, 153, 0.45);
    background: rgba(236, 72, 153, 0.06);
    color: #ec4899;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-more-refs:hover {
    background: rgba(236, 72, 153, 0.16);
    border-color: #ec4899;
    color: #fff;
}

.ref-upload-spinner {
    font-size: 11px;
    color: #ec4899;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 4px;
}

/* Prompt Textarea (Comfortable, Large Chat Box) */
.studio-prompt-textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--oa-text-main);
    font-size: 13.5px;
    line-height: 1.6;
    resize: vertical;
    min-height: 130px;
    padding: 6px 4px;
    box-sizing: border-box;
    font-family: inherit;
}

.studio-prompt-textarea::placeholder {
    color: var(--oa-text-dim);
    font-size: 13px;
    line-height: 1.5;
}

/* Prompt Card Toolbar */
.prompt-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding-top: 8px;
    margin-top: 2px;
}

.toolbar-left-tools {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-prompt-subtle {
    background: transparent;
    border: none;
    color: var(--oa-text-dim);
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12.5px;
    transition: all 0.2s ease;
}

.btn-prompt-subtle:hover {
    color: var(--oa-text-main);
    background: rgba(255, 255, 255, 0.08);
}

.toolbar-right-tools {
    display: flex;
    align-items: center;
}

.auto-polish-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auto-polish-text {
    font-size: 11.5px;
    font-weight: 500;
    color: var(--oa-text-muted);
}

/* OpenArt Switch Toggle */
.openart-switch {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 15px;
    margin: 0;
    cursor: pointer;
}

.openart-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #333242;
    border-radius: 15px;
    transition: all 0.25s ease;
}

.switch-track:before {
    position: absolute;
    content: "";
    height: 11px;
    width: 11px;
    left: 2px;
    bottom: 2px;
    background-color: #fff;
    border-radius: 50%;
    transition: all 0.25s ease;
}

.openart-switch input:checked + .switch-track {
    background: var(--oa-pink);
}

.openart-switch input:checked + .switch-track:before {
    transform: translateX(13px);
}

/* 4. Output & Quality Row (2 columns) */
.studio-double-cards-row {
    display: flex;
    gap: 10px;
}

.studio-split-card {
    flex: 1;
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    min-height: 48px;
    transition: all 0.2s ease;
}

.studio-split-card:hover {
    background: var(--oa-bg-card-hover);
    border-color: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.split-card-icon {
    font-size: 15px;
    color: var(--oa-pink);
}

.split-card-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.split-card-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--oa-text-dim);
    text-transform: uppercase;
    margin-bottom: 1px;
}

.split-card-val {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--oa-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.split-chevron {
    font-size: 11px;
    color: var(--oa-text-dim);
}

.quality-tag-badge {
    font-size: 10px;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    padding: 1px 6px;
    border-radius: 6px;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* 5. Sticky Bottom Action Controls */
.studio-sidebar-bottom-sticky {
    flex-shrink: 0;
    padding: 12px 14px 14px 14px;
    background: #0f0e16;
    border-top: 1px solid var(--oa-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 0 0 15px 15px;
}

.generate-control-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.samples-stepper-control {
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    padding: 2px;
    height: 38px;
}

.stepper-action-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--oa-text-muted);
    width: 22px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

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

.stepper-number-display {
    font-size: 12px;
    font-weight: 700;
    color: var(--oa-text-main);
    padding: 0 4px;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.stepper-max-label {
    font-size: 10px;
    color: var(--oa-text-dim);
    font-weight: 500;
}

/* Gradient Glowing Generate Button */
.btn-openart-generate-main {
    flex: 1;
    height: 38px;
    background: var(--oa-gradient-btn);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.45);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.btn-openart-generate-main:hover {
    background: var(--oa-gradient-btn-hover);
    box-shadow: 0 6px 26px rgba(236, 72, 153, 0.65);
    transform: translateY(-1px);
}

.btn-openart-generate-main:active {
    transform: translateY(0);
}

.btn-generate-cost-badge {
    background: rgba(0, 0, 0, 0.28);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.btn-generate-cost-badge i {
    color: #fbbf24;
}

.sidebar-bottom-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    line-height: 1.3;
}

.user-credits-pill-badge {
    color: var(--oa-text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-credits-pill-badge i {
    color: #fbbf24;
}

.btn-topup-link {
    color: var(--oa-pink);
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}

.btn-topup-link:hover {
    text-decoration: underline;
    color: #f43f5e;
}

.meta-text-btn {
    background: transparent;
    border: none;
    color: var(--oa-text-dim);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

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


/* ==========================================================================
   5. KHỐI 4: Ô CÁC ẢNH ĐÃ TẠO (Canvas Floating Island)
   ========================================================================== */
.openart-studio-canvas {
    flex: 1 !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    min-width: 0 !important;
    background: #13121b !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

.openart-studio-canvas:hover {
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(236, 72, 153, 0.03) !important;
}

/* Top Toolbar */
.canvas-top-toolbar {
    height: 52px;
    border-bottom: 1px solid var(--oa-border);
    border-radius: 15px 15px 0 0;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(16, 15, 24, 0.85);
    backdrop-filter: blur(12px);
    z-index: 5;
    flex-shrink: 0;
}

.toolbar-left-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn-filter-dropdown {
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: var(--oa-radius-sm);
    color: var(--oa-text-main);
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.btn-filter-dropdown:hover {
    background: var(--oa-bg-card-hover);
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--oa-text-dim);
}

/* Canvas Top Category Filter (dropdown styles defined below) */

.canvas-nav-pills {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-pill-btn {
    background: transparent;
    border: none;
    color: var(--oa-text-dim);
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-pill-btn:hover {
    color: var(--oa-text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-pill-btn.active {
    color: var(--oa-pink);
    background: rgba(236, 72, 153, 0.1);
}

.toolbar-right-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.canvas-zoom-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: var(--oa-radius-sm);
    padding: 4px 8px;
}

.zoom-icon {
    font-size: 11px;
    color: var(--oa-text-dim);
    cursor: pointer;
}

.zoom-icon:hover {
    color: var(--oa-text-main);
}

.zoom-range-input {
    width: 60px;
    accent-color: var(--oa-pink);
    cursor: pointer;
}

.canvas-view-mode-group {
    display: flex;
    align-items: center;
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: var(--oa-radius-sm);
    padding: 2px;
}

.btn-view-mode {
    background: transparent;
    border: none;
    color: var(--oa-text-dim);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.btn-view-mode.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Canvas Notice Banner */
.canvas-notice-banner {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notice-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notice-shield-icon {
    color: #818cf8;
    font-size: 15px;
}

.notice-text {
    font-size: 12.5px;
    color: #cbd5e1;
}

.notice-text strong {
    color: #fff;
}

.notice-dismiss-btn {
    background: transparent;
    border: none;
    color: var(--oa-text-dim);
    font-size: 13px;
    cursor: pointer;
}

.notice-dismiss-btn:hover {
    color: #fff;
}

/* Templates Quick Drawer */
.canvas-templates-drawer {
    background: #14131e;
    border-bottom: 1px solid var(--oa-border);
    padding: 14px 20px;
}

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

.templates-drawer-title {
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-templates {
    background: transparent;
    border: none;
    color: var(--oa-text-dim);
    cursor: pointer;
    font-size: 14px;
}

.templates-grid-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.templates-grid-scroll::-webkit-scrollbar {
    height: 4px;
}
.templates-grid-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.template-card-item {
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: var(--oa-radius-sm);
    padding: 12px;
    min-width: 220px;
    max-width: 220px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.template-card-item:hover {
    border-color: var(--oa-pink);
    transform: translateY(-2px);
    background: var(--oa-bg-card-hover);
}

.tmpl-badge {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--oa-pink);
    background: rgba(236, 72, 153, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 6px;
}

.template-card-item h4 {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 4px 0;
}

.template-card-item p {
    font-size: 11.5px;
    color: var(--oa-text-muted);
    margin: 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Timeline Container */
.canvas-timeline-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.canvas-timeline-container::-webkit-scrollbar {
    width: 6px;
}
.canvas-timeline-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Generating Progress Card */
.canvas-generating-card {
    background: #1a1928;
    border: 1px solid rgba(236, 72, 153, 0.4);
    border-radius: var(--oa-radius);
    padding: 20px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.15);
}

.generating-card-shimmer {
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: shimmerSlide 2s infinite;
}

@keyframes shimmerSlide {
    0% { left: -100%; }
    100% { left: 200%; }
}

.generating-card-body {
    display: flex;
    align-items: center;
    gap: 16px;
}

.generating-spinner-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(236, 72, 153, 0.2);
    border-top-color: var(--oa-pink);
    animation: ringSpin 1s linear infinite;
    flex-shrink: 0;
}

@keyframes ringSpin {
    to { transform: rotate(360deg); }
}

.generating-meta-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.generating-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.generating-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.generating-timer-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--oa-pink);
    background: rgba(236, 72, 153, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
}

.generating-step-desc {
    font-size: 12.5px;
    color: var(--oa-text-muted);
    margin: 0;
}

.generating-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

.generating-progress-bar {
    height: 100%;
    background: var(--oa-gradient-btn);
    transition: width 0.3s ease;
}

/* Timeline Month Section */
.timeline-month-section {
    margin-bottom: 32px;
}

.timeline-header-row {
    margin-bottom: 16px;
}

.timeline-title-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.timeline-toggle-chevron {
    font-size: 12px;
    color: var(--oa-text-dim);
}

.timeline-group-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.timeline-count-badge {
    font-size: 11.5px;
    color: var(--oa-text-dim);
    font-weight: 500;
}

/* =========================================================================
   Creations Gallery - Masonry & Grid View with Zoom levels
   ========================================================================= */

/* 1. Masonry View (Default & .masonry-view) */
.timeline-creations-grid.masonry-view,
.timeline-creations-grid:not(.grid-view) {
    display: block !important;
    column-gap: 16px;
    width: 100%;
}

.timeline-creations-grid.masonry-view.zoom-level-1,
.timeline-creations-grid:not(.grid-view).zoom-level-1 {
    column-count: 5;
}

.timeline-creations-grid.masonry-view.zoom-level-2,
.timeline-creations-grid:not(.grid-view).zoom-level-2 {
    column-count: 4;
}

.timeline-creations-grid.masonry-view.zoom-level-3,
.timeline-creations-grid:not(.grid-view).zoom-level-3 {
    column-count: 3;
}

@media (max-width: 1680px) {
    .timeline-creations-grid.masonry-view.zoom-level-1,
    .timeline-creations-grid:not(.grid-view).zoom-level-1 { column-count: 4; }
    .timeline-creations-grid.masonry-view.zoom-level-2,
    .timeline-creations-grid:not(.grid-view).zoom-level-2 { column-count: 3; }
    .timeline-creations-grid.masonry-view.zoom-level-3,
    .timeline-creations-grid:not(.grid-view).zoom-level-3 { column-count: 2; }
}

@media (max-width: 1200px) {
    .timeline-creations-grid.masonry-view.zoom-level-1,
    .timeline-creations-grid:not(.grid-view).zoom-level-1 { column-count: 3; }
    .timeline-creations-grid.masonry-view.zoom-level-2,
    .timeline-creations-grid:not(.grid-view).zoom-level-2 { column-count: 2; }
    .timeline-creations-grid.masonry-view.zoom-level-3,
    .timeline-creations-grid:not(.grid-view).zoom-level-3 { column-count: 2; }
}

@media (max-width: 768px) {
    .timeline-creations-grid.masonry-view.zoom-level-1,
    .timeline-creations-grid.masonry-view.zoom-level-2,
    .timeline-creations-grid.masonry-view.zoom-level-3,
    .timeline-creations-grid:not(.grid-view).zoom-level-1,
    .timeline-creations-grid:not(.grid-view).zoom-level-2,
    .timeline-creations-grid:not(.grid-view).zoom-level-3 {
        column-count: 1 !important;
    }
}

/* 2. Grid View (.grid-view) */
.timeline-creations-grid.grid-view {
    display: grid !important;
    gap: 16px;
    column-count: auto !important;
}

.timeline-creations-grid.grid-view.zoom-level-1 {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
}
.timeline-creations-grid.grid-view.zoom-level-2 {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
}
.timeline-creations-grid.grid-view.zoom-level-3 {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)) !important;
}

/* Creation Card Item */
.creation-item-card {
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: var(--oa-radius);
    overflow: hidden;
    transition: all 0.25s ease;
    position: relative;
}

/* Card in Masonry mode */
.timeline-creations-grid.masonry-view .creation-item-card,
.timeline-creations-grid:not(.grid-view) .creation-item-card {
    display: inline-block;
    width: 100%;
    margin-bottom: 16px;
    break-inside: avoid;
    page-break-inside: avoid;
    vertical-align: top;
}

/* Card in Grid mode */
.timeline-creations-grid.grid-view .creation-item-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.creation-item-card:hover {
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

/* Card Media Wrapper */
.card-media-wrapper {
    position: relative;
    width: 100%;
    background: #0f0e15;
    overflow: hidden;
}

/* Masonry Media: Natural Aspect Ratio (No crop, full image visible) */
.timeline-creations-grid.masonry-view .card-media-wrapper,
.timeline-creations-grid:not(.grid-view) .card-media-wrapper {
    padding-top: 0 !important;
    height: auto !important;
    display: block !important;
}

.timeline-creations-grid.masonry-view .card-thumb-img,
.timeline-creations-grid:not(.grid-view) .card-thumb-img {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
    object-fit: contain !important;
    transition: transform 0.3s ease;
}

/* Grid Media: 1:1 Square Box */
.timeline-creations-grid.grid-view .card-media-wrapper {
    padding-top: 100% !important;
}

.timeline-creations-grid.grid-view .card-thumb-img {
    position: absolute !important;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover !important;
    transition: transform 0.3s ease;
}

.creation-item-card:hover .card-thumb-img {
    transform: scale(1.03);
}

.card-top-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    z-index: 2;
}

.card-type-badge {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-ratio-badge {
    font-size: 10px;
    color: var(--oa-text-muted);
    background: rgba(0, 0, 0, 0.55);
    padding: 3px 6px;
    border-radius: 6px;
}

/* Card Hover Actions Overlay */
.card-hover-actions {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.creation-item-card:hover .card-hover-actions {
    opacity: 1;
}

.btn-card-action {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(24, 23, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-card-action:hover {
    background: var(--oa-pink);
    border-color: var(--oa-pink);
    transform: scale(1.1);
    color: #fff;
}

/* Fallback: Ensure download icon always renders fa-download unicode */
.fa-arrow-down-to-bracket:before,
.btn-action-download i:before,
#tool-upscale-download-btn i:before {
    content: "\f019" !important;
}

.card-caption-meta {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-prompt-text {
    font-size: 12px;
    color: var(--oa-text-main);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-time-text {
    font-size: 10.5px;
    color: var(--oa-text-dim);
}

/* Canvas Empty State */
.canvas-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    max-width: 540px;
    margin: 40px auto;
}

.empty-icon-glow {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: var(--oa-pink);
    font-size: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.25);
}

.empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.empty-subtitle {
    font-size: 13.5px;
    color: var(--oa-text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

.empty-quick-templates {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.btn-quick-sample {
    background: var(--oa-bg-card);
    border: 1px solid var(--oa-border);
    border-radius: var(--oa-radius-sm);
    color: var(--oa-text-muted);
    font-size: 13px;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.btn-quick-sample:hover {
    background: var(--oa-bg-card-hover);
    border-color: var(--oa-pink);
    color: #fff;
    transform: translateX(3px);
}


/* ==========================================================================
   STUDIO SIDE FLYOUT PANELS (Slide in from left: 380px smoothly on the right)
   ========================================================================== */

/* Active indicator on sidebar card when flyout is open */
.studio-action-card.active-flyout,
.studio-split-card.active-flyout {
    border-color: var(--oa-pink) !important;
    background: rgba(236, 72, 153, 0.12) !important;
    box-shadow: 0 0 16px rgba(236, 72, 153, 0.3) !important;
}

/* Flyout Backdrop */
.studio-flyout-backdrop {
    position: absolute;
    top: 0;
    left: 450px;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 450 !important;
    opacity: 0;
    pointer-events: none;
    border-radius: 16px;
    transition: opacity 0.25s ease;
}

.studio-flyout-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* Side Flyout Panel */
.studio-side-flyout {
    position: absolute;
    left: 450px;
    top: 0;
    bottom: 0;
    width: 540px;
    max-width: calc(100vw - 470px);
    background: #13121d;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.04);
    z-index: 500 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(-20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.studio-side-flyout.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* Flyout Header */
.flyout-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: #100f18;
    flex-shrink: 0;
}

.flyout-title-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.flyout-title-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flyout-header-icon {
    font-size: 16px;
}

.flyout-header-icon.text-pink { color: #ec4899; }
.flyout-header-icon.text-purple { color: #a855f7; }

.flyout-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.flyout-subtitle {
    font-size: 11.5px;
    color: #94a3b8;
}

.btn-close-flyout {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #94a3b8 !important;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s ease;
}

.btn-close-flyout:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
}

/* Flyout Body (scrollable) */
.flyout-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.flyout-body::-webkit-scrollbar {
    width: 6px;
}
.flyout-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   FLYOUT: CÔNG CỤ THIẾT KẾ ẢNH (Image Tools)
   -------------------------------------------------------------------------- */
.tools-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.tool-card-box {
    background: #191827 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 132px;
    text-align: left !important;
    user-select: none;
}

.tool-card-box:hover {
    background: #222036 !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
}

.tool-card-box.active {
    background: rgba(236, 72, 153, 0.08) !important;
    border-color: #ec4899 !important;
    box-shadow: 0 0 22px rgba(236, 72, 153, 0.28) !important;
}

.tool-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.tool-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.tool-card-box:hover .tool-icon-box {
    transform: scale(1.08);
}

/* Tool Gradient Themes */
.grad-pink-purple { background: linear-gradient(135deg, #ec4899, #8b5cf6); box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35); }
.grad-blue-indigo { background: linear-gradient(135deg, #3b82f6, #6366f1); box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35); }
.grad-emerald-teal { background: linear-gradient(135deg, #10b981, #06b6d4); box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35); }
.grad-amber-orange { background: linear-gradient(135deg, #f59e0b, #ea580c); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35); }
.grad-cyan-sky { background: linear-gradient(135deg, #06b6d4, #3b82f6); box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35); }
.grad-rose-pink { background: linear-gradient(135deg, #f43f5e, #fb7185); box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35); }
.grad-purple-fuchsia { background: linear-gradient(135deg, #8b5cf6, #d946ef); box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35); }
.grad-slate-zinc { background: linear-gradient(135deg, #64748b, #475569); box-shadow: 0 4px 14px rgba(100, 116, 139, 0.35); }
.grad-orange-red { background: linear-gradient(135deg, #f97316, #ef4444); box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35); }

.tool-status-badge.active {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

.tool-status-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 6px #34d399;
    animation: toolPulseDot 2s infinite;
}

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

.tool-action-tag {
    color: #475569;
    font-size: 12px;
    transition: all 0.2s ease;
}

.tool-card-box:hover .tool-action-tag {
    color: #f1f5f9;
    transform: translateX(2px);
}

.tool-box-title {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 4px 0;
}

.tool-box-desc {
    font-size: 11.5px;
    color: #94a3b8;
    line-height: 1.4;
    margin: 0;
}

/* --------------------------------------------------------------------------
   FLYOUT: CHỌN LOẠI FILE (File Types Grid & Filter Chips)
   -------------------------------------------------------------------------- */
.filetype-search-bar {
    position: relative;
    flex-shrink: 0 !important;
    margin-bottom: 4px;
}

.filetype-search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 13.5px;
    pointer-events: none;
}

#fileTypeSearchInput {
    width: 100% !important;
    height: 42px !important;
    background: #181726 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    padding: 0 38px 0 40px !important;
    color: #f8fafc !important;
    font-size: 13px !important;
    outline: none !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#fileTypeSearchInput:focus {
    border-color: #a855f7 !important;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.25) !important;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 13px;
}

.search-clear-btn:hover {
    color: #fff !important;
}

/* Category Filter Chips */
.filetype-cat-chips-bar {
    display: flex !important;
    flex-shrink: 0 !important;
    align-items: center !important;
    gap: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 6px 2px 10px 2px !important;
    margin-bottom: 6px !important;
    min-height: 48px !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
}

.filetype-cat-chips-bar::-webkit-scrollbar {
    display: none !important;
}

.cat-chip-btn {
    flex-shrink: 0 !important;
    padding: 7px 16px !important;
    height: 34px !important;
    border-radius: 20px !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    background: #1c1b2c !important;
    color: #94a3b8 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    outline: none !important;
}

.cat-chip-btn span {
    white-space: nowrap !important;
    display: inline-block !important;
    line-height: 1 !important;
}

.cat-chip-btn:hover {
    background: #252438 !important;
    color: #f1f5f9 !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
}

.cat-chip-btn.active {
    background: linear-gradient(135deg, #a855f7, #ec4899) !important;
    color: #fff !important;
    font-weight: 600 !important;
    border-color: transparent !important;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35) !important;
}

/* Results Scrollable */
.filetype-results-scrollable {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filetype-group-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filetype-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.filetype-group-title .group-title-text {
    color: #94a3b8;
}

.filetype-group-title .group-count-badge {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10.5px;
    color: #64748b;
}

.filetype-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.filetype-item-card {
    background: #191827 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left !important;
    position: relative;
    user-select: none;
    min-height: 58px;
}

.filetype-item-card:hover {
    background: #222036 !important;
    border-color: rgba(168, 85, 247, 0.45) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.filetype-item-card.active {
    background: rgba(168, 85, 247, 0.12) !important;
    border-color: #a855f7 !important;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.28) !important;
}

.filetype-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.filetype-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    border: 1px solid;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.filetype-item-card:hover .filetype-card-icon {
    transform: scale(1.08);
}

.filetype-card-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.filetype-name-primary {
    font-size: 12.5px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.filetype-hint-tag {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filetype-check-bubble {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: transparent;
    flex-shrink: 0;
    margin-left: 6px;
    transition: all 0.2s ease;
}

.filetype-item-card.active .filetype-check-bubble {
    background: #a855f7;
    border-color: #a855f7;
    color: #fff;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.6);
}

/* Flyout Footer (for Output) */
.flyout-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: #100f18;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   FLYOUT: PHONG CÁCH THIẾT KẾ (Design Styles Grid, Cards & Filters)
   -------------------------------------------------------------------------- */
.style-search-bar {
    position: relative;
    flex-shrink: 0 !important;
    margin-bottom: 4px;
}

.style-search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 13.5px;
    pointer-events: none;
}

#styleSearchInput {
    width: 100% !important;
    height: 42px !important;
    background: #181726 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    padding: 0 38px 0 40px !important;
    color: #f8fafc !important;
    font-size: 13px !important;
    outline: none !important;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#styleSearchInput:focus {
    border-color: #a855f7 !important;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.25) !important;
}

.style-cat-chips-bar {
    display: flex !important;
    flex-shrink: 0 !important;
    align-items: center !important;
    gap: 8px !important;
    overflow-x: auto !important;
    padding: 2px 2px 8px 2px !important;
    margin-bottom: 8px !important;
    min-height: 44px !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
}

.style-cat-chips-bar::-webkit-scrollbar {
    display: none !important;
}

.style-cat-chip-btn {
    flex-shrink: 0 !important;
    padding: 6px 14px !important;
    height: 32px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    background: #1c1b2c !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
    outline: none !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
}

.style-cat-chip-btn:hover {
    background: #252438 !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
}

.style-cat-chip-btn.active {
    background: linear-gradient(135deg, #a855f7, #ec4899) !important;
    color: #fff !important;
    font-weight: 600 !important;
    border-color: transparent !important;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35) !important;
}

/* Style Cards Grid */
.styles-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Individual Style Card */
.style-item-card {
    background: #181726 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    padding: 12px 10px 14px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    cursor: pointer !important;
    position: relative !important;
    overflow: hidden !important;
    user-select: none !important;
    transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
    outline: none !important;
    box-shadow: none !important;
    width: 100% !important;
}

.style-item-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: radial-gradient(circle at 50% -10px, rgba(255, 255, 255, 0.05), transparent 70%);
    pointer-events: none;
    transition: all 0.24s ease;
}

.style-item-card:hover {
    background: #211f34 !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55) !important;
}

.style-item-card:hover::before {
    background: radial-gradient(circle at 50% -10px, rgba(168, 85, 247, 0.2), transparent 70%);
}

.style-item-card.active {
    background: rgba(168, 85, 247, 0.12) !important;
    border-color: #a855f7 !important;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.35), inset 0 0 14px rgba(168, 85, 247, 0.08) !important;
}

.style-card-top-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    min-height: 20px;
}

.style-card-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
    line-height: 1.3;
}

.style-item-card:hover .style-card-badge {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.style-item-card.active .style-card-badge {
    background: rgba(168, 85, 247, 0.25);
    border-color: rgba(168, 85, 247, 0.5);
    color: #e9d5ff;
}

.style-check-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8.5px;
    color: transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.style-item-card.active .style-check-indicator {
    background: #a855f7;
    border-color: #a855f7;
    color: #fff;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.7);
    transform: scale(1.05);
}

.style-card-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    margin: 4px 0 10px 0;
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s ease;
    flex-shrink: 0;
}

.style-item-card:hover .style-card-icon-box {
    transform: scale(1.1);
}

/* Style Card Gradients */
.grad-auto { background: linear-gradient(135deg, #a855f7, #ec4899); box-shadow: 0 4px 16px rgba(168, 85, 247, 0.4); }
.grad-hot { background: linear-gradient(135deg, #06b6d4, #3b82f6); box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4); }
.grad-vip { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4); }
.grad-3d { background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4); }
.grad-clean { background: linear-gradient(135deg, #64748b, #94a3b8); box-shadow: 0 4px 16px rgba(100, 116, 139, 0.4); }
.grad-pop { background: linear-gradient(135deg, #f97316, #ec4899); box-shadow: 0 4px 16px rgba(249, 115, 22, 0.4); }
.grad-vintage { background: linear-gradient(135deg, #b45309, #78350f); box-shadow: 0 4px 16px rgba(180, 83, 9, 0.4); }
.grad-anime { background: linear-gradient(135deg, #f43f5e, #fb7185); box-shadow: 0 4px 16px rgba(244, 63, 94, 0.4); }
.grad-neon { background: linear-gradient(135deg, #10b981, #06b6d4); box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4); }
.grad-text { background: linear-gradient(135deg, #8b5cf6, #3b82f6); box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4); }
.grad-flat { background: linear-gradient(135deg, #10b981, #14b8a6); box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4); }
.grad-photo { background: linear-gradient(135deg, #0284c7, #0ea5e9); box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4); }
.grad-art { background: linear-gradient(135deg, #ef4444, #f59e0b); box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4); }
.grad-cute { background: linear-gradient(135deg, #ec4899, #f43f5e); box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4); }

.style-card-text-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.style-card-title {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
    margin: 0 0 3px 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    line-height: 1.25 !important;
}

.style-item-card:hover .style-card-title {
    color: #fff !important;
}

.style-card-subtitle {
    font-size: 10.5px !important;
    color: #94a3b8 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    line-height: 1.2 !important;
}

.style-search-empty {
    text-align: center;
    padding: 36px 16px;
    color: #64748b;
}

@media (max-width: 480px) {
    .styles-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Guarantee Top Day / leo-nav is omitted on AI studio page */
.openart-studio-page .leo-nav {
    display: none !important;
}

/* Fix Canvas Top Dropdown Positioning & Ensure Hidden By Default */
.custom-filter-dropdown {
    position: relative !important;
}

.custom-filter-dropdown .openart-dropdown-menu {
    display: none !important;
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 0 !important;
    margin: 0 !important;
    z-index: 120 !important;
    background: #171624 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75) !important;
    padding: 6px 0 !important;
    min-width: 210px !important;
    list-style: none !important;
    backdrop-filter: blur(8px);
}

.custom-filter-dropdown.open .openart-dropdown-menu,
.custom-filter-dropdown .openart-dropdown-menu.show {
    display: block !important;
    animation: fadeInDropdown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.openart-dropdown-menu li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.openart-dropdown-menu li a {
    color: #94a3b8 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    transition: all 0.15s ease !important;
}

.openart-dropdown-menu li:hover a {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

.openart-dropdown-menu li.active a {
    color: #ec4899 !important;
    font-weight: 600 !important;
    background: rgba(236, 72, 153, 0.12) !important;
}

/* Mobile Flyout Adaptations */
@media (max-width: 991px) {
    .studio-flyout-backdrop {
        left: 0;
    }
    .studio-side-flyout {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        border-right: none;
        border-top: 1px solid var(--oa-border);
        transform: translateY(30px);
    }
    .studio-side-flyout.open {
        transform: translateY(0);
    }
    .filetype-cards-grid,
    .tools-grid-layout {
        grid-template-columns: 1fr;
    }
}

/* Hide standard theme footer on AI Studio page */
.king-footer,
footer.king-footer {
    display: none !important;
}

/* High z-index for Modals in AI Studio to ensure overlay is on top of islands */
#upscalemodal,
#rechargemodal,
#sepaypaymentmodal,
#loginmodal {
    z-index: 99999 !important;
}
.modal-backdrop {
    z-index: 99990 !important;
}

/* =============================================================================
   FLYOUT 4: OUTPUT (ASPECT RATIO, RESOLUTION & CUSTOM PIXELS)
   ============================================================================= */

#flyout-output .flyout-body {
    padding: 20px 22px;
    gap: 22px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.output-dialog-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.output-dialog-section .section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.output-dialog-section .section-title i {
    color: #a855f7;
    font-size: 14px;
}

.section-hint-sub {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* Aspect Ratio Cards Grid: 4 columns for modern bento look */
.aspect-ratio-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.aspect-ratio-card {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 6px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
    min-height: 88px;
    text-align: center;
}

.aspect-ratio-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.aspect-ratio-card.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(236, 72, 153, 0.12));
    border-color: #a855f7;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.35), inset 0 0 0 1px #a855f7;
}

/* Ratio Wireframe Preview */
.ratio-wireframe-box {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ratio-rect-indicator {
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    transition: all 0.2s ease;
}

.aspect-ratio-card:hover .ratio-rect-indicator {
    background: rgba(168, 85, 247, 0.3);
    border-color: #c084fc;
}

.aspect-ratio-card.active .ratio-rect-indicator {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-color: #fff;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

.ratio-label-text {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.01em;
}

.aspect-ratio-card.active .ratio-label-text {
    color: #fff;
}

.ratio-sub-text {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 95%;
    line-height: 1.2;
}

.aspect-ratio-card.active .ratio-sub-text {
    color: #e9d5ff;
    font-weight: 500;
}

/* Active Check Indicator on card */
.ratio-card-check {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #a855f7;
    color: #fff;
    font-size: 9px;
    display: none;
    align-items: center;
    justify-content: center;
}

.aspect-ratio-card.active .ratio-card-check {
    display: flex;
}

/* Resolution Segmented Tabs */
.resolution-segmented-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.res-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    text-align: left;
    display: flex;
    align-items: center;
}

.res-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.res-tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(168, 85, 247, 0.45);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.res-tab-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.res-badge-pill {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.res-tab-btn.active .res-badge-pill {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.5);
}

.res-text-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.res-title {
    font-size: 12px;
    font-weight: 700;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.res-hint {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.res-tab-btn.active .res-hint {
    color: #cbd5e1;
}

/* Custom Size Section */
.custom-size-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 16px;
}

.custom-size-section .section-label-row {
    margin-bottom: 12px;
}

.section-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.custom-size-inputs-row {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: opacity 0.25s ease;
}

.input-pixel-group {
    flex: 1;
    display: flex;
    align-items: center;
    background: #0d0c14;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 2px 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-pixel-group:focus-within {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.pixel-affix {
    font-size: 12px;
    font-weight: 800;
    color: #a855f7;
    margin-right: 6px;
}

.input-pixel-val {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    padding: 8px 0;
    width: 100%;
}

.pixel-unit {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-left: 6px;
}

.btn-aspect-link {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    flex-shrink: 0;
}

.btn-aspect-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.btn-aspect-link.active {
    background: rgba(168, 85, 247, 0.15);
    border-color: #a855f7;
    color: #c084fc;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

/* Modern iOS-style Switch */
.openart-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
    margin: 0;
}

.openart-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    transition: all 0.25s ease;
}

.switch-track:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.openart-switch input:checked + .switch-track {
    background: linear-gradient(135deg, #a855f7, #ec4899);
}

.openart-switch input:checked + .switch-track:before {
    transform: translateX(20px);
}

/* Flyout Footer & Action Buttons */
.flyout-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    background: #100f18;
    flex-shrink: 0;
}

.btn-dialog-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-dialog-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-dialog-primary {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 24px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

.btn-dialog-primary:hover {
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.6);
    transform: translateY(-1px);
}

@media (max-width: 580px) {
    .aspect-ratio-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .resolution-segmented-tabs {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   MODE 3: UPSCALE STUDIO STYLES (Matching Sửa Ảnh AI)
   ========================================================================== */
.upscale-mode-card {
    margin: 4px 14px 4px 14px;
    min-height: 52px;
}

.upscale-avatar-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
}

.empty-icon-circle.upscale-icon-glow {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.2);
}

.upscale-canvas-stage {
    position: relative;
    user-select: none;
    transform-origin: center center;
    transition: transform 0.08s ease-out;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    border-radius: 8px;
    overflow: hidden;
    background: repeating-conic-gradient(#15141f 0% 25%, #100f19 0% 50%) 50% / 16px 16px;
    flex-shrink: 0 !important;
    margin: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

.upscale-compare-box {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#upscaleBaseImage {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    object-fit: contain;
}

.upscale-after-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

#upscaleResultImage {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    object-fit: contain;
}

/* Interactive Split Divider */
.upscale-split-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #ffffff;
    cursor: ew-resize;
    z-index: 25;
    transform: translateX(-50%);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.7);
}

.split-line {
    width: 100%;
    height: 100%;
}

.split-handle-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    cursor: ew-resize;
    user-select: none;
}

.upscale-badge-label {
    position: absolute;
    bottom: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
    z-index: 20;
    user-select: none;
    pointer-events: none;
}

.upscale-badge-label.badge-before {
    left: 10px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    backdrop-filter: blur(4px);
}

.upscale-badge-label.badge-after {
    right: 10px;
    background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.4);
}

/* Resolution Selector Row */
.upscale-res-selector-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 2px;
}

.upscale-res-pill {
    background: #1b1a25;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
    user-select: none;
}

.upscale-res-pill:hover {
    border-color: rgba(56, 189, 248, 0.35);
    background: #222130;
}

.upscale-res-pill.active {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.15);
}

.pill-badge-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pill-res-title {
    font-weight: 700;
    font-size: 13px;
    color: #f8fafc;
}

.upscale-res-pill.active .pill-res-title {
    color: #38bdf8;
}

.pill-res-cost {
    font-size: 10px;
    color: #fbbf24;
    font-weight: 600;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
    padding: 1px 5px;
    border-radius: 4px;
}

.pill-res-sub {
    font-size: 10.5px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upscale-credits-indicator {
    font-size: 12px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-recharge-inline {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
    font-size: 11px;
    background: rgba(56, 189, 248, 0.12);
    padding: 2px 7px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-recharge-inline:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #fff;
    text-decoration: none;
}

.btn-openart-upscale-main {
    background: linear-gradient(135deg, #0284c7 0%, #38bdf8 50%, #818cf8 100%) !important;
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.35) !important;
}

.btn-openart-upscale-main:hover {
    background: linear-gradient(135deg, #0369a1 0%, #0284c7 50%, #6366f1 100%) !important;
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.5) !important;
}

/* Processing Overlay */
.upscale-processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(12, 11, 16, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    border-radius: 14px;
}

.processing-card {
    text-align: center;
    max-width: 280px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.processing-glow-ring {
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.processing-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(56, 189, 248, 0.15);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.processing-title {
    font-size: 15px;
    font-weight: 600;
    color: #f8fafc;
    margin: 0;
}

.processing-sub {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.4;
}

.processing-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    width: 10%;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    transition: width 0.4s ease;
}

#upscaleCanvasViewport {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    padding: 12px !important;
}

#upscaleCanvasEmptyState[style*="display: none"],
#upscaleCanvasEmptyState[style*="display:none"] {
    display: none !important;
}

/* Header Credits & Recharge Pill */
.header-right .header-credits-item {
    list-style: none !important;
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
}
.header-right .header-credits-pill {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    height: 40px !important;
    line-height: normal !important;
    padding: 0 8px 0 13px !important;
    background: #0c0b0d !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 20px !important;
    color: #ffffff !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}
.header-right .header-credits-pill:hover {
    background: #16151f !important;
    border-color: rgba(255, 184, 108, 0.5) !important;
    box-shadow: 0 4px 16px rgba(255, 184, 108, 0.22) !important;
    transform: translateY(-1px);
    color: #ffffff !important;
}
.header-right .header-coin-icon {
    color: #ffb86c !important;
    font-size: 15px !important;
    transition: transform 0.25s ease !important;
    flex-shrink: 0 !important;
}
.header-right .header-credits-pill:hover .header-coin-icon {
    transform: rotate(-12deg) scale(1.15);
}
.header-right .header-user-credits-val {
    font-weight: 700 !important;
    font-size: 14.5px !important;
    color: #f8fafc !important;
    letter-spacing: 0.2px !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}
.header-right .header-coin-label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #94a3b8 !important;
    margin-right: 2px !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}
.header-right .header-coin-plus-btn {
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    color: #0c0b0d !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    transition: all 0.25s ease !important;
    flex-shrink: 0 !important;
}
.header-right .header-coin-plus-btn i {
    color: #0c0b0d !important;
    font-size: 11px !important;
    line-height: 1 !important;
}
.header-right .header-credits-pill:hover .header-coin-plus-btn {
    background: #ffb86c !important;
    transform: scale(1.12);
}
.header-right .header-credits-pill:hover .header-coin-plus-btn i {
    color: #0c0b0d !important;
}
@media (max-width: 480px) {
    .header-right .header-coin-label {
        display: none !important;
    }
    .header-right .header-credits-pill {
        padding: 0 6px 0 9px !important;
        gap: 5px !important;
    }
    .header-right .header-user-credits-val {
        font-size: 13px !important;
    }
    .header-right .header-coin-plus-btn {
        width: 22px !important;
        height: 22px !important;
        font-size: 10px !important;
    }
}
