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

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    overflow: hidden;
}

body.has-nav {
    padding-top: 60px;
}

.app-container {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: 420px;
    background: rgba(15, 15, 25, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px;
    padding-bottom: 80px;
    overflow-y: auto;
    overflow-x: hidden;
    backdrop-filter: blur(20px);
    height: calc(100vh - 60px);
    flex-shrink: 0;
}

.logo-section {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-section h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #4a90d9 0%, #67b8f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-section p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
}

.tab {
    flex: 1;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tab.active {
    background: linear-gradient(135deg, #1e5799 0%, #2989d8 100%);
    border-color: #4a90d9;
    color: #fff;
    box-shadow: 0 4px 15px rgba(41, 137, 216, 0.3);
}

/* ========== FORM ELEMENTS ========== */
.form-section {
    margin-bottom: 25px;
}

.form-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
}

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

.form-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4a90d9;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.2);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: #1a1a2e;
    color: #fff;
}

/* ========== SLIDERS ========== */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider {
    flex: 1;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4a90d9 0%, #2989d8 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(41, 137, 216, 0.4);
    transition: transform 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4a90d9 0%, #2989d8 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(41, 137, 216, 0.4);
}

.slider-value {
    min-width: 60px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: #4a90d9;
}

/* ========== CHARACTER COUNTER ========== */
.char-counter {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.char-counter.warning {
    color: #f59e0b;
}

.char-counter.danger {
    color: #ef4444;
}

.char-limit-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.char-limit-controls label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0;
}

.char-limit-controls select {
    padding: 8px 12px;
    font-size: 12px;
    width: auto;
}

/* ========== FILE UPLOAD ========== */
.file-upload {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.file-upload:hover {
    border-color: #4a90d9;
    background: rgba(74, 144, 217, 0.05);
}

.file-upload.has-image {
    border-style: solid;
    border-color: #4a90d9;
}

.file-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.file-upload-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.file-upload-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.file-upload-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 5px;
}

.file-preview {
    max-width: 100%;
    max-height: 120px;
    border-radius: 8px;
    object-fit: cover;
}

/* ========== BUTTONS ========== */
.btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: 14px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #1e5799 0%, #2989d8 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(41, 137, 216, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(41, 137, 216, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 12px;
}

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

.btn-ai {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    margin-bottom: 15px;
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(124, 58, 237, 0.5);
}

/* ========== PREVIEW AREA ========== */
.preview-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: rgba(0, 0, 0, 0.3);
}

.preview-wrapper {
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    overflow: hidden;
}

.preview-label {
    position: absolute;
    top: -35px;
    left: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.4);
}

#previewCanvas {
    display: block;
    max-height: 85vh;
    width: auto;
    border-radius: 16px;
}

/* ========== MODE PANELS ========== */
.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
}

/* ========== DIVIDER ========== */
.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 25px 0;
}

/* ========== INFO BOX ========== */
.info-box {
    background: rgba(74, 144, 217, 0.1);
    border: 1px solid rgba(74, 144, 217, 0.3);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
}

.info-box p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-footer .btn {
    flex: 1;
    margin: 0;
}

/* ========== AI RESULT ========== */
.ai-result {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
}

.ai-result label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
    display: block;
}

#aiResultText {
    font-size: 14px;
    line-height: 1.6;
    color: #fff;
    white-space: pre-wrap;
}

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

/* ========== SCROLLBAR ========== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== LOADING STATE ========== */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========== PANEL CONTROLS ========== */
.panel-controls {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

/* ========== BACKGROUND SELECTOR ========== */
.bg-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bg-option {
    width: 56px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
}

.bg-option img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(0,0,0,0.3);
}

.bg-option:hover {
    border-color: rgba(74, 144, 217, 0.5);
    transform: scale(1.05);
}

.bg-option.active {
    border-color: #4a90d9;
    box-shadow: 0 0 15px rgba(74, 144, 217, 0.4);
}

.bg-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

.bg-custom span {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.5);
}

.bg-custom input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.bg-custom:hover {
    border-color: #4a90d9;
}

.bg-custom:hover span {
    color: #4a90d9;
}

