:root {
    --primary-color: #0061ff;
    --primary-gradient: linear-gradient(135deg, #0061ff 0%, #60efff 100%);
    --bg-light: #f8f9fa;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--bg-light);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #2d3436;
}

.navbar {
    background: white !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-bottom: none;
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 97, 255, 0.3);
}

/* Kanban Board Styles */
.kanban-container {
    display: flex;
    flex-wrap: wrap;
    /* Allow columns to wrap to next row */
    gap: 1.5rem;
    padding: 10px 0;
    align-items: flex-start;
    min-height: calc(100vh - 120px);
}

.kanban-column {
    background-color: #ebedf0;
    border-radius: 12px;
    flex: 1 1 300px;
    /* Grow, shrink, and base-width */
    max-width: 450px;
    /* Prevent columns from getting too wide on large screens */
    display: flex;
    flex-direction: column;
    min-height: 200px;
    padding: 10px;
}

.column-header {
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    /* Allow flex children to shrink below content size */
}

.column-title {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    /* Limit the title width */
    flex-shrink: 1;
    cursor: default;
}

.column-title-input {
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    padding: 2px 8px;
    max-width: 150px;
    flex-shrink: 1;
    background: white;
}

.task-list {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 100px;
    padding: 5px;
}

.task-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    cursor: grab;
    transition: var(--transition-smooth);
    border-left: 5px solid transparent;
}

.task-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow);
}

.task-card.priority-high {
    border-left-color: #ff7675;
}

.task-card.priority-medium {
    border-left-color: #fdcb6e;
}

.task-card.priority-low {
    border-left-color: #55efc4;
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
}

.priority-badge.priority-high {
    background-color: #ff7675;
}

.priority-badge.priority-medium {
    background-color: #fdcb6e;
}

.priority-badge.priority-low {
    background-color: #55efc4;
}

.bg-light-board {
    background-color: rgba(0, 97, 255, 0.1) !important;
    border: 2px dashed #0061ff !important;
}

.bg-light-column {
    background-color: rgba(0, 0, 0, 0.05) !important;
    border: 2px dashed #ccc !important;
}

.task-title {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.task-meta {
    font-size: 0.85rem;
    color: #636e72;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .kanban-container {
        flex-direction: column;
        overflow-y: visible;
        height: auto;
    }

    .kanban-column {
        width: 100%;
        margin-bottom: 20px;
    }
}

/* Board Card Redesign (Matching Image) */
.board-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.board-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.board-card-header {
    padding: 15px 15px 5px 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.board-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
    margin-right: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.board-badge {
    background-color: #007bff;
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.board-card-body {
    padding: 0 15px 10px 15px;
    flex-grow: 1;
}

.board-description {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.board-date {
    font-size: 0.8rem;
    color: #adb5bd;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.board-card-footer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid #f1f3f5;
}

.board-footer-btn {
    border: none;
    background: transparent;
    padding: 10px 5px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #495057;
    transition: background 0.2s;
    border-right: 1px solid #f1f3f5;
}

.board-footer-btn:last-child {
    border-right: none;
}

.board-footer-btn:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.board-footer-btn.btn-delete:hover {
    color: #dc3545;
}

.board-footer-btn i {
    font-size: 0.9rem;
}

/* Specific button colors to match image */
.btn-open {
    color: #007bff;
    border-left: 0;
}

.btn-edit {
    color: #17a2b8;
}

.btn-share {
    color: #28a745;
}

.btn-delete {
    color: #dc3545;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .board-card-title {
        font-size: 1rem;
    }

    .board-footer-btn {
        min-height: 44px;
        padding: 12px 8px;
    }

    .board-footer-btn span {
        display: none;
    }

    /* Show only icons on very small screens */

    /* Mobile-friendly dropdown menu */
    .dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 12px 12px 0 0;
        z-index: 2000 !important;
        /* 提升層級，確保在所有手把之上 */
        padding: 1rem 0;
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.2) !important;
        animation: slideUp 0.3s ease-out;
        pointer-events: auto !important;
        /* 確保感應觸控 */
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .dropdown-item {
        padding: 15px 20px;
        font-size: 1.1rem;
        display: flex;
        align-items: center;
    }

    .dropdown-item i {
        font-size: 1.3rem;
        margin-right: 15px !important;
    }

    /* Fix grid form touch issues */
    .board-card-footer form {
        display: contents;
    }
}

@media (max-width: 576px) {
    /* Additional very small screen fixes if needed */
}

/* Touch targets and interactions */
.board-footer-btn,
.btn-add-task,
.btn-delete-column,
.btn-edit-task,
.btn-delete-task,
.btn-task-actions,
.dropdown-item,
.nav-link,
.btn-primary {
    touch-action: manipulation;
    cursor: pointer;
}

/* Glassmorphism effects */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}