/* CSS Variables & Design System */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(31, 41, 55, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(139, 92, 246, 0.4);

    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 100%);
    --accent-hover: linear-gradient(135deg, #7c3aed 0%, #0891b2 100%);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', 'Inter', system-ui, sans-serif;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-glow: 0 8px 32px 0 rgba(139, 92, 246, 0.25);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.15) 0%, transparent 45%);
    background-attachment: fixed;
}

/* Layout Container */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    flex-shrink: 0;
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-text h1 span {
    font-size: 11px;
    background: var(--accent-gradient);
    color: #fff;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.brand-text p {
    font-size: 12px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Workspace Panels */
.workspace {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
    /* Critical for inner scrolling without window overflow */
}

.panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.panel-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.badge {
    font-size: 11.5px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* Control Panel Body with clean scrolling */
.control-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 2px;
    min-height: 0;
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 14px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 32px;
    color: var(--accent-cyan);
    margin-bottom: 8px;
}

.dropzone-content h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.dropzone-content p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

kbd {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
}

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

/* Image Preview */
.dropzone-preview {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 250px;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dropzone-preview img {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
}

.preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.image-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

#image-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

#image-size {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Preset Cards */
.preset-section {
    margin-bottom: 20px;
}

.section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: block;
}

.table-mode-card {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

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

.table-mode-header .preset-icon {
    font-size: 24px;
    color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.15);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-mode-header .preset-info strong {
    font-size: 14px;
    display: block;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.mode-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.mode-rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 10px;
}

.mode-rules-list li {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-rules-list li i.fa-check {
    color: #10b981;
    font-size: 11px;
}

.mode-rules-list li i.fa-ban {
    color: #ef4444;
    font-size: 11px;
}


/* Custom Prompt */
.custom-prompt-container {
    margin-bottom: 20px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-cyan);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
}

.custom-prompt-box {
    margin-top: 10px;
}

.custom-prompt-box textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 13px;
    resize: vertical;
    outline: none;
}

.custom-prompt-box textarea:focus {
    border-color: var(--accent-purple);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

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

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

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    padding: 6px;
    cursor: pointer;
    border-radius: 4px;
}

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

.btn-icon.danger:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

.btn-github {
    font-size: 24px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-github:hover {
    color: #fff;
}

/* Result Panel & Tabs */
/* Result Panel & Tabs */
.result-sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.result-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--bg-card);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* State Views */
.state-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
    width: 100%;
    height: 100%;
}

.idle-illustration,
.error-illustration {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.error-illustration {
    color: var(--danger);
}

.state-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* Spinner */
.spinner-ring {
    width: 44px;
    height: 44px;
    border: 3.5px solid rgba(139, 92, 246, 0.2);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 16px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.timer-badge {
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12.5px;
    font-family: monospace;
}

/* Success View & Markdown */
.success-container {
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    text-align: left;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.tab-pane {
    display: none;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: auto;
    padding-right: 2px;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

.markdown-body {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-primary);
    padding: 0 0 16px 0;
    width: 100%;
    overflow-x: auto;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    font-family: var(--font-heading);
    margin-top: 14px;
    margin-bottom: 8px;
    color: var(--accent-cyan);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.markdown-body p {
    margin-bottom: 10px;
}

.markdown-body table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.markdown-body th {
    background: rgba(139, 92, 246, 0.15);
    font-weight: 600;
    color: var(--accent-cyan);
    border-bottom: 2px solid rgba(139, 92, 246, 0.3);
    white-space: nowrap;
}

.markdown-body tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.markdown-body tr:hover {
    background: rgba(139, 92, 246, 0.06);
}

/* Not Table Alert Box */
.result-not-table-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 14px 0;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.15);
    width: 100%;
}

.result-not-table-alert .not-table-icon {
    font-size: 28px;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-not-table-alert .not-table-content h4 {
    margin: 0 0 6px 0;
    color: #f87171;
    font-size: 15px;
    font-weight: 600;
}

.result-not-table-alert .not-table-content p {
    margin: 0;
    color: var(--text-primary);
    font-size: 13.5px;
    line-height: 1.5;
}

/* Table Schema Info Badge */
.table-schema-badge {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: #6ee7b7;
}

.table-schema-badge.raw-badge {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.25);
    color: #a5f3fc;
}

.table-schema-badge i {
    font-size: 15px;
}

.table-schema-badge strong {
    color: #fff;
    font-weight: 500;
}

#btn-copy-excel {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

#btn-copy-excel:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}



.markdown-body code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    color: #f472b6;
}

.markdown-body pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 14px 0;
    border: 1px solid var(--border-color);
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
}

/* Split View */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: 100%;
    flex: 1;
}

