/* General Variables and Base Styles */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --bg-tertiary: #1e293b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary-color: #6366f1;
    --primary-gradient: linear-gradient(135deg, #4f46e5, #9333ea);
    --accent-color: #ec4899;
    --accent-gradient: linear-gradient(135deg, #ec4899, #f43f5e);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --sidebar-width: 420px;
    --header-height: 70px;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* App Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Header Navbar Styles */
.app-header {
    height: var(--header-height);
    background-color: rgba(19, 27, 46, 0.85);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 10;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #a5b4fc, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: block;
    margin-top: -2px;
}

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

/* API Status Indicator */
.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

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

.status-indicator.green {
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.status-indicator.yellow {
    background-color: var(--warning-color);
    box-shadow: 0 0 8px var(--warning-color);
}

.status-indicator.red {
    background-color: var(--danger-color);
    box-shadow: 0 0 8px var(--danger-color);
}

.api-status .status-label {
    color: var(--text-secondary);
}

/* Main Split Layout */
.app-main {
    display: flex;
    flex: 1;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* Left Canvas Work Area */
.canvas-section {
    flex: 1;
    background-color: var(--bg-primary);
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.canvas-container {
    width: 100%;
    height: 100%;
    max-width: 600px;
    max-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Specific aspect ratio container adjustments for preview centering */
.canvas-container.ratio-1-1 { aspect-ratio: 1 / 1; }
.canvas-container.ratio-4-5 { aspect-ratio: 4 / 5; }
.canvas-container.ratio-9-16 { aspect-ratio: 9 / 16; }
.canvas-container.ratio-16-9 { aspect-ratio: 16 / 9; }

#editor-canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    background-color: #0f172a;
    box-shadow: 0 0 0 1px var(--border-color);
    cursor: grab;
    transition: box-shadow 0.2s;
}

#editor-canvas:active {
    cursor: grabbing;
}

/* Drag and Drop Overlays */
.drag-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(11, 15, 25, 0.85);
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.23s ease;
}

.drag-drop-overlay.active {
    opacity: 1;
}

.overlay-content {
    text-align: center;
    color: var(--text-primary);
}

.upload-large-icon {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    margin-bottom: 16px;
    animation: pulse 2s infinite;
}

.overlay-content p {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.overlay-content span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Canvas Quick Controls */
.canvas-controls {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}

.control-tip {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background-color: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 9999px;
    backdrop-filter: blur(8px);
}

.control-buttons {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

/* Sidebar Styling */
.sidebar-section {
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-left {
    width: 330px;
    border-right: 1px solid var(--border-color);
}

.sidebar-right {
    width: 380px;
    border-left: 1px solid var(--border-color);
}

/* Sidebar header styling for non-tabbed sidebars */
.sidebar-header {
    padding: 20px 24px 10px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(15, 23, 42, 0.2);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

/* Workspace Import/Export Buttons styling */
.workspace-io-actions {
    display: flex;
    gap: 8px;
    margin-right: 8px;
}

/* Sidebar Tab Buttons */
.sidebar-tabs {
    display: flex;
    background-color: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid var(--border-color);
    padding: 4px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 12px 6px;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.tab-btn svg {
    opacity: 0.7;
    transition: transform 0.2s;
}

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

.tab-btn.active {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.tab-btn.active svg {
    color: var(--primary-color);
    opacity: 1;
}

.tab-btn.highlight:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
}

.tab-btn.highlight.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: #f472b6;
}

.tab-btn.highlight.active svg {
    color: var(--accent-color);
    opacity: 1;
    transform: scale(1.1);
}

/* Sidebar Scrollable Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Hide inactive tabs */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.25s ease-in-out;
}

/* Group Headers and cards */
.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 20px;
    border-left: 3px solid var(--primary-color);
    padding-left: 10px;
}

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

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.separator {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 20px 0;
}

/* Sub-card structures for grouped parameters */
.border-card {
    background-color: rgba(30, 41, 59, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 18px;
}

.card-label {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    margin-bottom: 4px !important;
}

.card-desc {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.3;
}

/* Aspect Ratio Selectors */
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.ratio-btn {
    background-color: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ratio-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background-color: rgba(30, 41, 59, 0.6);
}

.ratio-btn.active {
    border-color: var(--primary-color);
    color: var(--text-primary);
    background-color: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.ratio-box {
    border: 2px solid currentColor;
    background: transparent;
    opacity: 0.7;
    border-radius: 3px;
}

.r-1-1 { width: 20px; height: 20px; }
.r-4-5 { width: 16px; height: 20px; }
.r-9-16 { width: 12px; height: 22px; }
.r-16-9 { width: 22px; height: 12px; }

.ratio-name {
    font-weight: 700;
    font-size: 0.85rem;
}

.ratio-meta {
    font-size: 0.68rem;
    opacity: 0.8;
}

.ratio-help {
    font-size: 0.72rem;
    color: var(--text-secondary);
    background-color: rgba(15, 23, 42, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 2px solid var(--text-muted);
}

/* Custom Controls styling (Buttons) */
.btn {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 6px;
    border: none;
    outline: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.btn-danger {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

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

.btn-sparkle {
    background: linear-gradient(135deg, #6366f1, #ec4899, #f43f5e);
    background-size: 200% 200%;
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.35);
    animation: gradientShift 4s ease infinite;
}

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

.btn-icon-text {
    background-color: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.72rem;
    backdrop-filter: blur(8px);
}

.btn-icon-text:hover {
    background-color: rgba(30, 41, 59, 0.9);
    border-color: var(--border-hover);
}

.btn-full-width {
    width: 100%;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.7rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* Styled Form Inputs */
.styled-input {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.82rem;
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    transition: all 0.2s;
}

.styled-input:focus {
    border-color: var(--primary-color);
    background-color: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.styled-textarea {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.82rem;
    padding: 10px 12px;
    border-radius: 6px;
    outline: none;
    resize: vertical;
    transition: all 0.2s;
}

.styled-textarea:focus {
    border-color: var(--primary-color);
    background-color: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.styled-select {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.82rem;
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.styled-select:focus {
    border-color: var(--primary-color);
}

.file-input-hidden {
    display: none;
}

/* Custom range inputs */
.label-with-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.label-with-value label {
    margin-bottom: 0;
}

.label-with-value span {
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 700;
}

.styled-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    outline: none;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.5);
    transition: transform 0.15s, background-color 0.15s;
}

.styled-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #818cf8;
}

.styled-slider.small {
    height: 4px;
}

.styled-slider.small::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
}

.slider-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Solid background Color presets picker */
.color-preset-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.color-preset {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.color-preset:hover {
    transform: scale(1.1);
}

.color-preset.active {
    border-color: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.custom-color-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
}

.custom-color-wrapper input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.custom-color-wrapper label {
    margin-bottom: 0;
    font-size: 0.85rem;
    cursor: pointer;
}

/* Dropzone styling for logo upload */
.asset-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    background-color: rgba(15, 23, 42, 0.2);
    transition: all 0.2s;
}

.asset-dropzone:hover {
    border-color: var(--border-hover);
    background-color: rgba(15, 23, 42, 0.4);
}

.asset-dropzone.dragover {
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.05);
}

.dropzone-prompt svg {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.dropzone-prompt p {
    font-size: 0.78rem;
    font-weight: 500;
}

.dropzone-prompt span {
    color: var(--primary-color);
    text-decoration: underline;
}

.logo-active-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.logo-preview-box {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-filename {
    font-size: 0.7rem;
    color: var(--success-color);
    font-weight: 500;
}

.logo-position-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.pos-btn {
    background-color: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.pos-btn.active {
    background-color: var(--bg-tertiary);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

/* AI assistant tab styles */
.ai-badge {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(236, 72, 153, 0.15));
    border: 1px solid rgba(236, 72, 153, 0.2);
    color: #f472b6;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.ai-card {
    border: 1px solid rgba(139, 92, 246, 0.25) !important;
    background-color: rgba(139, 92, 246, 0.03) !important;
}

.translation-row {
    display: flex;
    gap: 10px;
}

.select-half {
    width: 50%;
}

.ai-caption-result-container {
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.caption-header {
    background-color: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.caption-text-area {
    padding: 12px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-primary);
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    outline: none;
}

/* Helper Utilities */
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.input-desc {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Keyframes and Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Loading filter and spinners */
.loading-indicator {
    pointer-events: none;
    position: relative;
}

.loading-indicator::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(19, 27, 46, 0.6);
    backdrop-filter: blur(2px);
    z-index: 10;
    border-radius: inherit;
}

/* Spinner */
.spinner-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

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

/* Modal Overlay & Configuration Card Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(11, 15, 25, 0.78);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 480px;
    max-width: 90%;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1px;
}

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

.modal-body {
    padding: 24px;
}

.modal-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.modal-footer {
    padding: 16px 24px;
    background-color: rgba(15, 23, 42, 0.35);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

#gemini-status {
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

#gemini-status:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: var(--border-hover);
}

/* Collapsible Accordion UI Styles (Compact sidebar tool list) */
.ai-accordion {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.accordion-item {
    background-color: rgba(30, 41, 59, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s, background-color 0.2s;
}

.accordion-item.active {
    border-color: rgba(99, 102, 241, 0.35);
    background-color: rgba(30, 41, 59, 0.38);
}

.accordion-header {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    transition: background-color 0.2s;
}

.accordion-header:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.accordion-header .chevron {
    transition: transform 0.23s ease;
    opacity: 0.7;
}

.accordion-item.active .accordion-header .chevron {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    padding: 0 12px;
    transition: max-height 0.23s cubic-bezier(0, 1, 0, 1), padding 0.23s ease;
    opacity: 0;
}

.accordion-item.active .accordion-content {
    max-height: 480px; /* Safe upper limit boundary */
    padding: 0 12px 10px;
    opacity: 1;
    transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1), padding 0.23s ease;
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Compact Flat AI Copywriting Tool Cards Layout */
.ai-tool-card {
    background-color: rgba(30, 41, 59, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.2s, background-color 0.2s;
}

.ai-tool-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background-color: rgba(30, 41, 59, 0.35);
}

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

.tool-title {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-primary);
}

.info-tooltip {
    font-size: 0.7rem;
    cursor: help;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.info-tooltip:hover {
    opacity: 1;
}

.tool-inputs-row {
    display: flex;
    gap: 6px;
    width: 100%;
}

.compact-input {
    flex: 1;
    font-size: 0.75rem !important;
    padding: 6px 10px !important;
    height: 32px !important;
}

.compact-select {
    flex: 1;
    font-size: 0.75rem !important;
    padding: 6px 10px !important;
    height: 32px !important;
}

.compact-btn {
    font-size: 0.72rem !important;
    padding: 6px 12px !important;
    height: 32px !important;
    flex-shrink: 0;
}

/* Toast Notifications Container & Visual Items */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: slideInRight 0.28s cubic-bezier(0.16, 1, 0.3, 1), fadeOut 0.3s ease 3.7s forwards;
    max-width: 340px;
    backdrop-filter: blur(12px);
}

.toast.success { border-left-color: var(--success-color); }
.toast.warning { border-left-color: var(--warning-color); }
.toast.danger { border-left-color: var(--danger-color); }

.toast-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-message {
    line-height: 1.4;
}

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

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(8px); }
}

/* Premium Standard Hashtags Selector Grid & Badges */
.hashtags-selector-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.hashtag-badge-label {
    display: flex;
    align-items: center;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 3px 7px;
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
}

.hashtag-badge-label input {
    display: none; /* Hide native checkbox browser wrapper */
}

.hashtag-badge-label:has(input:checked) {
    background-color: rgba(99, 102, 241, 0.15) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.25);
}

.hashtag-badge-label:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.delete-hashtag {
    margin-left: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    transition: all 0.15s ease;
    line-height: 1px;
}

.delete-hashtag:hover {
    background-color: rgba(239, 68, 68, 0.25);
    color: var(--danger-color) !important;
}

/* ====================================================
   VIDEO STUDIO ENHANCEMENTS
   ==================================================== */

/* 1. Studio Mode Toggle Buttons */
.mode-toggle-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.mode-toggle-btn.active {
    background: linear-gradient(135deg, var(--primary-color), #a855f7);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* 2. Visual Timeline Container */
.timeline-container {
    background-color: rgba(15, 23, 42, 0.88);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.3s ease;
    
    /* Floating absolute position at the bottom */
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    z-index: 100;
    margin-top: 0;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

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

.btn-play {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #a855f7);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.3);
    transition: transform 0.15s, background 0.15s;
    padding: 0 !important;
}

.btn-play:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #818cf8, #c084fc);
}

.time-display {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: monospace;
    color: var(--text-secondary);
}

/* 3. High-Definition Visual Timeline Track */
.timeline-slider-wrapper {
    padding: 6px 0;
    cursor: pointer;
}

.timeline-track {
    background-color: rgba(255, 255, 255, 0.08);
    height: 12px;
    border-radius: 99px;
    position: relative;
    overflow: visible;
}

.timeline-trimmed-range {
    background: rgba(168, 85, 247, 0.28);
    border: 1px solid rgba(168, 85, 247, 0.5);
    height: 100%;
    position: absolute;
    border-radius: 4px;
    pointer-events: none;
}

.timeline-playhead {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid var(--primary-color);
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    z-index: 5;
}

/* Social Limit Bars inside Timeline Track */
.timeline-limit-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
}

.timeline-limit-bar.story {
    left: 0;
    width: 33.33%; /* 60s / 180s = 33.33% */
    background: transparent;
    border-right: 1px dashed rgba(6, 182, 212, 0.05);
    transition: all 0.3s ease;
}

.timeline-limit-bar.story.near {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.1) 0%, rgba(6, 182, 212, 0.03) 100%);
    border-right: 1px dashed rgba(6, 182, 212, 0.6);
}

.timeline-limit-bar.story::after {
    content: "Stories Limit (60s)";
    position: absolute;
    right: 4px;
    top: -16px;
    font-size: 0.6rem;
    color: #22d3ee;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.timeline-limit-bar.story.near::after {
    opacity: 1;
}

.timeline-limit-bar.reel {
    left: 33.33%;
    width: 66.67%;
    background: transparent;
    border-right: 1px dashed rgba(168, 85, 247, 0.05);
    transition: all 0.3s ease;
}

.timeline-limit-bar.reel.near {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.05) 0%, rgba(168, 85, 247, 0.01) 100%);
    border-right: 1px dashed rgba(168, 85, 247, 0.5);
}

.timeline-limit-bar.reel::after {
    content: "Reels Limit (3m)";
    position: absolute;
    right: 4px;
    top: -16px;
    font-size: 0.6rem;
    color: #c084fc;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.timeline-limit-bar.reel.near::after {
    opacity: 1;
}

/* Trim Inputs & Warning */
.timeline-trim-inputs {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.trim-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.timeline-limits-warning {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.02);
}

/* 4. Visibility Keyframe Inputs styling */
.keyframe-timing-row {
    background-color: rgba(15, 23, 42, 0.25);
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.border-top-dash {
    border-top: 1px dashed var(--border-color);
}

/* 5. Brand tab optional video styling */
.brand-video-group label {
    margin-bottom: 0;
}

.switch-container input[type="checkbox"] {
    cursor: pointer;
    width: 13px;
    height: 13px;
}

/* High Fidelity Video Compiler Progress Fill Anim */
.progress-bar-container {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ====================================================
   GRAPHICAL TIMELINE TRIM HANDLES & SUB-TRACKS
   ==================================================== */

/* Visual Timeline Trim Drag Handles */
.timeline-trim-handle {
    position: absolute;
    top: -5px;
    height: 22px;
    width: 14px;
    background: linear-gradient(135deg, var(--primary-color), #a855f7);
    border: 1.5px solid #ffffff;
    border-radius: 3px;
    cursor: ew-resize;
    z-index: 10;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.52rem;
    color: white;
    font-weight: 700;
    user-select: none;
    transition: transform 0.15s, background-color 0.15s;
}

.timeline-trim-handle:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #818cf8, #c084fc);
}

.timeline-trim-handle.start {
    transform: translate(-50%, 0);
}

.timeline-trim-handle.end {
    transform: translate(-50%, 0);
}

/* Sub-timelines sequencer track layout */
.timeline-sub-tracks {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 14px;
    margin-top: 8px;
    max-height: 170px;
    overflow-y: auto;
}

.sub-track-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-left 0.2s;
    border-left: 3px solid transparent;
}

.sub-track-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.sub-track-row.active {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid #6366f1;
}

.sub-track-label {
    width: 60px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.sub-track-bar-wrapper {
    flex: 1;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    position: relative;
    overflow: visible;
}

.sub-track-bar {
    position: absolute;
    height: 100%;
    background: rgba(168, 85, 247, 0.28);
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: 4px;
}

.sub-handle {
    position: absolute;
    top: -5px;
    height: 22px;
    width: 14px;
    background: linear-gradient(135deg, var(--primary-color), #a855f7);
    border: 1.5px solid #ffffff;
    border-radius: 3px;
    cursor: ew-resize;
    z-index: 10;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    transition: transform 0.15s, background-color 0.15s;
}

.sub-handle:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #818cf8, #c084fc);
}

.sub-handle.sub-start {
    left: 0;
    transform: translate(-50%, 0);
}

.sub-handle.sub-end {
    left: 100%;
    transform: translate(-50%, 0);
}



/* Graphical Sub-track limits shifters */
.sub-limit-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
    height: 100%;
    border-radius: 4px;
}

.sub-limit-bar.story {
    background: transparent;
    border-right: 1.5px dashed rgba(6, 182, 212, 0.05);
    transition: all 0.3s ease;
}

.sub-limit-bar.story.near {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.08) 0%, rgba(6, 182, 212, 0.02) 100%);
    border-right: 1.5px dashed rgba(6, 182, 212, 0.45);
}

.sub-limit-bar.reel {
    background: transparent;
    border-right: 1.5px dashed rgba(168, 85, 247, 0.05);
    transition: all 0.3s ease;
}

.sub-limit-bar.reel.near {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.04) 0%, rgba(168, 85, 247, 0.01) 100%);
    border-right: 1.5px dashed rgba(168, 85, 247, 0.35);
}

/* ==========================================================================
   Compliance Elements (Impressum, Privacy, Cookie Banner)
   ========================================================================== */

/* Left Sidebar Footer */
.sidebar-footer {
    padding: 14px 20px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    background-color: rgba(11, 15, 25, 0.25);
    flex-shrink: 0;
}

.sidebar-footer .footer-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sidebar-footer a {
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.sidebar-footer a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Floating Cookie Consent Banner */
.cookie-banner-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    width: 90%;
    max-width: 680px;
    animation: slideUpCookie 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
}

.cookie-banner-container.hidden {
    display: none !important;
}

@keyframes slideUpCookie {
    from {
        transform: translate(-50%, 60px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.cookie-banner-card {
    background: rgba(19, 27, 46, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 20px 48px -10px rgba(0, 0, 0, 0.75);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cookie-banner-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.cookie-icon {
    font-size: 2.2rem;
    line-height: 1;
    animation: wiggleCookie 3s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes wiggleCookie {
    0%, 100% { transform: rotate(0deg); }
    15% { transform: rotate(-8deg); }
    30% { transform: rotate(6deg); }
    45% { transform: rotate(-4deg); }
    60% { transform: rotate(2deg); }
}

.cookie-text h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.cookie-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.cookie-banner-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 14px;
}

/* Modal Scrollable Contents */
.modal-scrollable-body {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.modal-scrollable-body::-webkit-scrollbar {
    width: 6px;
}

.modal-scrollable-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 99px;
}

.modal-scrollable-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 99px;
}

.modal-scrollable-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Legal Documents Styling */
.legal-section {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.55;
    text-align: left;
}

.legal-section h4 {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-top: 18px;
    margin-bottom: 8px;
    font-weight: 700;
    border-left: 3px solid var(--primary-color);
    padding-left: 8px;
}

.legal-section h5 {
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: 600;
}

.legal-section p {
    margin-bottom: 12px;
}

.legal-section ul {
    margin-bottom: 14px;
    padding-left: 20px;
}

.legal-section li {
    margin-bottom: 6px;
}

.legal-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}


