:root {
    --gris: #95a5a6;
    --naranja: #d35400;
    --naranja-vibrante: #ff6600; /* Naranja puro para urgencia alta */
    --verde: #27ae60;
    --fondo: #f0f2f5;
    --nota-amarilla: #ffffa5;
    --azul-drag: #3498db;
    --rojo-urgente: #e74c3c;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--fondo);
    padding: 20px;
    margin: 0;
}

.header { 
    text-align: center; 
    margin-bottom: 40px; 
}

.header-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* --- Buscador Principal --- */
#searchInput {
    padding: 15px 20px;
    border-radius: 20px;
    border: 1px solid #ccc;
    width: 250px;
    outline: none;
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#searchInput:focus {
    width: 300px;
    border-color: var(--azul-drag);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.2);
}

/* --- Botones --- */
.btn-add {
    background-color: #2c3e50;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: 0.2s;
}

.btn-add:hover { 
    transform: translateY(-2px); 
    background: white; 
    color: #34495e;
}

/* --- Tablero --- */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.column {
    background: #e2e4e6;
    border-radius: 10px;
    padding: 15px;
    min-height: 600px;
    transition: background-color 0.2s ease;
}

.column.drag-over {
    background-color: #d0d3d6;
    outline: 2px dashed var(--azul-drag);
}

.column h2 { 
    text-align: center; 
    border-bottom: 4px solid #bdc3c7; 
    padding-bottom: 10px; 
}

.todo h2 { border-color: var(--gris); color: #555; }
.doing h2 { border-color: var(--naranja); color: var(--naranja); }
.done h2 { border-color: var(--verde); color: var(--verde); }

/* --- Nota --- */
.note {
    background: var(--nota-amarilla);
    padding: 25px 15px 15px;
    margin-bottom: 15px;
    border-radius: 2px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
    position: relative;
    border-bottom-right-radius: 15px;
    cursor: grab;
    transition: transform 0.1s, opacity 0.1s;
    overflow: hidden; 
}

.note:active { cursor: grabbing; }
.note.dragging { opacity: 0.4; transform: scale(0.95); }
.note.hidden { display: none; }

/* --- Esquinita de Urgencia (IZQUIERDA SUPERIOR) --- */
.note::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0; 
    border-width: 25px 25px 0 0; 
    border-style: solid;
    z-index: 1;
}

.note.urgencia-baja::before { border-color: var(--verde) transparent transparent transparent; }
.note.urgencia-media::before { border-color: #fca311 transparent transparent transparent; }
.note.urgencia-alta::before { border-color: var(--naranja-vibrante) transparent transparent transparent; }

.note-content { cursor: pointer; min-height: 40px; }

.note-title {
    font-weight: bold;
    font-size: 1.1rem;
    display: block;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 8px;
    padding-bottom: 4px;
    padding-left: 15px; 
    color: #2c3e50;
}

.note-body {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0 0 10px;
    line-height: 1.4;
    color: #333;
}

/* --- Botón Borrar Tarjeta --- */
.delete-btn {
    position: absolute;
    top: 5px; 
    right: 5px; 
    background: #e74c3c;
    color: white;
    width: 24px; 
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10; 
    transition: background 0.2s;
}

.delete-btn:hover { background: #c0392b; }

.note select {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid rgba(0,0,0,0.1);
    background: rgba(255,255,255,0.6);
    cursor: pointer;
    font-family: inherit;
    outline: none;
}

/* --- Modal Base --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 25px;
    border-radius: 15px;
    width: 90%; 
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    box-sizing: border-box;
}

/* --- Fechas y Controles del Modal --- */
.note-dates {
    font-size: 0.75rem;
    color: #555;
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.note-dates div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

input[type="date"] {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.toolbar {
    background: #f8f9fa;
    padding: 8px;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    display: flex;
    gap: 5px;
}

#taskBody {
    width: 100%; 
    min-height: 150px;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    padding: 15px;
    background: white;
    outline: none;
    box-sizing: border-box;
}

/* --- HISTORIAL (Scroll y Buscador) --- */
#historyList {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--gris) transparent;
}

/* Scrollbar Chrome/Safari */
#historyList::-webkit-scrollbar {
    width: 6px;
}
#historyList::-webkit-scrollbar-track {
    background: transparent;
}
#historyList::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}

#historyList .note {
    width: 100%;
    box-sizing: border-box;
    cursor: default;
    transform: none !important;
    border-left: 5px solid #ccc;
    background-color: #fcfcfc;
}

/* Botones dentro del Historial */
#historyList .btn-save, 
#historyList .btn-cancel {
    padding: 8px 15px;
    font-size: 0.75rem;
}

/* --- ESTILO MODERNO PARA BOTONES DEL MODAL --- */

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
}

.btn-save {
    background-color: #27ae60; /* Verde éxito */
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-save:hover {
    background-color: #2ecc71;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(46, 204, 113, 0.3);
}

.btn-cancel {
    background-color: #ecf0f1; /* Gris claro */
    color: #7f8c8d;
    border: 1px solid #dcdde1;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background-color: #bdc3c7;
    color: white;
    border-color: #bdc3c7;
}

/* Efecto al hacer clic */
.btn-save:active, .btn-cancel:active {
    transform: translateY(0);
}

/*----------------------------------------------*/

/* --- EFECTO DE RESPLANDOR DINÁMICO (HOVER) --- */

.note {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(0,0,0,0.05);
}

/* Elevación y sombra general al pasar el mouse */
.note:hover {
    transform: translateY(-5px) scale(1.02);
    z-index: 5;
    box-shadow: 0 14px 28px rgba(0,0,0,0.15), 0 10px 10px rgba(0,0,0,0.12);
}

/* Resplandor personalizado según el color de urgencia */

.note.urgencia-baja:hover {
    box-shadow: 0 10px 20px rgba(39, 174, 96, 0.3); /* Resplandor verde */
    border-color: var(--verde);
}

.note.urgencia-media:hover {
    box-shadow: 0 10px 20px rgba(252, 163, 17, 0.3); /* Resplandor naranja suave */
    border-color: #fca311;
}

.note.urgencia-alta:hover {
    box-shadow: 0 10px 20px rgba(255, 102, 0, 0.4); /* Resplandor naranja vibrante */
    border-color: var(--naranja-vibrante);
}

/* Efecto de "cristal" en el contenido al pasar el mouse */
.note:hover .note-title {
    color: #000;
    border-bottom-color: rgba(0,0,0,0.2);
}