@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- Core Animations --- */

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(0.98); }
}

@keyframes gradient-xy {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes slide-up-fade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in-bounce {
    0% { opacity: 0; transform: scale(0.9); }
    70% { transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes drop-in-physics {
    0% {
        opacity: 0.9;
        transform: translateY(-4px);
    }
    50% {
        opacity: 1;
        transform: translateY(1px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Utility Classes --- */

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animate-slide-up {
    animation: slide-up-fade 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.animate-scale-in {
    animation: scale-in-bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

.animate-drop-in {
    animation: drop-in-physics 0.4s ease-out forwards;
}

/* --- Theme: Business Lavender --- */

.bg-lavender-dream {
    background-color: #eef2ff;
    position: relative;
    overflow: hidden;
    z-index: 0;
}

.bg-lavender-dream::before {
    content: '';
    position: fixed;
    inset: -20%;
    background: radial-gradient(circle at 20% 20%, rgba(165, 180, 252, 0.6) 0%, transparent 45%),
                radial-gradient(circle at 80% 0%, rgba(129, 140, 248, 0.5) 0%, transparent 35%),
                radial-gradient(circle at 60% 80%, rgba(196, 181, 253, 0.55) 0%, transparent 45%),
                radial-gradient(circle at 0% 100%, rgba(147, 197, 253, 0.45) 0%, transparent 40%);
    filter: blur(30px);
    animation: aurora-shift 28s ease-in-out infinite alternate;
    z-index: -2;
    pointer-events: none;
}

.bg-lavender-dream::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.05) 0%, transparent 55%, rgba(255, 255, 255, 0.05) 100%),
                      linear-gradient(60deg, rgba(90, 103, 216, 0.08) 0%, transparent 60%);
    opacity: 0.7;
    mix-blend-mode: screen;
    animation: grid-flow 18s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes gradient-mesh {
    0%, 100% { 
        background-position: 0% 0%, 20% 30%, 50% 50%, 80% 70%, 100% 100%;
    }
    25% { 
        background-position: 20% 20%, 40% 40%, 60% 60%, 80% 80%, 0% 0%;
    }
    50% { 
        background-position: 40% 40%, 60% 60%, 80% 80%, 0% 0%, 20% 20%;
    }
    75% { 
        background-position: 60% 60%, 80% 80%, 0% 0%, 20% 20%, 40% 40%;
    }
}

@keyframes float-orbs {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.8;
    }
    33% { 
        transform: translate(40px, -50px) rotate(120deg);
        opacity: 0.95;
    }
    66% { 
        transform: translate(-30px, 30px) rotate(240deg);
        opacity: 0.85;
    }
}

/* Additional floating elements for sophistication */
.bg-lavender-dream .floating-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
    animation: float-orb 20s ease-in-out infinite;
}

.bg-lavender-dream .floating-orb:nth-child(1) {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.35) 0%, transparent 70%);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.bg-lavender-dream .floating-orb:nth-child(2) {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.3) 0%, transparent 65%);
    top: 60%;
    right: 15%;
    animation-delay: 7s;
}

.bg-lavender-dream .floating-orb:nth-child(3) {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.28) 0%, transparent 60%);
    bottom: 20%;
    left: 50%;
    animation-delay: 14s;
}

@keyframes float-orb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(50px, -50px) scale(1.1);
        opacity: 0.8;
    }
}

@keyframes aurora-shift {
    0% { transform: translate3d(-5%, -5%, 0) scale(1); }
    50% { transform: translate3d(4%, 6%, 0) scale(1.05); }
    100% { transform: translate3d(-6%, 3%, 0) scale(1.03); }
}

@keyframes grid-flow {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 200px 400px, 400px 200px; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* Toast Styles */
.toast {
    background: white;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    max-width: 100%;
}

.toast.toast-success {
    border-left: 4px solid #10b981;
}

.toast.toast-error {
    border-left: 4px solid #ef4444;
}

.toast.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: #64748b;
}

.toast-close {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.toast-close:hover {
    background: #f1f5f9;
    color: #64748b;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-exit {
    animation: toast-slide-out 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Animated Background Icons */
.animated-icon {
    position: absolute;
    opacity: 0.15;
    pointer-events: none;
    animation: icon-float 20s ease-in-out infinite;
    filter: blur(0.5px);
}

.animated-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    color: #6366f1;
    opacity: 1;
}

@keyframes icon-float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.15;
    }
    25% {
        transform: translate(50px, -60px) rotate(90deg) scale(1.15);
        opacity: 0.2;
    }
    50% {
        transform: translate(-40px, 50px) rotate(180deg) scale(0.85);
        opacity: 0.12;
    }
    75% {
        transform: translate(60px, 30px) rotate(270deg) scale(1.1);
        opacity: 0.18;
    }
}

