/* Color Palette */
:root {
    --md-primary-color: #979797;
    /* Indigo */
    --md-primary-color-dark: #4f4f50;
    --md-primary-color-light: #c5cae9;
    --md-accent-color: #ff4081;
    /* Pink */
    --md-text-color: #212121;
    --md-secondary-text-color: #757575;
    --md-divider-color: #bdbdbd;
    --md-background-color: #f5f5f5;
    --md-surface-color: #ffffff;

    /* Shadows for elevation */
    --md-shadow-1: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.12), 0 1px 5px 0 rgba(0, 0, 0, 0.20);
    --md-shadow-2: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.20);
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    color: var(--md-text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.5;
    background-color: #FCFCF9;

}

header {
    background-color: transparent;
    color: var(--md-secondary-text-color);
    padding: 1rem 20px;
    text-align: center;
    box-shadow: var(--md-shadow-1);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header-icon {
    height: 60px;
    width: auto;
}

header h1 {
    font-weight: 500;
    font-size: 2.2rem;
    margin: 0;
}

/* ===== HEADER COM TÍTULO + BADGES CENTRALIZADOS ===== */
.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    padding-top: 5px;
}

.header-right-image img {
    /* Ajuste o tamanho da imagem conforme necessário */
    display: grid;
    height: 80px;
    width: auto;
}

.title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

header h1 {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 500;
}

/* Badges centralizados e bonitos */
.github-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 14px;
    border-radius: 3px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    color: #333;
    background: #ffffff;
    border: 2px solid #cccccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    height: 36px;
    /* ← altura fixa para todos */
    box-sizing: border-box;
    white-space: nowrap;
}

.badge.version {
    border-color: #aaaaaa;
}

.badge.license {
    border-color: #81c784;
}

.badge.platform {
    border-color: #9575cd;
}

.badge.love {
    border-color: #e57373;
}

/* Em telas pequenas mantém bonito */
@media (max-width: 600px) {
    .header-content {
        padding-top: 12px;
    }

    header h1 {
        font-size: 1.9rem;
    }

    .badge {
        font-size: 0.72rem;
        padding: 4px 9px;
    }
}

/* Badge do GitHub com borda cinza 80% */
.badge.github {
    background: #24292e;
    color: white;
    display: inline-flex;
    align-items: center;
    /* ← alinha verticalmente tudo */
    justify-content: center;
    /* ← centraliza horizontalmente */
    gap: 6px;
    /* espaço entre ícone e texto */
    text-decoration: none;
    border: 2px solid #cccccc;
    /* borda cinza 80% */
    padding: 7px 14px !important;
    /* ← MESMO PADDING dos outros badges */
    line-height: 1;
    /* ← evita desalinhamento */
    transition: all 0.2s ease;
    height: 36px;
    /* ← altura fixa igual aos outros */
    box-sizing: border-box;
}

.badge.github:hover {
    background: #2ea44f;
    border-color: #27a347;
    transform: translateY(-1px);
}

/* FIM DOS BADGES CENTRALIZADOS */

h1 {
    font-weight: 500;
    font-size: 2.2rem;
    margin: 0;
}

h2 {
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--md-primary-color-dark);
    /*margin: 0 0 1rem 0; */
}

main {
    display: flex;
    flex-direction: row !important;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    flex: 1;
}

.card {
    /*background-color: var(--md-surface-color);*/
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--md-shadow-1);
    transition: box-shadow 0.3s ease-in-out;
}

.prompt-input-section {
    flex: 1;
    /* ← VOLTA A LARGURA ORIGINAL */
    min-width: 300px;
    display: flex;
    flex-direction: column;
    overflow: visible !important;
    max-height: none !important;

    gap: 16px !important;
    /* ← ESPAÇO ENTRE TODOS OS ELEMENTOS */
    padding: 10px !important;
    background-color: #FCFCF9;
}

#searchInput{
    background-color: white;
}
.card:hover {
    box-shadow: var(--md-shadow-2);
}

/* Sidebar */
.sidebar {
    width: 280px !important;
    flex-shrink: 0 !important;
}

#categoryList {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
    border-top: 1px solid var(--md-divider-color);
}

