/* SYSTEM & GLOBAL VARIABLES */
:root {
    --bg-main: rgb(9, 9, 14);
    --bg-card: rgb(24, 25, 30);
    --bg-input: rgb(14, 17, 21);
    --border-color: #222731;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-orange: #f27a1a;
    --accent-orange-hover: #d9650d;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* OVERRIDE PARA MODO CLARO (Blanco frío siguiendo el patrón slate de R24 G25 B30) */
body.light-theme {
    --bg-main: rgb(240, 241, 246); /* Blanco frío/grisáceo */
    --bg-card: rgb(250, 251, 255); /* Tarjetas en blanco limpio */
    --bg-input: rgb(228, 230, 238); /* Cajas de texto e inputs claros */
    --border-color: rgb(200, 204, 218);
    --text-primary: rgb(20, 25, 35);
    --text-secondary: rgb(90, 95, 110);
    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Transición de colores suave para cambio de tema */
body, .sidebar, .tools-card, .carbon-ad, .preview-header, .preview-footer, .zoom-selector, .theme-toggle-btn, .btn-sec, .btn-primary, .input-wrapper input, .color-picker-custom, .custom-select, .margin-inputs input {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* APP LAYOUT STRUCTURE */
.container {
    display: flex;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-main);
    overflow: hidden;
}

/* SIDEBAR (LEFT CONTROLS PANEL) */
.sidebar {
    width: 330px;
    background-color: var(--bg-main);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

/* BRAND HEADER */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px;
}
.brand-logo {
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    border-radius: 10px;
}
.brand-text {
    display: flex;
    flex-direction: column;
}
.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}
.brand-sub {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 6px;
}
.version-badge {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

/* MODE SELECTOR (SEGMENTED PILL NAVIGATION) */
.mode-selector {
    position: relative;
    display: flex;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 4px;
    gap: 2px;
    z-index: 1;
}

.mode-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
    font-family: var(--font-family);
}

.mode-btn.active {
    color: #ffffff;
}

body.light-theme .mode-btn.active {
    color: #ffffff;
}

.mode-slider {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(33.33% - 4px);
    background-color: var(--accent-blue);
    border-radius: 10px;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
}

/* TOOLS CARD */
.tools-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* CONTROL SECTIONS */
.control-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}
.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}

/* INPUTS & CONTROLS */
.input-wrapper input[type="text"] {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    outline: none;
    box-sizing: border-box;
}
.input-wrapper input[type="text"]:focus {
    border-color: var(--accent-blue);
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
    transition: opacity 0.3s ease;
}
.control-row label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* CUSTOM RANGE SLIDERS */
.range-container {
    display: flex;
    align-items: center;
    gap: 10px;
}
.range-container input[type="range"] {
    flex-grow: 1;
    height: 4px;
    background: var(--bg-input);
    border-radius: 4px;
    outline: none;
    appearance: none;
    accent-color: var(--accent-blue);
}
.range-container input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--text-primary);
    cursor: pointer;
    transition: transform 0.1s;
}
.range-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.range-val {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 44px;
    text-align: right;
}

/* Color Picker styles */
.color-picker-custom {
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
    gap: 10px;
    cursor: pointer;
}
.color-preview {
    width: 16px;
    height: 16px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.color-name {
    font-size: 0.82rem;
    font-weight: 500;
    flex-grow: 1;
}
.color-hex {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.color-popover {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    z-index: 100;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    padding: 12px;
    width: 220px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.color-dot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.1s;
    padding: 0;
}
.color-dot:hover {
    transform: scale(1.1);
}
.custom-color-btn {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background-color 0.2s;
}
.custom-color-btn:hover {
    background-color: var(--bg-card);
}

/* CUSTOM SELECT */
.custom-select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239ca3af' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 32px;
}

/* TOGGLE ROW */
.control-row-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}
.control-row-toggle label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-input);
    transition: .3s;
    border-radius: 34px;
}
.slider-toggle:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider-toggle {
    background-color: var(--accent-blue);
}
input:checked + .slider-toggle:before {
    transform: translateX(20px);
}