/* ========== TOGGLE GROUP ========== */
.toggle-group {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.toggle-btn.active {
    background: linear-gradient(135deg, #1e5799 0%, #2989d8 100%);
    border-color: #4a90d9;
    color: #fff;
}

/* ========== FORM ROW & COMPACT ========== */
.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group.compact {
    margin-bottom: 10px;
    flex: 1 1 45%;
    min-width: 140px;
}

.form-group.compact label {
    font-size: 11px;
    margin-bottom: 5px;
}

.form-group.compact .input-slider-group {
    flex-wrap: nowrap;
}

/* ========== INPUT + SLIDER GROUP ========== */
.input-slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.input-slider-group .slider {
    flex: 1;
}

.slider-input {
    width: 55px;
    min-width: 55px;
    max-width: 55px;
    flex-shrink: 0;
    padding: 6px 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    text-align: center;
}

.slider-input::-webkit-outer-spin-button,
.slider-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.slider-input:focus {
    outline: none;
    border-color: #4a90d9;
}

/* ========== SECTION HEADER ========== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h3 {
    margin-bottom: 0;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.btn-icon:hover {
    opacity: 1;
}

/* ========== FORM SECTION SUB ========== */
.form-section-sub {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.section-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.section-label-small {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.image-upload-group {
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    position: relative;
}

.info-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* ========== BG ACTIONS ========== */
.bg-actions {
    margin-top: 10px;
}

.btn-add-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-bg:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #4a90d9;
    color: #fff;
}

.bg-option .delete-bg {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.bg-option:hover .delete-bg {
    display: flex;
}

.bg-option.active .delete-bg {
    display: none;
}

/* ========== FILE UPLOAD COMPACT ========== */
.file-upload.compact {
    min-height: 80px;
    padding: 15px;
    margin-bottom: 10px;
}

.file-upload.compact .file-upload-icon {
    font-size: 24px;
}

.file-upload.compact .file-upload-text {
    font-size: 12px;
}

/* ========== PRESETS SECTION ========== */
.presets-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 20px;
}

.presets-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-preset {
    flex: 1;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-preset:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #4a90d9;
}

.presets-list {
    max-height: 150px;
    overflow-y: auto;
}

.preset-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-item:hover {
    background: rgba(74, 144, 217, 0.2);
}

.preset-item-info {
    flex: 1;
}

.preset-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.preset-item-mode {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-top: 2px;
}

.preset-item-delete {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.preset-item-delete:hover {
    color: #ef4444;
}

/* ========== MESSAGE TEXTAREA ========== */
.message-textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    resize: none;
    line-height: 1.4;
}

.message-textarea:focus {
    outline: none;
    border-color: #4a90d9;
    background: rgba(255, 255, 255, 0.08);
}

/* ========== MODAL SMALL ========== */
.modal.modal-small {
    max-width: 400px;
}

.modal.modal-small .modal-body p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

/* ========== DANGER BUTTON ========== */
.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    border-color: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* ========== PRESET DATE ========== */
.preset-item-date {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

/* ========== EXPORT BTN ========== */
.presets-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.btn-export {
    padding: 8px 12px;
    font-size: 11px;
}

/* ========== PRESET SEARCH ========== */
.preset-search {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    margin-bottom: 12px;
}

.preset-search:focus {
    outline: none;
    border-color: #4a90d9;
}

.preset-search::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ========== AI IMAGE UPLOAD ========== */
.ai-image-upload {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-image-preview {
    width: 100%;
    height: 120px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.ai-image-preview:hover {
    border-color: #4a90d9;
    background: rgba(74, 144, 217, 0.1);
}

.ai-image-preview span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

.ai-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ai-image-preview.has-image {
    border-style: solid;
    border-color: #4a90d9;
}

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

/* ========== VIDEO MODE ========== */
.video-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.video-actions .btn {
    flex: 1;
}

.drag-drop-info {
    background: rgba(74, 144, 217, 0.15);
    border: 1px solid rgba(74, 144, 217, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 15px;
}

.drag-drop-info span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

/* ========== INTERACT.JS OVERLAY SYSTEM ========== */
.interact-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
    overflow: visible;
}

.interact-el {
    position: absolute;
    pointer-events: auto;
    touch-action: none;
    box-sizing: border-box;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
    cursor: grab;
}

.interact-el:hover {
    border-color: rgba(41, 137, 216, 0.5);
    box-shadow: 0 0 0 1px rgba(41, 137, 216, 0.3);
}

.interact-el.dragging {
    cursor: grabbing;
    border-color: #2989D8;
    box-shadow: 0 0 12px rgba(41, 137, 216, 0.4);
    z-index: 60;
}

.interact-el.resizing {
    border-color: #2989D8;
    box-shadow: 0 0 12px rgba(41, 137, 216, 0.4);
    z-index: 60;
}

.interact-el .interact-label {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(41, 137, 216, 0.85);
    color: #fff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    z-index: 2;
}

.interact-el:hover .interact-label,
.interact-el.dragging .interact-label,
.interact-el.resizing .interact-label {
    opacity: 1;
}

.interact-el .resize-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #2989D8;
    border: 2px solid #fff;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: auto;
    z-index: 3;
}

.interact-el:hover .resize-handle,
.interact-el.dragging .resize-handle,
.interact-el.resizing .resize-handle {
    opacity: 1;
}

.interact-el .resize-handle.rh-tl { top: -9px; left: -9px; cursor: nwse-resize; }
.interact-el .resize-handle.rh-tr { top: -9px; right: -9px; cursor: nesw-resize; }
.interact-el .resize-handle.rh-bl { bottom: -9px; left: -9px; cursor: nesw-resize; }
.interact-el .resize-handle.rh-br { bottom: -9px; right: -9px; cursor: nwse-resize; }

/* Height-only resize (panels): hide top corners, keep bottom */
.interact-el[data-resize="height"] .resize-handle.rh-tl,
.interact-el[data-resize="height"] .resize-handle.rh-tr { display: none; }
.interact-el[data-resize="height"] .resize-handle.rh-bl,
.interact-el[data-resize="height"] .resize-handle.rh-br { bottom: -9px; }

/* ========== VIDEO EXPORT PROGRESS ========== */
.export-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.export-progress-overlay.active {
    opacity: 1;
    visibility: visible;
}

.export-progress-content {
    background: rgba(26, 26, 46, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 60px;
    text-align: center;
    max-width: 400px;
}

.export-progress-content h3 {
    color: #fff;
    font-size: 20px;
    margin-bottom: 20px;
}

.export-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.export-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90d9, #67b8f7);
    border-radius: 4px;
    transition: width 0.2s ease;
    width: 0%;
}

.export-progress-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.export-status-text {
    color: #67b8f7;
    font-size: 14px;
    margin-bottom: 15px;
    font-weight: 500;
}

.export-info-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-top: 10px;
}

/* ========== TABS 4 COLUMNS ========== */
.tabs {
    flex-wrap: wrap;
}

.tabs .tab {
    min-width: calc(25% - 6px);
    flex: 1 1 calc(25% - 6px);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(26, 26, 46, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast.hiding {
    animation: toastOut 0.3s ease forwards;
}

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

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

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    color: #fff;
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.4);
}

.toast.success .toast-icon {
    color: #22c55e;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.warning {
    border-color: rgba(245, 158, 11, 0.4);
}

.toast.warning .toast-icon {
    color: #f59e0b;
}

.toast.info {
    border-color: rgba(74, 144, 217, 0.4);
}

.toast.info .toast-icon {
    color: #4a90d9;
}

/* ========== CHANGE VIDEO BUTTON ========== */
.btn-change-video {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 14px;
    background: rgba(74, 144, 217, 0.2);
    border: 1px solid rgba(74, 144, 217, 0.4);
    border-radius: 8px;
    color: #4a90d9;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-change-video:hover {
    background: rgba(74, 144, 217, 0.3);
    border-color: #4a90d9;
}

/* ========== COLLAPSIBLE SECTIONS ========== */
.collapsible {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}

.section-header-collapsible {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header-collapsible:hover {
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.1), rgba(255, 255, 255, 0.05));
}

.section-header-collapsible h3,
.section-header-collapsible .section-label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.3px;
}

.collapse-icon {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease;
}

.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.section-description {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    padding: 0 15px 10px;
    margin: 0;
    line-height: 1.4;
}

.collapsible-content {
    padding: 16px;
    padding-top: 12px;
    transition: all 0.3s ease;
}

.collapsible.collapsed .collapsible-content {
    display: none;
}

.collapsible.collapsed .section-description {
    display: none;
}

/* Panel controls specific */
.panel-controls.collapsible {
    background: rgba(255, 255, 255, 0.02);
}

/* Form section sub collapsible */
.form-section-sub.collapsible {
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 15px;
}

.form-section-sub.collapsible .section-header-collapsible {
    padding: 12px 14px;
}

.form-section-sub.collapsible .collapsible-content {
    padding: 14px;
    padding-top: 10px;
}

.form-section-sub.collapsible .collapsible-content .form-group {
    margin-bottom: 12px;
}

.form-section-sub.collapsible .collapsible-content .form-group:last-child {
    margin-bottom: 0;
}

.form-section-sub.collapsible .collapsible-content .form-row {
    margin-top: 10px;
}

/* ========== DRAG INDICATOR ========== */
.drag-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: rgba(74, 144, 217, 0.15);
    border: 1px solid rgba(74, 144, 217, 0.3);
    border-radius: 6px;
    font-size: 10px;
    color: #4a90d9;
    margin-left: 8px;
}

.drag-indicator::before {
    content: '✋';
    font-size: 12px;
}

/* ========== IMPROVED COLLAPSIBLE TOGGLE ========== */
.collapse-toggle,
.collapse-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.25), rgba(59, 130, 246, 0.15));
    border-radius: 6px;
    font-size: 10px;
    color: #60a5fa;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 10px;
    border: 1px solid rgba(74, 144, 217, 0.2);
    flex-shrink: 0;
}

