/* ============================================
   StoryLab - Painel de Controle e Edição
   Tema Dark Moderno e Elegante
   ============================================ */

/* CSS Variables */
:root {
    /* Cores Principais */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #a855f7;
    --accent: #06b6d4;
    
    /* Cores de Fundo - Dark (padrão) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-elevated: #222230;
    --bg-hover: #2a2a3c;
    --bg-active: #32324a;
    
    /* Cores de Borda */
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    
    /* Cores de Texto - Dark */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-muted: #475569;
    
    /* Cores de Estado */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    --gradient-dark: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --shadow-glow-sm: 0 0 10px rgba(99, 102, 241, 0.2);
    
    /* Bordas */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transições */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Tipografia */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Sidebar */
    --sidebar-width: 260px;
}

/* Tema Light */
body.light-mode {
    /* Cores de Fundo - Light */
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f5;
    --bg-elevated: #e8e8ed;
    --bg-hover: #e0e0e5;
    --bg-active: #d8d8dd;
    
    /* Cores de Borda - Light */
    --border: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.2);
    
    /* Cores de Texto - Light */
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-tertiary: #6a6a7a;
    --text-muted: #8a8a9a;
    
    /* Sombras - Light */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
    --shadow-glow-sm: 0 0 10px rgba(99, 102, 241, 0.15);
}

/* Reset e Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Transição suave para todos os elementos que usam variáveis de tema */
*, *::before, *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Botão de alternância de tema */
.theme-toggle {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: scale(1.05);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    position: absolute;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Dark Mode: mostrar SOL (para mudar para light) */
.theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Light Mode: mostrar LUA (para mudar para dark) */
body.light-mode .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

body.light-mode .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

/* Garantir visibilidade do ícone em ambos os temas */
.theme-toggle svg {
    color: var(--text-primary);
}

/* Ajuste específico para tema light */
body.light-mode .theme-toggle {
    background: var(--bg-tertiary);
    border-color: var(--bg-elevated);
}

body.light-mode .theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* ============================================
   Layout Principal
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--bg-elevated);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--bg-elevated);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-glow-sm);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.logo-text h1 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* Navegação */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 0.9375rem;
    font-weight: 500;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active .nav-link {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow-sm);
}

.nav-divider {
    height: 1px;
    background: var(--bg-elevated);
    margin: 16px 0;
}

/* Footer da Sidebar */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--bg-elevated);
}

.version {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================
   Conteúdo Principal
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--bg-elevated);
}

.main-header h2 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ============================================
   Botões
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow-sm);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--bg-hover);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--bg-active);
}

.btn-text {
    background: transparent;
    color: var(--primary-light);
    padding: 8px 12px;
}

.btn-text:hover {
    background: var(--bg-elevated);
}

.btn-icon {
    padding: 10px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--bg-hover);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-group {
    display: flex;
    gap: 4px;
}

.btn-group .btn {
    border-radius: var(--radius-sm);
}

/* ============================================
   Seções de Conteúdo
   ============================================ */