/* MARGINS INPUT */
.margin-inputs {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease, margin-top 0.4s ease;
}
.margin-inputs.show {
    max-height: 50px;
    opacity: 1;
    margin-top: 8px;
}
.margin-inputs input {
    width: 80px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    text-align: center;
    outline: none;
}
.dash {
    color: var(--text-secondary);
}

/* SPINNERS HIDDEN */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* CARBON ADS STYLE AD */
.carbon-ad {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px 16px;
    min-height: 110px;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}
.carbon-ad:hover {
    border-color: #2d3442;
    background-color: rgba(59, 130, 246, 0.03);
}
.ad-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.ad-tag {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.ad-tag strong {
    color: var(--text-primary);
}
.ad-plus {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.ad-desc {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
    max-height: 80px;
    opacity: 1;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.4s ease;
}

/* Estado contraído del anuncio */
.carbon-ad.shrunk {
    min-height: 48px;
    padding: 10px 14px;
    gap: 0;
}
.carbon-ad.shrunk .ad-desc {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

/* PREVIEW PANELS */
.preview-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle, #181c24 0%, #0d0f13 100%);
    overflow: hidden;
    position: relative;
}

body.light-theme .preview-panel {
    background: radial-gradient(circle, #ffffff 0%, #e2e8f0 100%);
}

/* DROPZONE */
.dropzone {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    border: 3px dashed var(--accent-blue);
    margin: 40px;
    border-radius: 24px;
    background-color: rgba(24, 25, 30, 0.4);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    backdrop-filter: blur(10px);
}
body.light-theme .dropzone {
    background-color: rgba(250, 251, 255, 0.6);
}
.dropzone:hover {
    background-color: rgba(59, 130, 246, 0.05);
    border-color: var(--accent-blue-hover);
}
.dropzone p {
    margin: 4px 0;
}

/* CANVAS WRAP */
.canvas-wrap {
    display: none;
    flex-grow: 1;
    padding: 40px;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    overflow: auto;
    position: relative;
}

canvas {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    background-color: white;
    border-radius: 8px;
    display: block;
}

body.light-theme canvas {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* LÍNEAS GUÍA DE MARGEN EN PANTALLA */
.margin-guide {
    position: absolute;
    border: 1px dashed rgba(239, 68, 68, 0.5); /* Rojo sutil semi-transparente */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, top 0.2s ease, bottom 0.2s ease, left 0.2s ease, right 0.2s ease;
    z-index: 10;
}

.margin-guide.visible {
    opacity: 1;
}

.margin-guide-top {
    left: 0;
    right: 0;
    height: 0;
    border-width: 1px 0 0 0;
}

.margin-guide-bottom {
    left: 0;
    right: 0;
    height: 0;
    border-width: 0 0 1px 0;
}

.margin-guide-left {
    top: 0;
    bottom: 0;
    width: 0;
    border-width: 0 0 0 1px;
}

.margin-guide-right {
    top: 0;
    bottom: 0;
    width: 0;
    border-width: 0 1px 0 0;
}

/* PAGE NAVIGATION FOR PDF */
#page-nav {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#page-nav button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    border-radius: 8px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background 0.15s;
}

#page-nav button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

#page-nav button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#page-info {
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: 90px;
    text-align: center;
}

/* THUMBNAILS TOGGLE */
.thumb-toggle {
    display: none;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-align: center;
    cursor: pointer;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.thumb-toggle:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* MINIATURAS EN LA BARRA INFERIOR (FOOTER) */
.footer-thumbnails {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
    flex-grow: 1;
    max-width: 50%;
    padding: 0 10px;
    box-sizing: border-box;
}

/* Ocultar barra de scroll en navegadores WebKit pero mantener funcionalidad de arrastre horizontal */
.footer-thumbnails::-webkit-scrollbar {
    height: 4px;
}
.footer-thumbnails::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.thumb-item {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    background-color: var(--bg-input);
    transition: all 0.2s ease;
}

.thumb-item:hover {
    border-color: var(--text-secondary);
}

.thumb-item.active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

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

.thumb-item.add-thumb {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--text-secondary);
    border-style: dashed;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.thumb-item.add-thumb:hover {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    background-color: rgba(59, 130, 246, 0.05);
}

.thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.thumb-remove:hover {
    background: rgb(220, 38, 38);
}

/* PREVIEW FOOTER */
.preview-footer {
    height: 64px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background-color: var(--bg-card);
    flex-shrink: 0;
}
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.zoom-selector {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}
.zoom-selector .arrow {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* BUTTONS */
.btn-primary {
    background-color: var(--accent-blue);
    border: none;
    border-radius: 12px;
    color: white;
    padding: 8px 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-blue-hover);
    transform: translateY(-1px);
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

#ext-btn-preview {
    background-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    width: 100%;
}
#ext-btn-preview:hover:not(:disabled) {
    background-color: #4f46e5;
}

/* THEME TOGGLE BTN */
.theme-toggle-btn {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    width: 32px;
}
.theme-toggle-btn:hover {
    background-color: var(--bg-card);
    border-color: #2d3442;
}

/* FLOATING KO-FI BUTTON */
#kofi-float-btn {
    position: fixed;
    bottom: 84px;
    right: 24px;
    background-color: var(--accent-orange);
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.82rem;
    box-shadow: 0 6px 20px rgba(242, 122, 26, 0.35);
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
    z-index: 1000;
}
#kofi-float-btn:hover {
    background-color: var(--accent-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(242, 122, 26, 0.45);
}
.coffee-icon {
    font-size: 1.1rem;
}

/* ADVANCED TOGGLE BTN & PANEL */
.advanced-toggle-btn {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-family);
    margin-top: 4px;
}
.advanced-toggle-btn:hover {
    background-color: var(--bg-card);
    border-color: #2d3442;
}
.arrow-icon {
    font-size: 0.65rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}