/* Glassmorphism Elements */

.glass-nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(120%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8); /* Slate-200 */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.glass-column {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, 0.6); /* Slate-200 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* When a custom color is set via data attribute, allow inline styles to override */
.glass-column[data-group-color]:not([data-group-color=""]) {
    backdrop-filter: blur(8px);
    /* Don't set background here - let inline style handle it */
}

/* Add Item Button Wrapper */
.add-item-wrapper {
    position: relative;
    overflow: visible;
    border-radius: 1.2rem;
    transition: height 0.32s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s ease, background 0.3s ease;
    height: 60px;
    padding: 0;
    margin-bottom: 0.35rem;
    z-index: 1;
}

.add-item-wrapper.expanded {
    height: 300px;
    padding: 0.2rem 0 0.35rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.35));
    z-index: 10;
    margin-bottom: 0.5rem;
}

.add-item-button {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.add-item-form {
    position: relative;
    width: 100%;
    min-height: 100%;
    border-radius: inherit;
}

.add-item-button {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.add-item-button.expanded {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
    pointer-events: none;
}

.add-item-form {
    position: relative;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    padding: 0.15rem;
    width: 100%;
    min-height: 100%;
}

.add-item-form.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.add-item-form-content {
    border-radius: 1.1rem;
    overflow: hidden;
}

/* Add Group Wrapper - Same as Add Item */
.add-group-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 2.5rem;
    transition: height 0.32s cubic-bezier(0.4, 0, 0.2, 1), padding 0.25s ease, background 0.3s ease;
    height: 230px;
    padding: 0;
}

.add-group-wrapper.expanded {
    height: auto;
    padding: 0.2rem 0 0.35rem;
    overflow: visible;
}

.add-group-button,
.add-group-form {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.add-group-button {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.add-group-button.expanded {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
    pointer-events: none;
}

.add-group-form {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    padding: 0.15rem;
}

.add-group-form.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.add-group-form-content {
    border-radius: 2.2rem;
    overflow: hidden;
}

.card-modern {
    background: #ffffff;
    border: 1px solid #e2e8f0; /* Slate-200 */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.drop-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    border: 2px dashed #cbd5e1;
    color: #94a3b8;
    background: rgba(248, 250, 252, 0.8);
    min-height: 70px;
    transition: background-color 0.2s ease-out, border-color 0.2s ease-out;
}

.drop-placeholder span {
    font-weight: 700;
    font-size: 0.75rem;
}


.card-modern:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border-color: #cbd5e1; /* Slate-300 */
}

/* --- Staggered Animations --- */
.stagger-container > *:nth-child(1) { animation-delay: 50ms; }
.stagger-container > *:nth-child(2) { animation-delay: 100ms; }
.stagger-container > *:nth-child(3) { animation-delay: 150ms; }
.stagger-container > *:nth-child(4) { animation-delay: 200ms; }
.stagger-container > *:nth-child(5) { animation-delay: 250ms; }
.stagger-container > *:nth-child(n+6) { animation-delay: 300ms; }

/* --- Form Elements --- */
input, textarea, select {
    transition: all 0.2s ease;
}
input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); /* Indigo ring */
    border-color: #6366f1; /* Indigo-500 */
}

/* --- Drag & Drop --- */
.is-dragging {
    opacity: 0.8;
    transform: scale(0.99) rotate(1deg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #818cf8; /* Indigo-400 */
}

/* Drop gap indicator - simple item-sized gap */
.drop-gap-indicator {
    height: 70px;
    min-height: 70px;
    width: 100%;
    background: rgba(99, 102, 241, 0.15);
    border: 2px dashed #6366f1;
    border-radius: 0.75rem;
    margin: 8px 0;
    pointer-events: none;
    flex-shrink: 0;
    box-sizing: border-box;
    display: block;
}

.drop-active {
    background-color: rgba(241, 245, 249, 0.8) !important;
    border-color: #818cf8 !important;
    box-shadow: inset 0 0 0 2px #818cf8, 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: scale(1.002);
    transition: background-color 0.2s ease-out,
                border-color 0.2s ease-out,
                box-shadow 0.2s ease-out,
                transform 0.2s ease-out;
}

[data-wishlist-id].drop-active {
    transition: background-color 0.2s ease-out,
                border-color 0.2s ease-out,
                box-shadow 0.2s ease-out,
                transform 0.2s ease-out;
}

[data-wishlist-id].drop-active .stagger-container {
    transition: padding-bottom 0.2s ease-out;
}

#new-group-btn.drop-active {
    background-color: rgba(99, 102, 241, 0.08) !important;
    border-color: #818cf8 !important;
    box-shadow: inset 0 0 0 2px #818cf8, 0 8px 16px rgba(99, 102, 241, 0.18);
    transform: translateY(-2px);
}