.content-section {
    display: none;
    animation: fadeIn var(--transition-base);
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-block {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-header h3 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.header-filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ============================================
   Dashboard
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow-sm);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-icon.categories {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.stat-icon.stickers {
    background: rgba(168, 85, 247, 0.1);
    color: var(--secondary);
}

.stat-icon.fonts {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================================
   Grid de Figurinhas
   ============================================ */
.stickers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

.sticker-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
}

.sticker-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.sticker-image {
    aspect-ratio: 1;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sticker-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sticker-info {
    padding: 12px;
}

.sticker-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticker-category {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* Overlay de ações no hover */
.sticker-image {
    aspect-ratio: 1;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.sticker-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.sticker-card:hover .sticker-image img {
    transform: scale(1.05);
}

.sticker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sticker-card:hover .sticker-overlay {
    opacity: 1;
}

/* Container de ações no topo */
.sticker-actions-top {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    opacity: 0;
    transition: all 0.25s ease;
}

.sticker-card:hover .sticker-actions-top {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Botões de ação individuais */
.action-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

.action-btn:hover {
    transform: scale(1.1);
}

/* Cores específicas dos botões */
.action-view:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.action-edit:hover {
    background: var(--primary);
    color: #ffffff;
}

.action-download:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.action-delete {
    background: rgba(239, 68, 68, 0.15);
    color: rgba(255, 150, 150, 0.9);
}

.action-delete:hover {
    background: var(--error);
    color: #ffffff;
}

/* Modal de visualização */
.sticker-view-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.sticker-view-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.sticker-view-info {
    text-align: center;
}

.sticker-view-info h4 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.sticker-view-info p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* Rodapé do modal de visualização */
#sticker-view-modal .modal-footer {
    justify-content: center;
    gap: 0;
}

#sticker-view-modal .modal-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
}

/* Responsivo para ações */
@media (max-width: 640px) {
    .sticker-overlay {
        opacity: 1;
    }
    
    .sticker-actions-top {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
        top: 6px;
        gap: 4px;
        padding: 4px 6px;
    }
    
    .action-btn {
        width: 26px;
        height: 26px;
    }
    
    .action-btn svg {
        width: 12px;
        height: 12px;
    }
}

/* Botão de publicar */
.action-publish {
    background: rgba(16, 185, 129, 0.15);
    color: rgba(110, 231, 183, 0.9);
}

.action-publish:hover {
    background: var(--success);
    color: #ffffff;
}

/* Badges de status */
.sticker-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.sticker-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-draft {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-published {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

/* Modal de confirmação de exclusão */
#sticker-delete-modal .modal-body {
    padding: 32px 24px;
}

.delete-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error);
}

.delete-icon svg {
    width: 32px;
    height: 32px;
}

.delete-message {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.delete-warning {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.delete-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 20px 24px;
}

.delete-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 0.9375rem;
}

.delete-footer .btn svg {
    flex-shrink: 0;
}

/* Responsivo para modal de exclusão */
@media (max-width: 480px) {
    .delete-footer {
        flex-direction: column;
    }
    
    .delete-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   Categorias
   ============================================ */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.category-info {
    flex: 1;
    min-width: 0;
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-count {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.category-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.category-card:hover .category-actions {
    opacity: 1;
}

.category-actions .btn {
    padding: 6px;
}

.category-actions .btn svg {
    width: 16px;
    height: 16px;
}

/* Toggle de Visualização */
.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--bg-elevated);
}

.view-toggle .btn {
    padding: 8px;
    background: transparent;
    border: none;
}

.view-toggle .btn svg {
    width: 18px;
    height: 18px;
}

.view-toggle .btn.active {
    background: var(--primary);
    color: white;
}

/* Modo Lista de Categorias */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-list-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-fast);
}

.category-list-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.category-list-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.category-list-info {
    flex: 1;
    min-width: 0;
}

.category-list-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.category-list-count {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.category-list-actions {
    display: flex;
    gap: 8px;
}

.category-list-actions .btn {
    padding: 8px 12px;
    font-size: 0.8125rem;
}

/* Responsivo para lista */
@media (max-width: 640px) {
    .category-list-item {
        padding: 12px 16px;
    }
    
    .category-list-icon {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
    
    .category-list-name {
        font-size: 0.9375rem;
    }
    
    .category-list-actions .btn {
        padding: 6px 10px;
    }
    
    .category-list-actions .btn span {
        display: none;
    }
}

/* ============================================
   Fontes - Modo Lista
   ============================================ */
.fonts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.fonts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.font-list-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-fast);
}

.font-list-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.font-list-item.default {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.font-list-preview {
    width: 52px;
    height: 52px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--text-primary);
    flex-shrink: 0;
}

.font-list-info {
    flex: 1;
    min-width: 0;
}

.font-list-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    display: block;
}

.font-list-type {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 2px;
    display: block;
}

.font-list-actions {
    display: flex;
    gap: 8px;
}

.font-list-actions .btn {
    padding: 8px;
}

/* Responsivo para lista de fontes */
@media (max-width: 640px) {
    .font-list-item {
        padding: 12px 16px;
    }
    
    .font-list-preview {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }
    
    .font-list-name {
        font-size: 0.9375rem;
    }
}

/* ============================================
   Editor
   ============================================ */
.editor-container {
    display: flex;
    gap: 24px;
    height: calc(100vh - 180px);
    min-height: 600px;
}

.editor-sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-panel {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bg-elevated);
}

.panel-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.panel-tab:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.panel-tab.active {
    background: var(--primary);
    color: white;
}

.panel-content {
    display: none;
}

.panel-content.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

/* Canvas Area */
.editor-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 32px;
    position: relative;
}