#categoryList li {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--md-divider-color);
    color: var(--md-secondary-text-color);
    transition: background-color 0.2s ease, color 0.2s
}

#categoryList li.active {
    background-color: #bdbdbd80;
    color: var(--md-primary-color-dark);
    font-weight: 500;
}

#categoryList li:hover:not(.active) {
    background-color: #f0f0f0;
}

.delete-category-btn {
    background: transparent !important;
    border: none !important;
    color: #888 !important;
    cursor: pointer;
    padding: 8px !important;
    border-radius: 8px !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
}

.delete-category-btn:hover {
    background: #ffebee !important;
    color: #d32f2f !important;
    transform: scale(1.1) !important;
}

.delete-category-btn svg {
    width: 18px;
    height: 18px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
    align-items: center;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: none;
    border: 1px solid var(--md-divider-color);
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    color: var(--md-text-color);
    background-color: white;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    border-color: var(--md-primary-color);
    box-shadow: 0 0 0 1px var(--md-primary-color);
    outline: none;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%23757575%22%20d%3D%22M6%209L0%203h12z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Buttons */
.md-button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: var(--md-shadow-1);
}

.md-button:hover {
    box-shadow: var(--md-shadow-2);
}

#downloadDataBtn{
    background-color: var(--md-primary-color);
    color: white;
}

#uploadDataBtn {
    background-color: var(--md-primary-color);
    color: white;
}
#addCategoryBtn {
    background-color: var(--md-primary-color);
    color: white;
}

#addCategoryBtn:hover {
    background-color: var(--md-primary-color-dark);
}

.md-button-primary {
    background-color: var(--md-accent-color);
    color: white;
}

.md-button-primary:hover {
    background-color: #e00057;
}

/* Input section stays compact */
.prompt-input-section.card {
    flex-shrink: 0;
    max-height: none;
    background-color: #FCFCF9;
}

.prompt-input-section textarea {
    min-height: 80px;
    max-height: 200px;
    /* ← limite máximo */
    resize: vertical;
    /* ← permite redimensionar só vertical */
    overflow-y: auto;
    /* ← scroll quando ultrapassar */
    flex: 1;
}

/* Display section takes all remaining space */
.prompt-display-section.card {
    flex: 1 1 300px;
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 16px;
    overflow: visible !important;
    margin-top: 10px;
    margin-bottom: 10px;
    background-color: #FCFCF9;
}

.prompt-display-section h2 {
    margin-top: 0;
    flex-shrink: 0;
    margin-bottom: 5px;
    background-color: #FCFCF9;
}

/* Scrollable prompt list */
#promptDisplay {
    /* Define o layout da lista de prompts */
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Espaço entre cada card */

    /* Garante que ele não seja escondido por padrões */
    width: 100%;
    padding-top: 15px;
    /* Espaço entre o título e o primeiro card */
}

/* Nice scrollbar (Chrome/Edge/Safari) */
#promptDisplay::-webkit-scrollbar {
    width: 8px;
}

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

#promptDisplay::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#promptDisplay::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Prompt Cards */
/* ====== PROMPT CARD CONSOLIDADO ====== */
.prompt-card {
    /* Layout e Dimensões (Mantido do segundo bloco, mas refinado) */
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* CRÍTICO: Permite que o texto comece no topo */
    width: 100%;
    box-sizing: border-box; /* Garante que padding e borda estejam incluídos no width */
    gap: 12px;
    
    /* Estilo e Cores */
    background-color: #FCFCF9; /* Use uma única cor de fundo */
    border: 1px solid #e0e0e0; /* Mantenha a borda do primeiro bloco */
    border-radius: 8px;
    box-shadow: var(--md-shadow-1, 0 1px 3px rgba(0,0,0,0.1)); /* Use o var ou um fallback */
    margin-bottom: 8px;
    transition: all 0.2s ease;
    
    /* Padding (Ajustado para o modo de exibição, mas o modo de edição tem suas próprias regras) */
    padding: 12px 14px; 
    padding-top: 25px; /* Mantém o espaço para a data no modo de exibição */
    
    position: relative; /* Necessário para ancorar a data */

    max-height: 200px; /* Altura máxima em estado compacto */
    min-height: 120px; /* Garante que cards menores não fiquem espremidos */
    overflow: hidden;
    transition: max-height 0.3s ease-out, box-shadow 0.2s ease-out;
}