.stagger-container {
    transition: padding-bottom 0.2s ease-out;
    overflow: visible;
}

[data-wishlist-id].drop-hover .stagger-container {
    padding-bottom: 80px;
}

[data-wishlist-id] {
    transition: background-color 0.2s ease-out,
                border-color 0.2s ease-out,
                box-shadow 0.2s ease-out,
                transform 0.2s ease-out;
}

#new-group-btn {
    transition: background-color 0.2s ease-out,
                border-color 0.2s ease-out,
                box-shadow 0.2s ease-out,
                transform 0.2s ease-out;
    width: 320px;
    max-width: 320px;
    flex-shrink: 0;
}

#new-group-btn.drop-hover {
    transform: translateY(-4px);
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(241, 245, 249, 0.5); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; } /* Slate-300 */
::-webkit-scrollbar-thumb:hover { background: #94a3b8; } /* Slate-400 */

/* Horizontal scrollbar for kanban board */
#kanban-board::-webkit-scrollbar { height: 12px; }
#kanban-board::-webkit-scrollbar-track { 
    background: rgba(241, 245, 249, 0.8); 
    border-radius: 10px;
    margin: 0 16px;
}
#kanban-board::-webkit-scrollbar-thumb { 
    background: linear-gradient(90deg, #818cf8, #6366f1);
    border-radius: 10px;
    border: 2px solid rgba(241, 245, 249, 0.8);
}
#kanban-board::-webkit-scrollbar-thumb:hover { 
    background: linear-gradient(90deg, #6366f1, #4f46e5);
}

/* Hide scrollbars but maintain scroll functionality */
.scrollbar-hidden {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.scrollbar-hidden::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Floating Scroll Buttons Animation */
@keyframes flash-pulse {
    0%, 100% { 
        opacity: 1;
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.8), 0 10px 25px -5px rgba(99, 102, 241, 0.3);
    }
    50% { 
        opacity: 0.9;
        transform: translateY(-50%) scale(1.05);
        box-shadow: 0 0 0 12px rgba(99, 102, 241, 0), 0 15px 35px -5px rgba(99, 102, 241, 0.4);
    }
}

#scroll-left-btn:not(.opacity-0),
#scroll-right-btn:not(.opacity-0) {
    animation: flash-pulse 1.5s ease-in-out infinite;
}

#scroll-left-btn:hover,
#scroll-right-btn:hover {
    animation: none;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3), 0 20px 40px -5px rgba(99, 102, 241, 0.4) !important;
}

/* --- Uncategorized Group Styling --- */
#ungrouped-column {
    background: rgba(237, 233, 254, 0.75) !important; /* Soft purple/indigo background */
    border-color: rgba(124, 58, 237, 0.3) !important; /* Purple border */
    border-style: solid;
    border-width: 2px;
}

#ungrouped-column:hover {
    background: rgba(237, 233, 254, 0.85) !important;
    border-color: rgba(124, 58, 237, 0.4) !important;
}

#ungrouped-column h3 {
    color: #5b21b6 !important; /* Deep purple text */
}

#ungrouped-column .text-slate-400 {
    color: #7c3aed !important; /* Purple tint for badges */
}

#ungrouped-column .text-slate-600 {
    color: #6d28d9 !important; /* Darker purple for default badge */
}

#ungrouped-column .bg-slate-100 {
    background-color: rgba(237, 233, 254, 0.6) !important; /* Purple tint for badge backgrounds */
}

#ungrouped-column .border-slate-200 {
    border-color: rgba(124, 58, 237, 0.25) !important; /* Purple border for badges */
}

#ungrouped-column #empty-ungrouped {
    background: rgba(237, 233, 254, 0.5) !important;
    border-color: rgba(124, 58, 237, 0.3) !important;
    color: #7c3aed !important;
}

/* --- RTL --- */
[dir="rtl"] { text-align: right; }

/* --- Mobile Optimizations --- */
@media (max-width: 640px) {
    /* Touch-friendly adjustments - MOBILE ONLY */
    button, a, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Prevent text size adjustment on iOS - MOBILE ONLY */
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Better touch scrolling - MOBILE ONLY */
    * {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Touch action for better responsiveness */
    button, a {
        touch-action: manipulation;
    }
    
    /* Mobile full-screen modals */
    #mobile-add-item-modal,
    #mobile-edit-item-modal {
        background: white !important;
    }
    
    #mobile-add-item-form-container,
    #mobile-edit-item-form-container {
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        overscroll-behavior: contain;
    }
    
    /* Prevent body scroll when mobile modal is open */
    body:has(#mobile-add-item-modal:not(.hidden)),
    body:has(#mobile-edit-item-modal:not(.hidden)) {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
}