.canvas-container {
    position: relative;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    overflow: hidden;
}

#editor-canvas {
    display: block;
    background: var(--bg-tertiary);
    cursor: move;
    max-width: 100%;
    max-height: calc(100vh - 300px);
}

/* Checkerboard pattern para fundo transparente - alta especificidade */
#editor-canvas.transparent-bg,
#editor-canvas.transparent-bg[style] {
    background-color: #1a1a1a !important;
    background-image: 
        linear-gradient(45deg, #252525 25%, transparent 25%),
        linear-gradient(-45deg, #252525 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #252525 75%),
        linear-gradient(-45deg, transparent 75%, #252525 75%) !important;
    background-size: 16px 16px !important;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px !important;
}

/* Checkerboard para tema light */
body.light-mode #editor-canvas.transparent-bg,
body.light-mode #editor-canvas.transparent-bg[style] {
    background-color: #e8e8e8 !important;
    background-image: 
        linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
        linear-gradient(-45deg, transparent 75%, #d0d0d0 75%) !important;
    background-size: 16px 16px !important;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px !important;
}

/* Container do canvas com scroll quando necessário */
.canvas-scroll-container {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 20px;
}

.canvas-wrapper {
    position: relative;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

/* Inputs de dimensão personalizada */
.custom-size-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.custom-size-inputs .input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-size-inputs label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.custom-size-inputs input {
    width: 80px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-align: center;
}

.custom-size-inputs input:focus {
    outline: none;
    border-color: var(--primary);
}

.custom-size-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.custom-size-actions .btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 0.8125rem;
}

/* Destaque para botão de dimensão ativo */
.size-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Indicador visual para modo transparente */
.bg-type-transparent .canvas-wrapper::before {
    content: 'Modo Transparente';
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

.canvas-hint {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    pointer-events: none;
}

.canvas-size-options {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.size-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.size-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.size-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Editor Actions */
.editor-actions {
    padding: 20px;
    border-top: 1px solid var(--bg-elevated);
    display: flex;
    gap: 12px;
}

.editor-actions .btn {
    flex: 1;
}

/* ============================================
   Form Controls
   ============================================ */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input,
.select,
.textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-muted);
}

.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.textarea {
    resize: vertical;
    min-height: 80px;
}

.color-picker {
    width: 100%;
    height: 44px;
    padding: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.range-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow-sm);
}

.range-value {
    display: inline-block;
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.radio-label:hover {
    border-color: var(--bg-hover);
}

.radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.radio-label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.gradient-colors {
    display: flex;
    gap: 12px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.emoji-btn {
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.emoji-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: scale(1.1);
}

/* ============================================
   Fontes
   ============================================ */
.fonts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.font-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 0;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.font-card:hover {
    border-color: var(--primary);
}

.font-card.default {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.font-card-content {
    padding: 20px;
    flex: 1;
}

.font-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--bg-elevated);
    display: flex;
    justify-content: flex-end;
}

.font-card-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    padding: 6px 12px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.font-card-footer .btn:hover {
    color: var(--error);
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.font-card-footer .btn svg {
    opacity: 0.7;
}

.font-preview {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1;
}

.font-info {
    display: flex;
    flex-direction: column;
}

.font-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.font-type {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ============================================
   Settings
   ============================================ */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.settings-card {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.settings-card h3 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bg-elevated);
}

.logo-upload {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-preview {
    width: 80px;
    height: 80px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--bg-elevated);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
}

.logo-preview svg {
    width: 32px;
    height: 32px;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.help-text {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.danger-zone {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--bg-elevated);
}

/* ============================================
   Modals
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn var(--transition-fast);
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp var(--transition-base);
    display: none;
}

.modal.active {
    display: block;
}

.modal-small {
    max-width: 400px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--bg-elevated);
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-body.text-center {
    text-align: center;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--bg-elevated);
}

.modal-footer .btn {
    min-width: 100px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.upload-area svg {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 4px;
}

.upload-area span {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.upload-preview {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 16px;
}

.upload-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.save-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.save-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
}

/* Confirm Modal */
.confirm-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warning);
}

.confirm-icon svg {
    width: 32px;
    height: 32px;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 16px;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--bg-hover);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight var(--transition-base);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.info {
    border-left: 4px solid var(--info);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--error); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.toast-message {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-top: 2px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ============================================
   Utilitários
   ============================================ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* ============================================
   Responsividade
   ============================================ */
@media (max-width: 1024px) {
    .editor-container {
        flex-direction: column;
        height: auto;
    }
    
    .editor-sidebar {
        width: 100%;
        max-height: 500px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    
    .main-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .control-row {
        grid-template-columns: 1fr;
    }
    
    .categories-grid,
    .stickers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal {
        margin: 16px;
    }
    
    .toast-container {
        left: 16px;
        right: 16px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .categories-grid,
    .stickers-grid {
        grid-template-columns: 1fr;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Ajustes específicos para tema light */
body.light-mode .canvas-container {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

body.light-mode .upload-area {
    border-color: var(--bg-elevated);
    background: var(--bg-secondary);
}

body.light-mode .upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

body.light-mode .empty-state svg {
    opacity: 0.3;
}

/* ============================================
   Text Blocks — Multi-text UI
   ============================================ */

.text-blocks-section {
    margin-bottom: 12px;
}

.btn-block-add {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 8px;
}

.text-blocks-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 160px;
    overflow-y: auto;
}

.text-blocks-empty {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
    padding: 8px;
}

.text-block-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    user-select: none;
}

.text-block-item:hover {
    background: var(--bg-hover);
}

.text-block-item.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
}

.text-block-index {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    min-width: 16px;
    text-align: center;
}

.text-block-preview {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-block-delete {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: color var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
}

.text-block-delete:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Layer controls */
.text-block-layers {
    display: flex;
    gap: 2px;
    margin-right: 4px;
}

.text-block-layer-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.text-block-layer-btn:hover:not(.disabled) {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.text-block-layer-btn.disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.text-block-item:hover .text-block-layer-btn:not(.disabled) {
    color: var(--text-secondary);
}

/* Element items (similar to text blocks) */
.element-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-elevated);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    user-select: none;
}

.element-item:hover {
    background: var(--bg-hover);
}

.element-item.active {
    border-color: var(--secondary);
    background: rgba(168, 85, 247, 0.12);
}

.element-thumb {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.element-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.element-info {
    flex: 1;
    min-width: 0;
}

.element-name {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.element-layers {
    display: flex;
    gap: 2px;
    margin-right: 4px;
}

.element-layer-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.element-layer-btn:hover:not(.disabled) {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.element-layer-btn.disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.element-item:hover .element-layer-btn:not(.disabled) {
    color: var(--text-secondary);
}

.element-delete {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: color var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
}

.element-delete:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Control divider */
.control-divider {
    height: 1px;
    background: var(--bg-elevated);
    margin: 16px 0;
}

.text-active-controls {
    border-top: 1px solid var(--bg-elevated);
    padding-top: 12px;
    margin-top: 4px;
}

.btn-full-width {
    width: 100%;
    margin-top: 4px;
}

/* Garantir que elementos com imagem de fundo também transicionem */
.stat-card,
.category-card,
.sticker-card,
.font-card,
.section-block,
.editor-sidebar,
.editor-canvas-area,
.modal,
.category-list-item {
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ================================================
   RESPONSIVIDADE MOBILE
   ================================================ */

/* Tablet e telas médias (até 1024px) */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 60px;
        flex-direction: row;
        padding: 0.75rem 1rem;
        overflow: hidden;
    }

    .sidebar-header {
        padding: 0;
        margin-bottom: 0;
        border-bottom: none;
    }

    .logo-text h1 {
        font-size: 1.1rem;
    }

    .logo-text span {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        flex: 1;
        justify-content: center;
        gap: 0.5rem;
        margin: 0;
        padding: 0;
        overflow-x: auto;
    }

    .nav-item {
        padding: 0.5rem 0.75rem;
        flex-direction: column;
        gap: 0.25rem;
        min-width: 60px;
    }

    .nav-item span {
        font-size: 0.65rem;
    }

    .nav-item svg {
        width: 18px;
        height: 18px;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    .editor-container {
        flex-direction: column;
    }

    .editor-sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .editor-canvas-area {
        min-height: 400px;
    }
}

/* Mobile (até 768px) */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        z-index: 1000;
        max-height: 70px;
        padding: 0.5rem;
        border-top: 1px solid var(--border);
        border-right: none;
    }

    .main-content {
        padding: 1rem 1rem 90px 1rem;
        margin-bottom: 70px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-header .actions {
        width: 100%;
        justify-content: flex-end;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .categories-grid,
    .stickers-grid,
    .fonts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .editor-container {
        flex-direction: column;
    }

    .editor-sidebar {
        width: 100%;
        max-height: 250px;
        order: 2;
    }

    .editor-canvas-area {
        min-height: 350px;
        order: 1;
    }

    .canvas-wrapper {
        max-width: 100%;
    }

    #editor-canvas {
        max-width: 100%;
        height: auto;
    }

    .panel-tabs {
        flex-wrap: wrap;
    }

    .panel-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .btn-group {
        flex-wrap: wrap;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem;
    }

    .view-toggle {
        display: none;
    }
}

/* Mobile pequeno (até 480px) */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .categories-grid,
    .stickers-grid,
    .fonts-grid {
        grid-template-columns: 1fr;
    }

    .section-header h2 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
    }

    .editor-canvas-area {
        min-height: 300px;
        padding: 1rem;
    }

    .canvas-wrapper {
        padding: 0.5rem;
    }

    .range-slider {
        height: 6px;
    }

    .emoji-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .text-block-item,
    .element-item {
        padding: 0.75rem;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Previne zoom em iOS */
    }
}

/* Ajustes para touch */
@media (pointer: coarse) {
    .nav-item,
    .btn,
    .panel-tab,
    .emoji-btn,
    .text-block-item,
    .element-item {
        min-height: 44px; /* Área mínima de toque */
    }

    .btn-icon {
        width: 44px;
        height: 44px;
    }

    .text-block-delete,
    .element-delete,
    .text-block-layer-btn,
    .element-layer-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Orientação landscape em mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        max-height: 50px;
    }

    .nav-item span {
        display: none;
    }

    .main-content {
        padding-bottom: 70px;
    }

    .editor-sidebar {
        max-height: 200px;
    }
}

/* Esconder scrollbar em mobile mas manter funcionalidade */
@media (max-width: 768px) {
    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar-nav {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* ================================================
   IMPORT MODE MODAL
   ================================================ */

.import-mode-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.import-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.import-mode-option:hover {
    border-color: var(--secondary);
    background: rgba(168, 85, 247, 0.08);
    transform: translateY(-2px);
}

.import-mode-option:active {
    transform: translateY(0);
}

.import-mode-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.import-mode-icon.merge {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.import-mode-icon svg {
    width: 24px;
    height: 24px;
}

.import-mode-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.import-mode-content p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ================================================
   MOBILE MENU (HAMBURGUER)
   ================================================ */

/* Botão de menu mobile - escondido por padrão */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    width: 48px;
    height: 48px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

/* Overlay escuro */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1150;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Drawer do menu */
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    z-index: 1200;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.mobile-menu-drawer.active {
    transform: translateX(0);
}

/* Header do menu mobile */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.mobile-menu-header .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-menu-header .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.mobile-menu-header .logo-icon svg {
    width: 24px;
    height: 24px;
}

.mobile-menu-header .logo-text h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-menu-close {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.mobile-menu-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mobile-menu-close svg {
    width: 24px;
    height: 24px;
}

/* Lista de itens do menu */
.mobile-menu-list {
    list-style: none;
    padding: 0.75rem;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.mobile-menu-item {
    margin-bottom: 0.25rem;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 1rem;
    font-weight: 500;
}

.mobile-menu-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.mobile-menu-item.active .mobile-menu-link {
    background: rgba(168, 85, 247, 0.15);
    color: var(--secondary);
}

.mobile-menu-link svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Exibir botão de menu apenas em mobile */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    /* Ajustar padding do main-content para não ficar atrás do botão */
    .main-content {
        padding-top: 5rem;
    }

    /* Esconder a sidebar original em mobile */
    .sidebar {
        display: none;
    }

    /* Ajustar o container para ocupar toda a largura */
    .app-container {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    /* Ajustes para cards de fonte no mobile */
    .fonts-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .font-card-content {
        padding: 16px;
    }
    
    .font-card-footer {
        padding: 10px 16px;
    }
    
    .font-preview {
        font-size: 2rem;
    }
    
    .font-name {
        font-size: 0.875rem;
    }
    
    .font-card-footer .btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

/* Tablet - mostrar sidebar em landscape ou telas maiores */
@media (min-width: 769px) {
    .mobile-menu-btn,
    .mobile-menu-overlay,
    .mobile-menu-drawer {
        display: none !important;
    }
}