.prompt-card:hover {
    background-color: #F2F2EE;
    border-color: #FFEEBC; 
    border-width: 2px;
    
    /* CRÍTICO: Elevação e Sombra Juntos */
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Adiciona sombra na elevação */
}

/* This is the key part — makes text behave exactly like a textarea */
.prompt-card p {
    flex: 1;
    margin-top: 5px; /* Novo respiro superior sutil */
    margin-bottom: 0; /* GARANTE que não vaze */
    
    padding: 8px 12px;
    
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    min-height: 48px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    color: var(--md-text-color);
    overflow: hidden;
    resize: none;
    line-height: 1.6;
    
    /* Mantenha o overflow, pois ele ajuda a conter o texto */
    overflow: hidden; 
    resize: none;
    line-height: 1.6;
    height: -webkit-fill-available;
}

.placeholder-highlight {
    background: linear-gradient(180deg, rgba(255, 244, 100, 0.4) 0%, rgba(255, 230, 0, 0.25) 100%);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
    color: #b85c00;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: inline;
}

.prompt-card .prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 3px;
}

.delete-prompt-btn,
.copy-prompt-btn {
    width: 44px !important;
    height: 44px !important;
    background: #f8f9fa !important;
    border-radius: 12px !important;
    border: none !important;
    font-size: 20px !important;
    color: #555 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    transition: all 0.25s ease !important;
    padding: 0 !important;
}

.copy-prompt-btn:hover {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    transform: scale(1.15) !important;
}

.delete-prompt-btn:hover {
    background: #ffebee !important;
    color: #c62828 !important;
    transform: scale(1.15) !important;
}

/* This is the key line that fixes the invisible icons */
.copy-prompt-btn i,
.delete-prompt-btn i {
    font-size: 22px !important;
    pointer-events: none;
}

.no-prompts-message {
    text-align: center;
    color: var(--md-secondary-text-color);
    font-style: italic;
    padding: 20px;
}

/* Data Management */
.data-management-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--md-divider-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-management-section h3 {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--md-primary-color-dark);
    margin: 0 0 0.5rem 0;
}

.data-management-section .md-button {
    background-color: var(--md-secondary-text-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.data-management-section .md-button:hover {
    background-color: #616161;
}

/* Responsive */
@media (max-width: 768px) {
    main {
        flex-direction: column;
        padding: 10px;
        margin: 10px auto;
    }

    .sidebar {
        width: 100%;
    }

    .input-group {
        flex-wrap: wrap;
    }
}

/* Drag & Drop para categorias */
#categoryList li.dragging {
    opacity: 0.5;
    background: #e0e0e0;
    transform: rotate(4deg);
}

#categoryList li.drag-over {
    border-top: 3px solid var(--md-accent-color);
    margin-top: 8px;
}

/* Suaviza a transição quando soltar */
#categoryList {
    transition: all 0.2s ease;
}

/* Fim Drag & Drop para categorias */

/* Drag-handle style */
.drag-handle {
    width: 20px;
    height: 32px;
    cursor: grab;
    flex-shrink: 0;
    margin-right: 10px;
    opacity: 0.5;
    align-items: center;
    justify-content: center;
    user-select: none;
    position: relative;
}

.drag-handle:active {
    cursor: grabbing;
    opacity: 0.8;
}

/* Os 8 pontinhos feitos com pseudo-elementos */
.drag-handle::before,
.drag-handle::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    background-color: #979797;
    border-radius: 50%;
    box-shadow:
        0 8px 0 #979797,
        0 16px 0 #979797,
        0 24px 0 #979797;
}

.drag-handle::before {
    left: 4px;
}

.drag-handle::after {
    right: 4px;
}

/* Fim Drag-handle style */

/* ====== CONTADOR DE PROMPTS NAS CATEGORIAS ====== */
.category-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.prompt-count {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prompt-count::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #979797;
    border-radius: 50%;
    display: inline-block;
}

