/* Task Planner Dashboard - Custom Styles */
/* Note: Main styling uses Tailwind CSS via CDN */

[x-cloak] { display: none !important; }

.task-card {
    transition: all 0.2s ease;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* View transitions */
.view-enter {
    opacity: 0;
    transform: translateY(10px);
}

.view-enter-active {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.view-enter-to {
    opacity: 1;
    transform: translateY(0);
}

.view-leave {
    opacity: 1;
}

.view-leave-active {
    transition: opacity 0.15s ease-in;
    position: absolute;
    width: 100%;
}

.view-leave-to {
    opacity: 0;
}

/* Card hover lift effect */
.card-interactive {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-interactive:hover {
    transform: translateY(-2px);
}

.card-interactive:active {
    transform: translateY(0);
}

/* Animación para tareas recién asignadas */
@keyframes fadeOutSlide {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    80% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(20px);
    }
}

.animate-fade-out {
    animation: fadeOutSlide 10s ease-out forwards;
}

/* Barra de progreso visual */
.recently-assigned-item {
    position: relative;
    overflow: hidden;
}

.recently-assigned-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(to right, #10b981, #34d399);
    animation: shrinkBar 10s linear forwards;
}

@keyframes shrinkBar {
    from { width: 100%; }
    to { width: 0%; }
}

/* Rich Text Editor Styles (contenteditable) */
#notes-editor,
#new-notes-editor {
    outline: none;
    line-height: 1.6;
}

#notes-editor p,
#new-notes-editor p {
    margin: 0.5em 0;
}

#notes-editor p:first-child,
#new-notes-editor p:first-child {
    margin-top: 0;
}

#notes-editor h3,
#new-notes-editor h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1em 0 0.5em;
    color: #374151;
}

#notes-editor ul,
#notes-editor ol,
#new-notes-editor ul,
#new-notes-editor ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
    list-style-position: outside;
    margin-left: 1em;
}

#notes-editor ul,
#new-notes-editor ul {
    list-style-type: disc;
}

#notes-editor ol,
#new-notes-editor ol {
    list-style-type: decimal;
}

#notes-editor li,
#new-notes-editor li {
    margin: 0.25em 0;
}

#notes-editor strong,
#notes-editor b,
#new-notes-editor strong,
#new-notes-editor b {
    font-weight: 600;
}

#notes-editor em,
#notes-editor i,
#new-notes-editor em,
#new-notes-editor i {
    font-style: italic;
}

#notes-editor s,
#notes-editor strike,
#new-notes-editor s,
#new-notes-editor strike {
    text-decoration: line-through;
}

/* Focus state for editor */
#notes-editor:focus-within,
#new-notes-editor:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* === DRAG & DROP (SortableJS) === */

/* Ghost element while dragging */
.sortable-ghost {
    opacity: 0.4;
    background: #e0e7ff !important;
    border-radius: 0.5rem;
}

/* Chosen element being dragged */
.sortable-chosen {
    background: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
}

/* Drag state */
.sortable-drag {
    opacity: 1 !important;
    transform: rotate(2deg);
}

/* Drop zone highlight */
[data-forecast-day].sortable-chosen,
[data-calendar-day].sortable-chosen {
    background: #dbeafe;
}

/* Calendar day drop zone active state */
.calendar-day-drop.drag-over {
    background-color: #dbeafe !important;
    border-color: #3b82f6 !important;
    box-shadow: inset 0 0 0 2px #3b82f6;
}

/* Mini task card being dragged */
[data-task-id][draggable="true"]:active {
    opacity: 0.7;
    transform: scale(1.02);
}

/* Drag handle styles */
.drag-handle {
    touch-action: none;
    user-select: none;
}

.drag-handle:hover {
    cursor: grab;
}

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

/* === CELEBRATION EFFECTS === */

/* Green glow pulse when completing a task */
@keyframes completeGlow {
    0%  { box-shadow: inset 0 0 0 0 rgba(16, 185, 129, 0); }
    40% { box-shadow: inset 0 0 0 200px rgba(16, 185, 129, 0.08); }
    100%{ box-shadow: inset 0 0 0 200px rgba(16, 185, 129, 0); }
}

.task-completing {
    animation: completeGlow 0.6s ease-out;
    border-radius: 0.5rem;
}

/* Purple shimmer sweep for reviewed tasks */
@keyframes shimmerSweep {
    0%   { left: -60%; }
    100% { left: 200%; }
}

.task-shimmer {
    position: relative;
    overflow: hidden;
}

.task-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.25), rgba(167, 139, 250, 0.15), transparent);
    animation: shimmerSweep 0.5s ease-in-out forwards;
    pointer-events: none;
    z-index: 10;
}

/* === STYLED SELECTS === */

/* Ensure all form elements have visible borders */
select,
input[type="date"],
input[type="number"],
input[type="text"],
textarea {
    border-width: 1px;
    border-style: solid;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1.1em;
    padding-right: 2.2rem !important;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.15s ease;
}

select:hover {
    border-color: #93c5fd;
    background-color: #f9fafb;
}

select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    background-color: #fff;
    outline: none;
}

select option {
    padding: 8px 12px;
}

select option[disabled] {
    color: #d1d5db;
    font-size: 0.7em;
}

select option[value="__new__"] {
    color: #4f46e5;
    font-weight: 600;
}

/* Styled inputs to match */
input[type="date"],
input[type="number"],
input[type="text"],
textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.15s ease;
}

input[type="date"]:hover,
input[type="number"]:hover,
input[type="text"]:hover,
textarea:hover {
    border-color: #93c5fd;
}

input[type="date"]:focus,
input[type="number"]:focus,
input[type="text"]:focus,
textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    outline: none;
}
