/* Custom Animations for BBF Team Planer */

/* Smooth page transitions */
* {
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card flip animation on add */
@keyframes flipIn {
    0% {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotateX(-10deg);
    }
    70% {
        transform: perspective(400px) rotateX(10deg);
    }
    100% {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
}

.card-flip-in {
    animation: flipIn 0.6s ease-out;
}

/* Card flip animation on delete */
@keyframes flipOut {
    0% {
        transform: perspective(400px) rotateX(0deg);
        opacity: 1;
    }
    100% {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0;
    }
}

.card-flip-out {
    animation: flipOut 0.4s ease-in forwards;
}

/* Slide in from top */
@keyframes slideInTop {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-in-top {
    animation: slideInTop 0.4s ease-out;
}

/* Bounce animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.bounce-animation {
    animation: bounce 0.6s ease-in-out;
}

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

.shake-animation {
    animation: shake 0.5s;
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

/* Glow effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(168, 85, 247, 0.4);
    }
    50% {
        box-shadow: 0 0 20px rgba(168, 85, 247, 0.8), 0 0 30px rgba(168, 85, 247, 0.6);
    }
}

.glow-animation {
    animation: glow 2s ease-in-out infinite;
}

/* Drag and Drop styles */
.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
    cursor: grabbing !important;
}

.drag-over {
    background-color: rgba(168, 85, 247, 0.1) !important;
    border: 2px dashed #a855f7 !important;
    transform: scale(1.02);
}

.draggable-card {
    cursor: grab;
    user-select: none;
}

.draggable-card:active {
    cursor: grabbing;
}

/* Smooth transitions for all interactive elements */
button, input, select, textarea {
    transition: all 0.2s ease-in-out;
}

button:active {
    transform: scale(0.95);
}

/* Hover effects */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(168, 85, 247, 0.3);
}

/* Loading spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(168, 85, 247, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.5);
}

/* Responsive adjustments */

/* Mobile First - Phones (up to 640px) */
@media (max-width: 640px) {
    /* Better touch targets */
    button, select, input, textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Larger drag handles for touch */
    .draggable-card {
        touch-action: none;
    }
    
    /* Single column layout */
    .board-columns {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    /* Full width columns on mobile */
    .column-container {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Larger tap targets */
    .group-hover\:opacity-100 {
        opacity: 1 !important; /* Always show buttons on mobile */
    }
    
    /* Simplified animations on mobile */
    .card-flip-in,
    .card-flip-out {
        animation-duration: 0.3s;
    }
    
    /* Better spacing for touch */
    .space-y-3 > * + * {
        margin-top: 1rem !important;
    }
    
    /* Sticky header on mobile */
    .mobile-sticky-header {
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    /* Hide baby emoji on small screens */
    .hide-on-mobile {
        display: none !important;
    }
    
    /* Adjust padding */
    body {
        padding: 0.75rem !important;
    }
    
    /* Better modal on mobile */
    .modal-mobile {
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Tablet - Small tablets (641px to 768px) */
@media (min-width: 641px) and (max-width: 768px) {
    /* Two columns on small tablets */
    .board-columns {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    .column-container {
        width: 100% !important;
    }
    
    /* Adjust touch targets */
    button, select, input {
        min-height: 40px;
    }
}

/* Tablet - Large tablets (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Three columns on tablets */
    .board-columns {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
    
    .column-container {
        width: 100% !important;
    }
}

/* Desktop - Small desktop (1025px to 1280px) */
@media (min-width: 1025px) and (max-width: 1280px) {
    .column-container {
        width: 300px !important;
    }
}

/* Desktop - Large desktop (1281px+) */
@media (min-width: 1281px) {
    .column-container {
        width: 320px !important;
    }
    
    /* Enable smooth scrolling for horizontal boards */
    .board-columns {
        scroll-behavior: smooth;
    }
}

/* Landscape mode on phones */
@media (max-width: 896px) and (orientation: landscape) {
    /* Horizontal scrolling in landscape */
    .board-columns {
        flex-direction: row !important;
        overflow-x: auto !important;
    }
    
    .column-container {
        width: 320px !important;
        flex-shrink: 0 !important;
    }
    
    /* Reduce header size in landscape */
    h1 {
        font-size: 1.5rem !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Better touch feedback */
    button:active,
    .draggable-card:active {
        transform: scale(0.98);
    }
    
    /* Always visible controls on touch devices */
    .opacity-0 {
        opacity: 1 !important;
    }
    
    /* Larger hit areas */
    button {
        padding: 0.75rem !important;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    /* Single column for printing */
    .board-columns {
        display: block !important;
    }
    
    .column-container {
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    /* Remove interactive elements */
    button, textarea, select, input[type="date"] {
        display: none !important;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
}