/* ====== TEXTAREA DE INPUT – REDIMENSIONÁVEL COM HANDLE VISÍVEL ====== */
.prompt-input-section {
    display: block !important;
    /* ← SAI DO FLEX */
    position: relative;
    padding: 20px;
    overflow: visible !important;
    min-height: 200px;
    gap: 15px;
    background-color: #F2F2EE;
}

#newPromptText {
    min-height: 80px !important;
    max-height: 400px !important;
    resize: vertical !important;
    overflow-y: auto !important;
    padding: 12px !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    background: #fafafa !important;
    flex: 1;
    margin: 0 0 12px 0 !important;
    box-sizing: border-box !important;
}

/* Força o handle do Chrome a aparecer */
#newPromptText::-webkit-resizer {
    background: #ddd !important;
    border: 1px solid #ccc !important;
    width: 12px !important;
    height: 12px !important;
}

/* ====== HANDLE DE REDIMENSIONAMENTO – ESTILO PROFISSIONAL ====== */
.textarea-wrapper {
    position: relative;
    width: 100%;
    height: auto;
}

#newPromptText {
    display: block !important;
    width: 100% !important;
    min-height: 80px !important;
    max-height: 400px !important;
    /* ← desativa o handle padrão */
    overflow-y: auto !important;
    padding: 12px 12px 28px 12px !important;
    /* espaço pro handle */
    font-family: 'Roboto', sans-serif !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    background: #fafafa !important;
    margin: 1 !important;

    transition: height 0.1s ease !important;
    resize: none !important;
    box-sizing: border-box !important;
}

/* Handle personalizado */
.resize-handle {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 16px;
    color: #aaa;
    cursor: s-resize;
    user-select: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.textarea-wrapper:hover .resize-handle,
#newPromptText:focus~.resize-handle {
    opacity: 0.6;
    pointer-events: auto;
}

.textarea-wrapper:active .resize-handle {
    opacity: 1;
}

/* ====== BOLINHA VERDE SE CATEGORIA TEM PROMPTS ====== */
.category-name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.prompt-count {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prompt-count::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #ccc;
    /* cinza por padrão */
    border-radius: 50%;
    display: inline-block;
    transition: background 0.2s ease;
}

/* Verde quando a categoria tem pelo menos 1 prompt */
li.has-prompts .prompt-count::before {
    background: #4caf50 !important;
    /* verde */
}

.prompt-area {
    height: auto !important;
    min-height: min-content;
    flex-grow: 1;
}

.prompt-input-section,
.prompt-display-section {
    width: 100% !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: 250px;
    background-color: #F2F2EE;
}

/* ====== BOTÃO ADD PROMPT – ESTILO CONSISTENTE ====== */
#addPromptBtn {
    background: #f5f5f5 !important;
    color: #555 !important;
    border: 1px solid #ddd !important;
    padding: 10px 20px !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    align-self: flex-start !important;
    margin-top: 8px !important;
    border-radius: 5px !important;
    /* ← 50% do original (20px → 10px) */
}

#addPromptBtn:hover {
    background: #4caf50 !important;
    color: white !important;
    border-color: #4caf50 !important;
    transform: translateY(-1px);
}

/* ====== SELECT DE CATEGORIA – ESPAÇAMENTO E ESTILO ====== */
#promptCategorySelect {
    -webkit-appearance: none !important;
    /* remove estilo padrão */
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='%23666'%3e%3cpath d='M4.5 6.5l3.5 3.5 3.5-3.5z'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    padding-right: 40px !important;
    background-color: white;
    /* espaço pra setinha */
}

#promptCategorySelect:focus {
    outline: none !important;
    border-color: #979797 !important;
    box-shadow: 0 0 0 2px rgba(151, 151, 151, 0.2) !important;
}

.search-container {
    position: relative !important;
    /* ← ESSA LINHA É OBRIGATÓRIA */
    margin: 0 0 16px 0;
    max-width: 100%;
}

#globalSearch {
    position: relative !important;
    padding-right: 40px !important;
    /* ← espaço pro ícone */
}

