/* Container */
#gal-wrapper { max-width: 960px; margin: 30px auto; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; }

/* Formulário */
.gal-form-container { background: #ffffff; padding: 40px; border-radius: 16px; box-shadow: 0 5px 30px rgba(0,0,0,0.08); border: 1px solid #e8e8e8; }

/* Dicas */
.gal-dicas-box { background: linear-gradient(135deg, #FF6F00 0%, #E65100 100%); color: white; padding: 25px 30px; border-radius: 12px; margin-bottom: 35px; box-shadow: 0 5px 20px rgba(255,111,0,0.25); }
.gal-dicas-box h3 { margin: 0 0 15px; font-size: 20px; font-weight: 700; }
.gal-dicas-box ul { margin: 0; padding-left: 5px; list-style: none; line-height: 2; }
.gal-dicas-box li { margin-bottom: 4px; font-size: 15px; }

/* Form Groups */
.gal-form-group { margin-bottom: 22px; }
.gal-form-group label { display: block; margin-bottom: 10px; font-weight: 600; color: #2c3e50; font-size: 16px; }
.label-icon { font-size: 18px; margin-right: 6px; }
.required { color: #e74c3c; font-weight: 700; }
.gal-form-group input[type="text"], .gal-form-group select, .gal-form-group textarea { width: 100%; padding: 14px 16px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 15px; transition: all 0.3s ease; font-family: inherit; background: #fafafa; box-sizing: border-box; }
.gal-form-group input:focus, .gal-form-group select:focus, .gal-form-group textarea:focus { outline: none; border-color: #FF6F00; box-shadow: 0 0 0 4px rgba(255,111,0,0.12); background: #fff; }
.gal-form-group small { display: block; margin-top: 8px; color: #7f8c8d; font-size: 13px; }
.gal-form-group select:disabled { background: #f0f0f0; color: #999; cursor: not-allowed; opacity: 0.7; }

/* Validação */
.gal-form-group.has-error input, .gal-form-group.has-error select, .gal-form-group.has-error textarea { border-color: #e74c3c !important; box-shadow: 0 0 0 4px rgba(231,76,60,0.12) !important; background: #fff5f5 !important; }
.gal-form-group.has-error label { color: #e74c3c; }
.gal-field-error { display: block; margin-top: 6px; font-size: 13px; font-weight: 600; color: #e74c3c; min-height: 0; transition: all 0.3s ease; }

/* Erro */
.gal-erro-notice { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; padding: 18px 25px; border-radius: 12px; margin-bottom: 25px; font-size: 15px; box-shadow: 0 5px 20px rgba(231,76,60,0.3); animation: gal-slideDown 0.5s ease-out; }
.gal-erro-notice strong { color: #fff; }
.gal-erro-notice small { color: rgba(255,255,255,0.8); }

/* Row */
.gal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Habilidades BNCC */
.gal-habilidades-container { max-height: 300px; overflow-y: auto; border: 2px solid #e0e0e0; border-radius: 10px; padding: 12px; background: #fafafa; margin-top: 8px; }
.gal-habilidades-placeholder { color: #999; font-size: 14px; text-align: center; padding: 20px; margin: 0; }
.gal-habilidades-list { display: flex; flex-direction: column; gap: 6px; }
.gal-hab-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; border: 1px solid transparent; }
.gal-hab-item:hover { background: #fff3e0; border-color: #ffe0b2; }
.gal-hab-item input[type="checkbox"] { margin-top: 3px; accent-color: #FF6F00; width: 18px; height: 18px; flex-shrink: 0; }
.gal-hab-item input:checked ~ .gal-hab-codigo { background: #FF6F00; color: #fff; }
.gal-hab-codigo { background: #e3f2fd; color: #1565c0; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; font-family: monospace; white-space: nowrap; transition: all 0.2s ease; }
.gal-hab-desc { font-size: 13px; color: #555; line-height: 1.4; }
.gal-hab-item input:disabled ~ .gal-hab-desc { opacity: 0.4; }
.gal-hab-item input:disabled ~ .gal-hab-codigo { opacity: 0.4; }

/* Tags */
.gal-tags-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.gal-tag { display: inline-block; padding: 8px 16px; background: #f0f0f0; border: 2px solid #e0e0e0; border-radius: 25px; font-size: 13px; font-weight: 500; color: #555; cursor: pointer; transition: all 0.25s ease; user-select: none; }
.gal-tag:hover { background: #fff3e0; border-color: #FF6F00; color: #e65100; transform: translateY(-2px); box-shadow: 0 3px 10px rgba(255,111,0,0.15); }
.gal-tag.active { background: linear-gradient(135deg, #FF6F00, #E65100); border-color: #E65100; color: white; box-shadow: 0 3px 12px rgba(255,111,0,0.3); }
.gal-tag.shake { animation: gal-shake 0.5s ease; }
@keyframes gal-shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }

/* Botão Principal */
.gal-submit-container { margin-top: 30px; }
.gal-btn-primary { width: 100%; padding: 18px 30px; background: linear-gradient(135deg, #FF6F00 0%, #E65100 100%); color: white; border: none; border-radius: 12px; font-size: 19px; font-weight: 700; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 6px 25px rgba(255,111,0,0.35); letter-spacing: 0.3px; }
.gal-btn-primary:hover { transform: translateY(-3px); box-shadow: 0 10px 35px rgba(255,111,0,0.45); background: linear-gradient(135deg, #E65100 0%, #BF360C 100%); }
.btn-icon { font-size: 22px; margin-right: 10px; }

/* Loading */
.gal-loading { text-align: center; padding: 80px 40px; background: #fff; border-radius: 16px; box-shadow: 0 5px 30px rgba(0,0,0,0.08); min-height: 420px; display: flex; align-items: center; justify-content: center; }
.loading-content { width: 100%; }
.loading-content h3 { color: #E65100; font-size: 26px; margin: 25px 0 15px; font-weight: 700; }
.loading-content p { color: #7f8c8d; font-size: 16px; margin-bottom: 30px; }
.gal-spinner { width: 70px; height: 70px; margin: 0 auto; border: 6px solid #fff3e0; border-top: 6px solid #FF6F00; border-radius: 50%; animation: gal-spin 1s linear infinite; }
@keyframes gal-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-steps { max-width: 400px; margin: 30px auto; text-align: left; }
#gal-wrapper .loading-steps .step { padding: 14px 20px; margin-bottom: 10px; border-radius: 10px; background: #f5f5f5; display: flex; align-items: center; gap: 14px; transition: all 0.4s ease; font-size: 15px; color: #999; }
#gal-wrapper .loading-steps .step.active { background: linear-gradient(135deg, #fff3e0, #ffe0b2); color: #E65100; font-weight: 600; box-shadow: 0 3px 12px rgba(255,111,0,0.15); animation: gal-pulse 1.5s ease-in-out infinite; }
#gal-wrapper .loading-steps .step.complete { background: #FF6F00; color: white; font-weight: 600; }
@keyframes gal-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }
.step-icon { font-size: 22px; }
#gal-wrapper .loading-bar { width: 100%; height: 8px; background: #fff3e0; border-radius: 10px; overflow: hidden; margin: 25px auto 0; max-width: 400px; }
#gal-wrapper .loading-progress { height: 100%; background: linear-gradient(90deg, #FF6F00, #E65100, #FF6F00); border-radius: 10px; animation: gal-progress 2.5s ease-in-out infinite; }
@keyframes gal-progress { 0% { width: 0%; } 50% { width: 75%; } 100% { width: 100%; } }

/* Resultado */
.gal-resultado { position: relative; background: #fff; padding: 45px; border-radius: 16px; box-shadow: 0 5px 30px rgba(0,0,0,0.08); margin-bottom: 30px; border: 1px solid #e8e8e8; }
.gal-atividades-content .plano-header { border-bottom: 4px solid #FF6F00; padding-bottom: 25px; margin-bottom: 35px; }
.gal-atividades-content .plano-header-badge { color: #FF6F00; font-size: 13px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 12px; }
.gal-atividades-content .plano-header h1 { color: #1a1a1a; font-size: 28px; margin: 0 0 20px; font-weight: 800; line-height: 1.3; }
.gal-atividades-content .plano-meta { display: flex; flex-wrap: wrap; gap: 12px; }
.gal-atividades-content .meta-item { background: linear-gradient(135deg, #f8f9fa, #fff3e0); padding: 10px 18px; border-radius: 10px; font-size: 13px; border: 1px solid #ffe0b2; }
.gal-atividades-content .meta-item strong { color: #FF6F00; margin-right: 4px; }
.gal-atividades-content .plano-body h2 { color: #e65100; font-size: 22px; margin: 30px 0 18px; padding: 14px 20px; background: linear-gradient(135deg, #fff3e0, #ffe0b2); border-left: 6px solid #FF6F00; border-radius: 0 10px 10px 0; box-shadow: 0 2px 8px rgba(255,111,0,0.1); }
.gal-atividades-content .plano-body h3 { color: #FF6F00; font-size: 18px; margin: 22px 0 12px; padding: 8px 0 8px 14px; border-left: 4px solid #FFB74D; background: linear-gradient(90deg, #fff8e1, transparent); }
.gal-atividades-content .plano-body p { line-height: 1.8; color: #444; margin-bottom: 12px; }
.gal-atividades-content .plano-body ul, .gal-atividades-content .plano-body ol { margin: 10px 0 15px 25px; line-height: 1.8; }
.gal-atividades-content .plano-body li { margin-bottom: 6px; color: #444; }
.gal-atividades-content .plano-body strong { color: #e65100; }
.gal-atividades-content .plano-body hr { border: none; border-top: 2px dashed #ffe0b2; margin: 30px 0; }

/* LaTeX */
.gal-atividades-content .gpae-latex-block { text-align: center; margin: 20px 0; padding: 15px; background: #fafafa; border: 1px dashed #ccc; border-radius: 8px; font-size: 17px; overflow-x: auto; }
.gal-atividades-content .gpae-latex-inline { font-size: inherit; }

/* Rodapé */
.gal-atividades-content .plano-footer { margin-top: 45px; padding-top: 25px; border-top: 2px dashed #e0e0e0; text-align: center; }
.gal-atividades-content .plano-footer p { font-size: 16px; color: #7f8c8d; margin: 0; }
.gal-atividades-content .plano-footer strong { color: #FF6F00; font-size: 18px; font-weight: 700; }

/* Export */
#gal-export-buttons { text-align: center; padding: 35px; background: #f8f9fa; border-radius: 14px; margin-bottom: 20px; border: 1px solid #e8e8e8; }
#gal-export-buttons h3 { margin-bottom: 25px; color: #2c3e50; font-size: 24px; font-weight: 700; }
.export-buttons-grid { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-bottom: 25px; }
#gal-wrapper .export-btn { background: #FF6F00; color: white; padding: 14px 32px; border: none; border-radius: 10px; cursor: pointer; font-size: 16px; font-weight: 600; transition: all 0.3s ease; min-width: 170px; }
#gal-wrapper .export-btn:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
#gal-wrapper .btn-copiar { background: linear-gradient(135deg, #9b59b6, #8e44ad) !important; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#gal-wrapper .btn-copiar:hover { background: linear-gradient(135deg, #8e44ad, #7d3c98) !important; }
#gal-wrapper .btn-pdf { background: #c0392b !important; }
#gal-wrapper .btn-pdf:hover { background: #a93226 !important; }
#gal-btn-print { background: #e67e22; }
#gal-btn-print:hover { background: #d35400; }
#gal-btn-docx { background: #3498db; }
#gal-btn-docx:hover { background: #2980b9; }
.gal-btn-novo { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; padding: 16px 40px; border: none; border-radius: 10px; cursor: pointer; font-size: 17px; font-weight: 600; transition: all 0.3s ease; box-shadow: 0 5px 15px rgba(231,76,60,0.3); }
.gal-btn-novo:hover { background: linear-gradient(135deg, #c0392b, #a93226); transform: translateY(-3px); }
.gal-btn-compartilhar { background: linear-gradient(135deg, #7c4dff, #651fff); color: white; padding: 16px 40px; border: none; border-radius: 10px; cursor: pointer; font-size: 17px; font-weight: 600; transition: all 0.3s ease; box-shadow: 0 5px 15px rgba(124,77,255,0.3); }
.gal-btn-compartilhar:hover { background: linear-gradient(135deg, #651fff, #5c16e6); transform: translateY(-3px); }

/* Ajuste */
.gal-ajuste-container { background: linear-gradient(135deg, #fff8e1, #fff3c4); padding: 30px; border-radius: 14px; margin-bottom: 20px; border: 2px solid #f9a825; border-left: 6px solid #f9a825; }
.gal-ajuste-container h3 { margin: 0 0 18px; color: #e65100; font-size: 20px; font-weight: 700; }
.gal-ajuste-container textarea { width: 100%; padding: 14px 16px; border: 2px solid #e0e0e0; border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff; box-sizing: border-box; transition: border-color 0.3s ease; resize: vertical; min-height: 80px; }
.gal-ajuste-container textarea:focus { outline: none; border-color: #f9a825; box-shadow: 0 0 0 4px rgba(249,168,37,0.15); }
.gal-ajuste-container small { display: block; margin-top: 8px; color: #7f8c8d; font-size: 13px; }
.gal-ajuste-buttons { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.gal-btn-ajustar { background: linear-gradient(135deg, #f9a825, #f57f17); color: white; padding: 14px 30px; border: none; border-radius: 10px; cursor: pointer; font-size: 16px; font-weight: 600; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(249,168,37,0.3); flex: 1; min-width: 200px; }
.gal-btn-ajustar:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(249,168,37,0.4); }
.gal-btn-refazer { background: linear-gradient(135deg, #7b1fa2, #6a1b9a); color: white; padding: 14px 30px; border: none; border-radius: 10px; cursor: pointer; font-size: 16px; font-weight: 600; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(123,31,162,0.3); flex: 1; min-width: 200px; }
.gal-btn-refazer:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(123,31,162,0.4); }
.gal-ajuste-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.92); display: flex; align-items: center; justify-content: center; z-index: 10; border-radius: 16px; animation: gal-fadeIn 0.3s ease; }
.gal-ajuste-loading { text-align: center; padding: 30px; }
@keyframes gal-fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes gal-slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* Tables */
.gal-atividades-content .plano-body table { width: 100%; border-collapse: collapse; margin: 15px 0; font-size: 14px; }
.gal-atividades-content .plano-body th, .gal-atividades-content .plano-body td { padding: 10px 14px; border: 1px solid #ddd; text-align: left; }
.gal-atividades-content .plano-body th { background: #fff3e0; font-weight: 700; color: #e65100; }
.gal-atividades-content .plano-body tr:nth-child(even) td { background: #fafafa; }
.gal-atividades-content .plano-body pre { background: #f5f5f5; padding: 15px; border-radius: 8px; border: 1px solid #e0e0e0; font-family: 'Courier New', monospace; font-size: 14px; overflow-x: auto; white-space: pre-wrap; margin: 12px 0; }

/* Print */
@media print {
    body * { visibility: hidden; }
    #gal-resultado-container, #gal-resultado-container * { visibility: visible; }
    #gal-resultado-container { position: absolute; left: 0; top: 0; width: 100%; }
    #gal-export-buttons, .gal-ajuste-container, .gal-btn-novo, .gal-btn-compartilhar, .gal-btn-refazer, .gal-debug-panel { display: none !important; }
    .gal-resultado { box-shadow: none; border: none; padding: 20px; }
}

/* Responsivo */
@media (max-width: 768px) {
    .gal-form-container { padding: 25px; }
    .gal-row { grid-template-columns: 1fr; }
    .export-buttons-grid { flex-direction: column; }
    .export-btn { width: 100%; }
    .gal-atividades-content .plano-meta { flex-direction: column; }
    .gal-atividades-content .meta-item { width: 100%; }
    .gal-resultado { padding: 25px; }
    .gal-atividades-content .plano-header h1 { font-size: 22px; }
    .gal-tags-container { gap: 8px; }
    .gal-tag { font-size: 12px; padding: 6px 12px; }
    .gal-ajuste-buttons { flex-direction: column; }
    .gal-btn-ajustar, .gal-btn-refazer { width: 100%; min-width: auto; }
}

/* Scrollbar */
#gal-wrapper ::-webkit-scrollbar { width: 8px; }
#gal-wrapper ::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
#gal-wrapper ::-webkit-scrollbar-thumb { background: #FF6F00; border-radius: 10px; }
#gal-wrapper ::-webkit-scrollbar-thumb:hover { background: #E65100; }

/* Emojis WordPress */
#gal-wrapper img.emoji, .gal-atividades-content img.emoji { width: 1.2em !important; height: 1.2em !important; display: inline !important; vertical-align: -0.15em !important; margin: 0 2px !important; }