.collapsible:not(.collapsed) .collapse-toggle,
.collapsible:not(.collapsed) .collapse-arrow {
    transform: rotate(90deg);
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.4), rgba(59, 130, 246, 0.3));
    border-color: rgba(74, 144, 217, 0.4);
    color: #93c5fd;
}

.section-header-collapsible:hover .collapse-toggle,
.section-header-collapsible:hover .collapse-arrow {
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.35), rgba(59, 130, 246, 0.25));
    border-color: rgba(74, 144, 217, 0.35);
    transform: scale(1.05);
}

.collapsible:not(.collapsed) .section-header-collapsible:hover .collapse-toggle,
.collapsible:not(.collapsed) .section-header-collapsible:hover .collapse-arrow {
    transform: rotate(90deg) scale(1.05);
}

/* ========== VIDEO PLAYBACK CONTROLS ========== */
.video-playback-controls {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.video-playback-controls .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
}

/* ========== FORM SECTION SUB SPACING ========== */
.form-section-sub {
    margin-top: 16px;
}

.form-section-sub.collapsible {
    margin-top: 12px;
}

.mode-panel .form-group:first-child {
    margin-top: 0;
}

.mode-panel > .form-section-sub:first-of-type {
    margin-top: 16px;
}

/* ========== CHECKBOX LABEL ========== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4a90d9;
}

/* ========== CENTER GUIDE OVERLAY ========== */
.center-guide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
}