.split-side {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.split-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.split-image img {
    max-width: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* Raw Text Area */
#raw-text-output {
    width: 100%;
    height: 100%;
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 10;
    min-width: 160px;
    overflow: hidden;
}

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

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-cyan);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.modal-dialog {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 580px;
    box-shadow: var(--shadow-glow);
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.2);
}

/* Auth Tabs & Forms */
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.auth-tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab-btn.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-purple);
    color: var(--text-primary);
}

.auth-form-pane {
    display: none;
}

.auth-form-pane.active {
    display: block;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #a5f3fc;
}

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

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

.required {
    color: var(--danger);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 11px;
}

.form-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.input-with-eye {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-eye input {
    padding-right: 40px;
}

.btn-eye {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 6px 10px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-eye:hover {
    color: var(--accent-cyan);
}

.form-group input:focus {
    border-color: var(--accent-purple);
}

.cookie-guide {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.cookie-guide summary {
    cursor: pointer;
    color: var(--accent-cyan);
    font-weight: 500;
}

.cookie-guide ol {
    margin-top: 10px;
    margin-left: 20px;
    line-height: 1.6;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-cyan);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 200;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Helpers */
.hidden {
    display: none !important;
}

.margin-top {
    margin-top: 16px;
}

/* Cookie Sync Badge in Header */
.cookie-sync-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.cookie-sync-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.sync-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.sync-dot.offline {
    background-color: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.sync-dot.checking {
    background-color: var(--warning);
    animation: pulse 1s infinite alternate;
}

/* Extension Sync Status Card */
.sync-status-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.sync-status-card.synced {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
}

.sync-status-card.not-synced {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
}

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

.sync-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--accent-cyan);
}

.sync-status-card.synced .sync-icon {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.sync-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.sync-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.sync-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-item span {
    color: var(--text-muted);
}

.detail-item strong {
    color: var(--text-primary);
    font-family: monospace;
}

.sync-actions-row {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
    color: #fff;
}

/* Extension Guide Box */
.extension-guide-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
}

.extension-guide-box h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-purple);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.steps-list {
    margin-left: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.path-copy-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.path-copy-box code {
    font-family: monospace;
    font-size: 11px;
    color: var(--accent-cyan);
    word-break: break-all;
    flex: 1;
}

.path-copy-box button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.path-copy-box button:hover {
    color: #fff;
}

/* ===================================================
   MULTI-IMAGE SUPPORT & IMAGE TABS BAR
=================================================== */

/* Dropzone summary when files are selected */
.dropzone-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px;
    color: var(--accent-cyan);
    font-size: 14px;
    font-weight: 600;
}

.dropzone-summary i {
    font-size: 28px;
    color: var(--accent-purple);
}

.dropzone-hint {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: normal;
}

/* Selected Files Queue in Control Panel */
.selected-files-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selected-files-container.hidden {
    display: none;
}

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

.section-label-sm {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-label-sm #files-count-badge {
    background: var(--accent-purple);
    color: #fff;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-text-danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

.selected-files-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.selected-file-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 6px 10px;
    transition: var(--transition);
}

.selected-file-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.file-card-thumb {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    object-fit: cover;
    background: #000;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

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

.file-card-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.file-card-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.file-card-remove:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

/* ===================================================
   IMAGE TABS BAR IN RESULT PANEL
=================================================== */
.image-tabs-wrapper {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: 12px;
    display: none;
    flex-shrink: 0;
}

.image-tabs-wrapper.show {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.image-tabs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.image-tabs-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.image-tabs-title i {
    color: var(--accent-cyan);
}

.batch-progress-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(6, 182, 212, 0.25);
}

.image-tabs-list-container {
    overflow-x: auto;
    padding: 4px 0 2px 0;
}

.image-tabs-list {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 100%;
}

/* Individual Image Tab Button */
.image-tab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    user-select: none;
    position: relative;
}

.image-tab-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.image-tab-item.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-purple);
    color: #fff;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
}

.image-tab-thumb {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.image-tab-name {
    font-weight: 500;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Tab Status Badges */
.tab-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1;
}

.tab-badge.pending {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.tab-badge.processing {
    background: rgba(139, 92, 246, 0.25);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
    animation: tabPulse 1.5s infinite alternate ease-in-out;
}

.tab-badge.processing i {
    animation: spin 1s infinite linear;
}

.tab-badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.tab-badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
}

@keyframes tabPulse {
    0% {
        box-shadow: 0 0 4px rgba(139, 92, 246, 0.3);
    }

    100% {
        box-shadow: 0 0 14px rgba(139, 92, 246, 0.7);
    }
}

.image-tab-close {
    font-size: 13px;
    color: var(--text-muted);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    transition: var(--transition);
}

.image-tab-close:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.2);
}

.result-sub-header {
    margin-bottom: 16px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .workspace {
        grid-template-columns: 1fr;
        height: auto;
    }

    .app-container {
        height: auto;
    }

    .split-view {
        grid-template-columns: 1fr;
    }
}