/* Custom styles beyond Tailwind */

/* Animations */
@keyframes slow-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-slow-spin {
    animation: slow-spin 60s linear infinite;
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    overflow-y: auto;
    padding: 10px 0;
}

.modal:target {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    width: 95%;
    max-width: 600px;
    position: relative;
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 5;
}

.modal-body {
    padding: 16px;
}

.close {
    font-size: 28px;
    font-weight: bold;
    color: #666;
    text-decoration: none;
    padding: 5px 10px;
    margin: -5px -10px;
    border-radius: 4px;
}

.close:hover {
    color: black;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Mobile specific modal adjustments */
@media (max-width: 640px) {
    .modal-content {
        width: 100%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 10px 16px;
    }
    
    .modal-body {
        padding: 12px;
    }
    
    /* Stack buttons in modals on mobile */
    .modal-body .flex.justify-end {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .modal-body .flex.justify-end button {
        width: 100%;
        margin: 0 0 8px 0;
    }
}

/* Kanban board scrollbar styling */
.kanban-board::-webkit-scrollbar {
    height: 8px;
}

.kanban-board::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.kanban-board::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.kanban-board::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Make kanban columns full height on desktop */
@media (min-width: 768px) {
    .kanban-board {
        min-height: calc(100vh - 280px);
    }
    
    .kanban-column {
        height: calc(100vh - 280px);
    }
    
    .kanban-column > div:last-child {
        height: calc(100% - 66px);
        overflow-y: auto;
    }
}

/* Mobile responsiveness improvements */
@media (max-width: 767px) {
    /* Ensure task list items have proper spacing on mobile */
    .task-toggle {
        margin-top: 4px;
    }
    
    /* Improve modal display on mobile */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Ensure form fields don't overflow on mobile */
    input, textarea, select {
        max-width: 100%;
        word-wrap: break-word;
    }
    
    /* Improve player card display on mobile */
    .player-card .mb-2 {
        word-break: break-word;
    }

    /* Fix form field visibility on mobile */
    .fixed.inset-0 {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        padding: 1rem;
        overflow-y: auto;
    }

    /* Ensure modals are scrollable on mobile */
    [id*="Modal"] {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Make sure scrollable areas don't cause horizontal overflow */
    .overflow-y-auto, .overflow-x-auto {
        max-width: 100vw;
    }

    /* Prevent long text from breaking layout */
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Ensure all containers have proper padding */
    .container, .px-4, .px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Improve form layout on mobile */
    form .grid {
        display: flex;
        flex-direction: column;
    }

    form .grid > div {
        margin-bottom: 1rem;
    }

    /* Ensure buttons are properly sized */
    button, .button, a.button, input[type="submit"] {
        min-height: 44px; /* Touch target size */
    }
    
    /* Mobile-friendly move buttons */
    @media (max-width: 767px) {
        .move-btn {
            padding: 0.5rem 0.75rem !important;
            font-size: 0.875rem !important;
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            min-height: 40px !important;
            min-width: 80px !important;
        }
        
        .move-btn svg {
            width: 1rem !important;
            height: 1rem !important;
            margin-right: 0.5rem !important;
        }
        
        .move-menu {
            width: 200px !important;
        }
        
        .move-menu a {
            padding: 0.75rem 1rem !important;
            font-size: 1rem !important;
        }
    }

    /* Mobile-specific padding for better breathing room */
    .py-6 {
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }
    
    /* Form labels for better mobile readability */
    form label {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
        display: block;
    }
    
    /* Improve spacing between form fields */
    form .mb-4 {
        margin-bottom: 1.25rem !important;
    }
    
    /* Prevent tables from breaking layout */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better spacing for clickable items in lists */
    .player-card, .task-card, .note-item {
        padding: 1rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Fix bottom navigation spacing */
    .bottom-nav-padding {
        padding-bottom: 80px !important;
    }
    
    /* Improved note actions on mobile */
    .note-actions {
        display: flex;
        gap: 0.5rem;
    }
    
    .note-actions a, .note-actions button {
        padding: 0.5rem !important;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Sortable ghost class (when dragging) */
.sortable-ghost {
    opacity: 0.5;
    background-color: #f0f9ff !important;
    border: 2px dashed #3b82f6 !important;
}

/* Sortable chosen class (the item being dragged) */
.sortable-chosen {
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    transform: rotate(1deg);
    z-index: 10;
}

/* Shadow effect when dragging */
.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Responsive typography */
.break-words {
    word-wrap: break-word;
    word-break: break-word;
}

/* Truncate long text with ellipsis */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal responsiveness */
@media (min-width: 768px) {
    .modal-content {
        max-width: 800px;
    }
}

@media (min-width: 1024px) {
    .modal-content.max-w-4xl {
        max-width: 960px;
    }
}

/* Fix table layout on modals */
.modal table {
    table-layout: fixed;
}

/* Ensure proper wrap for long content in tables */
td {
    word-wrap: break-word;
    word-break: break-word;
}