.search-icon {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 1 !important;
}

/* 2. O CONTÊINER da data precisa ser "absolute" */
.prompt-header-info {
    position: absolute; 
    top: 5px; 
    right: 5px; 
    font-size: 0.85em; 
    z-index: 2;
}

/* 3. Estilo DISCRETO para a data */
.date-added {
    font-size: 0.75em;
    /* Fonte pequena */
    color: #888;
    /* Cor cinza discreta */
    opacity: 0.7;
    /* Suaviza a visibilidade */
    user-select: none;
}

/* Novo: Garante que os inputs e o botão fiquem lado a lado */
.category-input-group {
    display: flex;
    gap: 5px;
    width: 100%;
    align-items: center;
    /* Garante alinhamento vertical */
}

/* Estilo para o seletor de cores (para alinhamento e tamanho) */
#categoryColorInput {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    /* Definimos 40px, que é o tamanho mínimo aceitável pelo navegador */
    width: 35px;
    height: 35px;

    padding: 0;
    border: none;
    /* A borda será colocada no wrapper */
    box-sizing: border-box;
    cursor: pointer;

    /* CRÍTICO: Move o input 5px para cima e 5px para esquerda. 
       (40px - 30px) / 2 = 5px. Isso centraliza o input 40x40 dentro do wrapper 30x30. */
    transform: translate(-5px, -5px);
}

/* Faz o campo de texto crescer para preencher o espaço restante */
#newCategoryInput {
    flex-grow: 1;
}

/* 1. Estilo do Wrapper (Define o tamanho final) */
.color-picker-wrapper {
    width: 25px;
    height: 25px;
    overflow: hidden;
    /* CRÍTICO: Esconde as bordas do input 40x40 */
    flex-shrink: 0;
    /* Impede o encolhimento do Flexbox */
    align-self: center;
    /* Centraliza verticalmente no Flexbox */
    border-radius: 4px;
    /* Opcional: Para manter as bordas arredondadas */
    border: 1px solid var(--border-color, #ccc);
    /* Borda do wrapper */
}

/* Estilo para a área de texto de edição */
.prompt-edit-textarea {
    width: 100%; 
    min-height: 100px;
    padding: 10px;
    
    /* NOVO: Empurra o textarea para baixo da área ocupada pela data */
    margin-top: 25px; 
    
    box-sizing: border-box;

    width: 100%;
    min-height: 100px; /* Garante visibilidade */
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    font-family: inherit;
    resize: vertical; /* Permite redimensionar verticalmente */

    margin-top: 5px; /* Reduzimos para um valor pequeno, já que o problema não era ele */
    margin-right: 120px; /* NOVO: Deixa espaço para os botões à direita (SAVE e CANCEL) */
}

/* Estilos para os botões de edição (ajuste a cor se necessário) */
.save-edit-btn {
    background-color: #38b2ac; /* Verde Menta Sutil */
    color: white;
    margin-right: 10px;
}

.cancel-edit-btn {
    background-color: #e53e3e; /* Vermelho/Vinho Sutil */
    color: white;
}

/* Novo Contêiner para os botões de Edição */
.edit-actions-wrapper {
    /* CRÍTICO: Posiciona o wrapper de forma absoluta no canto inferior direito */
    position: absolute;
    bottom: 10px; /* Afasta da borda inferior */
    right: 10px; /* Afasta da borda direita */
    display: flex; /* Alinha os botões horizontalmente */
    gap: 10px;
    z-index: 20;
    
    /* CRÍTICO: Garante que o wrapper comece ABAIXO da data. */
    /* Como a data tem ~15px de altura e está no topo, definimos um top mínimo para o wrapper. */
    top: 35px; /* Posiciona o wrapper ABAIXO da data. */
    height: 35px; /* Altura fixa para o wrapper de botões */
}

/* 1. Coluna da Esquerda (Botões) */
.edit-left-column {
    display: flex;
    flex-direction: column; /* Empilha verticalmente */
    gap: 10px; 
    flex-shrink: 0; /* Impede que a coluna encolha */
    
    /* CRÍTICO: Largura mínima para os botões (Ajuste para caber o texto 'CANCEL') */
    width: 80px; 
    padding-top: 5px; /* Pequeno ajuste vertical */
}

/* 2. Coluna da Direita (Textarea e Data) */
.edit-right-column {
    flex-grow: 1; /* CRÍTICO: Ocupa todo o espaço restante */
    display: flex;
    flex-direction: column;
    position: relative; /* Necessário para ancorar a data */
}

/* 3. Textarea (Garante que ocupe o espaço na coluna) */
.prompt-edit-textarea {
    width: 100%; /* Ocupa 100% da COLUNA DIREITA */
    min-height: 100px;
    padding: 10px;
    margin-top: 5px; 
    box-sizing: border-box;
    /* ... outras regras ... */
}

/* 4. Posicionamento da Data */
.prompt-header-info {
    position: absolute; 
    top: 5px; /* Ancorado no topo */
    right: 5px; /* Ancorado na direita da coluna */
    font-size: 0.85em; 
    z-index: 2;
}

/* Corrigindo a largura dos botões no modo de edição */
.edit-left-column button {
    width: 80px; /* Define uma largura fixa para todos os botões na coluna */
    text-align: center;
    padding: 8px 5px; /* Ajusta o padding vertical/horizontal */
}

/* Garante que a coluna tenha espaço para o texto (se 80px for muito pequeno) */
.edit-left-column {
    /* ... regras existentes ... */
    width: 85px; /* Damos 5px extra de margem */
}

/* ====== EFEITO FLASH DE SUCESSO (NOVO) ====== */

/* 1. Define o Keyframe (Brilho e Fade) */
@keyframes success-flash {
   /* 0% é o pico do brilho e da elevação */
    0% { 
        /* Fundo do Flash: Cinza muito claro */
        background-color: #e8e8e8 !important; 
        
        /* Borda: Usamos box-shadow para simular a borda grossa e cinza 60% */
        box-shadow: 0 0 0 4px rgba(100, 100, 100, 0.6), /* Cinza 60% (o outline) */
                    0 4px 10px rgba(0, 0, 0, 0.1); /* Sombra de elevação */
        
        transform: scale(1.01); /* Pequena elevação */
    } 
    
    /* 100% volta ao estado normal do card */
    100% { 
        background-color: #F2F2EE; /* Cor de fundo normal do card */
        transform: scale(1); 
        /* Volta à sombra padrão (sem o outline cinza) */
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); 
    }
}