.center-guide-line-h {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: rgba(74, 144, 217, 0.5);
    border: none;
}

.center-guide-line-v {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(74, 144, 217, 0.5);
    border: none;
}

.center-guide-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border: 2px solid #4a90d9;
    border-radius: 50%;
    background: transparent;
}

/* ========== NAV TOOLS ========== */
.nav-tools {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: auto;
}

.nav-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    transition: all 0.2s ease;
    user-select: none;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nav-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #4a90d9;
}

.nav-toggle input[type="checkbox"]:checked + span {
    color: #60a5fa;
}

/* ========== GRID OVERLAY ========== */
.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image: 
        linear-gradient(rgba(74, 144, 217, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 144, 217, 0.15) 1px, transparent 1px);
    background-size: 10% 10%;
}

/* Center Guide Overlay - with cross and circle */
#centerGuideOverlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

#centerGuideOverlay .center-guide-line-h {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(74, 144, 217, 0.5);
    transform: translateY(-50%);
}

#centerGuideOverlay .center-guide-line-v {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(74, 144, 217, 0.5);
    transform: translateX(-50%);
}

#centerGuideOverlay .center-guide-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid #4a90d9;
    border-radius: 50%;
    background: transparent;
}

/* ========== PANEL POSITION CONTROLS ========== */
.panel-position-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.panel-position-controls .btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.panel-move-btn,
.panel-collapse-btn {
    transition: all 0.2s ease;
}

.panel-move-btn:hover,
.panel-collapse-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

.panel-collapse-btn.collapsed {
    background: linear-gradient(135deg, #4a90d9 0%, #2989d8 100%);
    border-color: #4a90d9;
    color: #fff;
}

.btn.btn-small {
    padding: 6px 10px;
    font-size: 11px;
}