.advanced-toggle-btn.active .arrow-icon {
    transform: rotate(180deg);
}

.advanced-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease, margin-top 0.4s ease;
    margin-top: 0;
}
.advanced-settings-panel.open {
    max-height: 480px;
    opacity: 1;
    margin-top: 12px;
}

#wm-repeat-row {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease, margin-top 0.4s ease;
}
#wm-repeat-row.show {
    max-height: 80px;
    opacity: 1;
    margin-top: 8px;
}

/* MOBILE AD BANNER */
.mobile-ad-banner {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
    padding: 12px 16px;
    box-sizing: border-box;
    align-items: center;
    gap: 12px;
    transition: transform 0.3s ease;
}
.mobile-ad-banner.collapsed {
    transform: translateY(100%);
}
.close-ad-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-ad-btn:hover {
    color: var(--text-primary);
}
.mobile-ad-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
    font-size: 0.78rem;
    color: var(--text-primary);
}
.ad-tag {
    background-color: var(--bg-input);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
}
.mobile-ad-text {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.mobile-ad-link {
    background-color: var(--accent-orange);
    color: white;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* RESPONSIVE LAYOUT FOR MOBILE / VERTICAL SCREENS */
@media (max-width: 768px), (orientation: portrait) {
    .container {
        flex-direction: column;
        height: 100vh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
        gap: 12px;
    }

    .tools-card {
        padding: 16px;
        border-radius: 18px;
    }

    .dropzone {
        margin: 20px;
        padding: 24px;
    }

    .canvas-wrap {
        padding: 20px;
    }

    .preview-footer {
        padding: 0 16px;
        height: 56px;
    }

    .zoom-controls {
        font-size: 0.78rem;
    }

    .btn-primary {
        padding: 6px 14px;
        font-size: 0.78rem;
    }

    /* Mobile ad spacing */
    .mobile-ad-banner {
        display: flex;
    }

    #kofi-float-btn {
        bottom: 76px;
        padding: 0;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(242, 122, 26, 0.4);
    }
    .kofi-text {
        display: none;
    }
}