/* 2. Aplica a animação no card quando a classe é adicionada pelo JS */
.prompt-card.flash-success {
    /* CRÍTICO: Força a prioridade máxima da cor de fundo no início da animação */
    animation: success-flash 0.5s ease-out; 
    /* Adicione a cor de fundo inicial AQUI, com !important, para sobrepor o hover */
    background-color: #e0f5e0 !important;
}

.prompt-card.expanded {
    max-height: 1000px; /* Valor alto para garantir a expansão total (pode ser "none") */
    min-height: 200px; /* Garante que a rolagem funcione se o card for muito longo */
    overflow: auto; /* Permite que o usuário role dentro do card se necessário */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* Sombra mais forte ao expandir */
}

.edit-category-input {
    width: 80%;
    padding: 2px 5px;
    font-size: inherit;
    font-family: inherit;
    border: 1px solid #22A2F2;
    border-radius: 4px;
    outline: none;
}

/* Container da categoria */
.category-item {
    position: relative; /* Necessário para posicionar a dica */
    transition: background-color 0.2s;
}

/* Dica visual que aparece ao passar o rato */
.category-item:hover::after {
    content: "✎ clique duplo para renomear";
    position: absolute;
    right: 40px; /* Ajuste para não sobrepor o botão de apagar */
    font-size: 10px;
    color: #888;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none; /* Garante que a dica não atrapalhe o clique */
    animation: fadeIn 0.3s ease-in-out;
}

/* Pequena animação de surgimento */
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(5px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Feedback visual opcional: muda levemente a cor do fundo */
.category-item:hover {
    background-color: #f0f7ff;
}

.category-name {
    cursor: text; /* Indica que o texto pode ser manipulado */
}