/* ==========================================================================
   Component Styles
   ========================================================================== */

/* ==========================================================================
   Header Component
   ========================================================================== */
header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) 0;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.controls {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   Button Component
   ========================================================================== */
.btn {
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 44px;
    touch-action: manipulation;
    text-decoration: none;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--card);
    border-color: var(--primary);
}

.btn-export {
    background: var(--success);
    color: white;
    border: none;
}

.btn-export:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

/* ==========================================================================
   Theme Switcher Component
   ========================================================================== */
.theme-switcher {
    display: flex;
    gap: var(--space-sm);
    background: var(--card);
    padding: var(--space-xs);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.theme-btn {
    padding: var(--space-sm);
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    border-radius: calc(var(--radius) - 4px);
    transition: var(--transition);
    min-height: 36px;
    min-width: 36px;
}

.theme-btn.active {
    background: var(--primary);
    color: white;
}

/* ==========================================================================
   Hero Section Component
   ========================================================================== */
.hero {
    padding: var(--space-3xl) 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    margin-bottom: var(--space-2xl);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

/* ==========================================================================
   Stats Grid Component
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-3xl);
}

.stat-card {
    background: var(--card);
    padding: var(--space-xl);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.stat-card:hover::before {
    transform: scaleY(1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ==========================================================================
   Filter Component
   ========================================================================== */
.filters {
    background: var(--card);
    padding: var(--space-xl);
    border-radius: var(--radius);
    margin-bottom: var(--space-2xl);
    border: 1px solid var(--border);
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.phase-controls {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.search-box {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    transition: var(--transition);
    min-height: 44px;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    touch-action: manipulation;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ==========================================================================
   Phase Component
   ========================================================================== */
.phase {
    margin-bottom: var(--space-2xl);
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.phase:nth-child(1) { animation-delay: 0.1s; }
.phase:nth-child(2) { animation-delay: 0.2s; }
.phase:nth-child(3) { animation-delay: 0.3s; }
.phase:nth-child(4) { animation-delay: 0.4s; }
.phase:nth-child(5) { animation-delay: 0.5s; }
.phase:nth-child(6) { animation-delay: 0.6s; }
.phase:nth-child(7) { animation-delay: 0.7s; }
.phase:nth-child(8) { animation-delay: 0.8s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.phase-header {
    background: var(--card);
    padding: var(--space-xl);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    min-height: 48px;
}

.phase-header:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px var(--shadow);
}

.phase-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.phase-toggle {
    font-size: 1.5rem;
    transition: var(--transition);
}

.phase-header.collapsed .phase-toggle {
    transform: rotate(-90deg);
}

.phase-content {
    display: grid;
    gap: 1rem;
    transition: var(--transition);
    overflow: hidden;
}

.phase-content.collapsed {
    display: none;
}

/* ==========================================================================
   Task Card Component
   ========================================================================== */
.task-card {
    background: var(--card);
    padding: var(--space-xl);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-height: 44px;
    cursor: pointer;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

.task-card:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

.task-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--phase-color, var(--primary));
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.task-main-info {
    flex: 1;
    min-width: 0;
}

.task-visual-indicators {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.task-id {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 0.25rem;
}

.task-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.task-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    opacity: 0.8;
    align-items: center;
}

.task-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.assignee-info {
    font-weight: 600;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==========================================================================
   Assignee Badge Component
   ========================================================================== */
.assignee-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    background: var(--assignee-color, var(--secondary));
    flex-shrink: 0;
}

/* ==========================================================================
   Duration Bar Component
   ========================================================================== */
.duration-bar {
    width: 60px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.duration-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--warning) 50%, var(--danger) 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ==========================================================================
   Difficulty Display Component
   ========================================================================== */
.difficulty-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.difficulty-stars {
    display: flex;
    gap: 2px;
}

.difficulty-star {
    width: 12px;
    height: 12px;
    background: var(--border);
    border-radius: 2px;
    transition: var(--transition);
}

.difficulty-star.filled {
    background: var(--warning);
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   Task Details Component
   ========================================================================== */

.task-details {
    margin-top: var(--space-md);
    border-top: 1px solid var(--border);
    padding-top: var(--space-md);
}

.details-toggle {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: var(--space-xs) 0;
    transition: var(--transition);
    text-decoration: underline;
}

.details-toggle:hover {
    color: var(--primary-dark);
}

.details-content {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.4;
    transition: var(--transition);
    overflow: hidden;
    max-height: 200px;
}

.task-details.collapsed .details-content {
    max-height: 0;
    padding: 0 var(--space-sm);
    margin-top: 0;
    opacity: 0;
}

/* ==========================================================================
   Touch-friendly Enhancements
   ========================================================================== */
button, a, .phase-header, .task-card {
    -webkit-tap-highlight-color: rgba(99, 102, 241, 0.1);
    touch-action: manipulation;
    min-height: 48px;
}

/* Touch gesture states */
.touch-device .phase-header {
    position: relative;
    overflow: hidden;
}

.touch-device .phase-header::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    opacity: 0;
    transform: scaleY(0);
    transition: all 0.3s ease;
}

.phase-expanding .phase-header::after,
.phase-collapsing .phase-header::after {
    opacity: 1;
    transform: scaleY(1);
}

.phase-expanding .phase-header {
    background: linear-gradient(90deg, var(--card), rgba(99, 102, 241, 0.05));
}

.phase-collapsing .phase-header {
    background: linear-gradient(90deg, var(--card), rgba(239, 68, 68, 0.05));
}

/* Task card touch states */
.task-card.long-pressed {
    transform: scale(0.98);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    background: linear-gradient(135deg, var(--card), rgba(99, 102, 241, 0.05));
}

.task-card.mobile-optimized {
    will-change: transform;
    contain: layout style paint;
}

/* Pull to refresh styles */
.pull-to-refresh-active {
    --pull-progress: 0;
}

.pull-to-refresh-active::before {
    content: '🔄';
    position: fixed;
    top: calc(var(--pull-progress) * 60px - 30px);
    left: 50%;
    transform: translateX(-50%) rotate(calc(var(--pull-progress) * 360deg));
    font-size: 1.5rem;
    z-index: 1000;
    opacity: var(--pull-progress);
    transition: opacity 0.1s ease;
}

.pull-to-refresh-triggered::before {
    animation: pullRefreshSpin 1s linear infinite;
    top: 30px;
    opacity: 1;
}

@keyframes pullRefreshSpin {
    from { transform: translateX(-50%) rotate(0deg); }
    to { transform: translateX(-50%) rotate(360deg); }
}

/* Refresh indicator */
.refresh-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: var(--success);
    color: white;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.refresh-indicator.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Breakpoint-specific styles */
body.bp-xs {
    --space-lg: 1rem;
    --space-xl: 1.5rem;
}

body.bp-sm {
    --space-lg: 1.25rem;
    --space-xl: 1.75rem;
}

/* Mobile layout optimizations */
.mobile-layout .hero {
    padding: var(--space-xl) 0;
}

.mobile-layout .hero h1 {
    font-size: 2rem;
}

.mobile-layout .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.mobile-layout .phase {
    margin-bottom: var(--space-lg);
}

/* Keyboard visibility handling */
.keyboard-visible .hero {
    display: none;
}

.keyboard-visible .stats-grid {
    display: none;
}

.keyboard-visible .filters {
    position: sticky;
    top: 0;
    z-index: 50;
    margin-bottom: var(--space-md);
}

/* Orientation-specific styles */
.landscape .modal {
    max-height: 70vh;
    width: 80%;
    max-width: 600px;
}

.landscape-modal {
    display: flex;
    flex-direction: row;
    max-width: 80vw;
    max-height: 60vh;
}

.landscape-modal .modal-body {
    flex: 1;
    overflow-y: auto;
}

/* Enhanced touch targets for small screens */
@media (max-width: 480px) {
    .theme-btn, .btn {
        min-height: 48px;
        min-width: 48px;
        padding: var(--space-md);
    }
    
    .phase-header {
        min-height: 64px;
        padding: var(--space-lg);
    }
    
    .task-card {
        padding: var(--space-lg);
        margin-bottom: var(--space-lg);
        min-height: 80px;
    }
    
    .assignee-badge {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ==========================================================================
   Lazy Loading and Performance Optimizations
   ========================================================================== */

/* Lazy loading states */
.lazy-loading {
    opacity: 0.6;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lazy-loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Lazy section optimizations */
.lazy-section {
    contain: layout style paint;
    will-change: contents;
}

/* Virtual scroll container */
.virtual-scroll-wrapper {
    position: relative;
    overflow: hidden;
}

.virtual-scroll-viewport {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    will-change: transform;
}

.virtual-item {
    contain: layout style paint;
    position: relative;
}

/* Lazy image loading */
img[data-src] {
    background: var(--border);
    border-radius: var(--radius);
    transition: opacity 0.3s ease;
}

.lazy-image-loaded {
    opacity: 1;
}

.lazy-image-complete {
    background: none;
}

.lazy-image-error {
    background: var(--border);
    opacity: 0.5;
}

.lazy-image-error::after {
    content: '❌';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
}

/* Performance optimizations for mobile */
.mobile-optimized {
    contain: layout style paint;
    transform: translateZ(0); /* Force hardware acceleration */
}

.mobile-optimized.task-card {
    will-change: auto; /* Only change when needed */
}

/* Skeleton loading states */
.skeleton-loader {
    background: linear-gradient(90deg, var(--border) 25%, var(--card) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-text.long {
    width: 100%;
}

/* Performance indicators */
.performance-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-sm);
    font-size: 0.8rem;
    opacity: 0.8;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.performance-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

.performance-indicator .fps-counter {
    color: var(--success);
}

.performance-indicator .fps-counter.low {
    color: var(--warning);
}

.performance-indicator .fps-counter.critical {
    color: var(--danger);
}

/* Intersection observer animations */
.task-card[data-observed] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.task-card[data-observed].visible {
    opacity: 1;
    transform: translateY(0);
}

/* Memory-efficient animations */
@media (prefers-reduced-motion: no-preference) {
    .task-card {
        animation: taskSlideIn 0.3s ease-out;
    }
}

@keyframes taskSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .lazy-loading,
    .lazy-loaded,
    .task-card,
    .virtual-scroll-viewport {
        animation: none !important;
        transition: none !important;
    }
    
    .task-card[data-observed] {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   Mobile Filter Bottom Sheet
   ========================================================================== */

/* Mobile filter trigger */
.mobile-filter-trigger {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    border-radius: 50px;
    padding: var(--space-md) var(--space-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .mobile-filter-trigger {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
    }
    
    /* Hide desktop filters on mobile */
    .filters .filter-group {
        display: none;
    }
    
    .filters .phase-controls {
        display: flex; /* Keep phase controls visible */
    }
}

/* Bottom sheet backdrop */
.mobile-filter-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    z-index: 1000;
    display: none;
    transition: opacity 300ms ease-out;
}

/* Bottom sheet container */
.mobile-filter-bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 80vh;
    transform: translateY(100%);
    z-index: 1001;
    display: none;
    overflow: hidden;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}

/* Bottom sheet handle */
.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: var(--space-sm) auto var(--space-md);
    cursor: grab;
    touch-action: none;
}

.bottom-sheet-handle:active {
    cursor: grabbing;
}

/* Bottom sheet header */
.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--border);
    background: var(--card);
    position: sticky;
    top: 0;
    z-index: 10;
}

.bottom-sheet-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.btn-clear-filters {
    min-height: 36px;
    padding: var(--space-xs) var(--space-md);
    font-size: 0.9rem;
}

/* Bottom sheet content */
.bottom-sheet-content {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: calc(80vh - 120px); /* Account for header and handle */
    -webkit-overflow-scrolling: touch;
}

/* Filter sections */
.mobile-filter-section {
    margin-bottom: var(--space-xl);
}

.filter-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--primary);
}

/* Mobile search input */
.mobile-search-input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 16px; /* Prevent iOS zoom */
    min-height: 48px;
}

.mobile-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Quick filters */
.quick-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.quick-filter-chip {
    background: var(--border);
    color: var(--text);
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 40px;
    touch-action: manipulation;
}

.quick-filter-chip:hover,
.quick-filter-chip.active {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Assignee filter */
.assignee-filter-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-sm);
}

.assignee-option {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.assignee-option:hover {
    background: var(--border);
    border-color: var(--primary);
}

.assignee-option input[type="radio"] {
    margin-right: var(--space-sm);
    accent-color: var(--primary);
}

.assignee-option input[type="radio"]:checked + span {
    color: var(--primary);
    font-weight: 600;
}

/* Difficulty filter */
.difficulty-filter-container {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.difficulty-level-btn {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    min-width: 48px;
}

.difficulty-level-btn:hover,
.difficulty-level-btn.active {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
    transform: scale(1.05);
}

.difficulty-level-btn .star {
    font-size: 0.8rem;
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.difficulty-level-btn .star.filled {
    opacity: 1;
}

/* Phase filter */
.phase-filter-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-sm);
}

.phase-btn {
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}

.phase-btn:hover,
.phase-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* Duration filter */
.duration-filter-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--space-sm);
}

.duration-btn {
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    text-align: center;
}

.duration-btn:hover,
.duration-btn.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Body class when bottom sheet is open */
.bottom-sheet-open {
    overflow: hidden;
    height: 100vh;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .mobile-filter-bottom-sheet {
        max-height: 85vh;
    }
    
    .bottom-sheet-content {
        padding: var(--space-md);
        max-height: calc(85vh - 100px);
    }
    
    .assignee-filter-container,
    .phase-filter-container,
    .duration-filter-container {
        grid-template-columns: 1fr;
    }
    
    .difficulty-filter-container {
        justify-content: center;
    }
    
    .quick-filters-container {
        justify-content: center;
    }
}

/* Animation for bottom sheet */
@keyframes bottomSheetSlideIn {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes bottomSheetSlideOut {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

/* Smooth scrolling for bottom sheet content */
.bottom-sheet-content {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.mobile-filter-bottom-sheet button:focus,
.mobile-filter-bottom-sheet input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Dark mode adjustments */
[data-theme="dark"] .mobile-filter-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .bottom-sheet-handle {
    background: var(--text);
    opacity: 0.6;
}

/* ==========================================================================
   Enhanced Mobile Modal Presentations
   ========================================================================== */

/* Mobile modal adaptations */
.modal-mobile {
    width: 95vw !important;
    max-width: none !important;
    height: auto;
    max-height: 90vh;
    margin: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: mobileModalSlideUp 0.3s ease-out;
}

.modal-mobile .modal-header {
    position: relative;
    padding: var(--space-lg);
    touch-action: pan-y;
}

.modal-mobile .modal-header::before {
    content: '';
    position: absolute;
    top: var(--space-sm);
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

.modal-mobile .modal-header[data-mobile-draggable="true"] {
    cursor: grab;
    user-select: none;
}

.modal-mobile .modal-header[data-mobile-draggable="true"]:active {
    cursor: grabbing;
}

.modal-mobile .modal-body {
    max-height: calc(90vh - 150px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-md) var(--space-lg);
}

.modal-mobile .modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    background: var(--card);
    position: sticky;
    bottom: 0;
}

/* Mobile landscape modal */
.modal-landscape {
    width: 80vw !important;
    height: auto;
    max-height: 75vh;
    top: 50%;
    left: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    border-radius: var(--radius);
    animation: modalZoomIn 0.3s ease-out;
}

.modal-landscape .modal-body {
    max-height: calc(75vh - 140px);
    display: flex;
    flex-direction: row;
    gap: var(--space-lg);
}

.modal-landscape .modal-body > * {
    flex: 1;
}

/* Modal animations */
@keyframes mobileModalSlideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes modalZoomIn {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Body class when mobile modal is open */
.modal-open-mobile {
    overflow: hidden;
    height: 100vh;
    position: fixed;
    width: 100%;
}

.modal-open-mobile .modal-overlay {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* Enhanced modal touch targets */
.modal-mobile .btn {
    min-height: 52px;
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
    touch-action: manipulation;
}

.modal-mobile .modal-close {
    min-height: 48px;
    min-width: 48px;
    padding: var(--space-md);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-mobile .modal-close:hover {
    background: var(--border);
    transform: scale(1.1);
}

/* Modal form elements for mobile */
.modal-mobile input,
.modal-mobile select,
.modal-mobile textarea {
    min-height: 52px;
    font-size: 16px; /* Prevent iOS zoom */
    padding: var(--space-md);
}

.modal-mobile .radio-option,
.modal-mobile .checkbox-option {
    min-height: 52px;
    padding: var(--space-md);
    touch-action: manipulation;
}

.modal-mobile .radio-label,
.modal-mobile .checkbox-label {
    font-size: 1rem;
    padding: var(--space-sm);
}

/* Safe area insets for devices with notches */
@supports (padding: max(0px)) {
    .modal-mobile {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .modal-mobile .modal-footer {
        padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom));
    }
}

/* Accessibility improvements */
.modal[aria-hidden="true"] {
    display: none !important;
}

.modal-mobile .modal-header:focus-within::before {
    background: var(--primary);
}

/* Focus management for mobile */
.modal-mobile button:focus,
.modal-mobile input:focus,
.modal-mobile select:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modal-mobile {
        border: 2px solid var(--text);
    }
    
    .modal-mobile .modal-header::before {
        background: var(--text);
        height: 6px;
    }
}

/* Reduced motion support for modals */
@media (prefers-reduced-motion: reduce) {
    .modal-mobile,
    .modal-landscape {
        animation: none !important;
        transition: none !important;
    }
    
    .modal-mobile {
        transform: translateX(-50%) translateY(0) !important;
        opacity: 1 !important;
    }
    
    .modal-landscape {
        transform: translate(-50%, -50%) scale(1) !important;
        opacity: 1 !important;
    }
}

/* Dark theme adjustments for mobile modals */
[data-theme="dark"] .modal-mobile .modal-header::before {
    background: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .modal-mobile .modal-footer {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Ultra-wide screen adaptations */
@media (min-width: 1400px) {
    .modal-landscape {
        width: 60vw !important;
        max-width: 800px;
    }
}

/* Very small screen adaptations */
@media (max-width: 320px) {
    .modal-mobile {
        width: 100vw !important;
        border-radius: 0;
        max-height: 95vh;
    }
    
    .modal-mobile .modal-body {
        padding: var(--space-sm) var(--space-md);
    }
    
    .modal-mobile .modal-footer {
        padding: var(--space-md);
    }
}

@media (max-width: 768px) {
    button, .btn, select, .search-box {
        min-height: 52px !important;
        padding: 0.75rem 1rem !important;
        font-size: 16px !important; /* Prevent iOS zoom */
    }
    
    .phase-header {
        min-height: 60px;
        padding: var(--space-xl) 1.25rem;
    }
    
    .task-card {
        min-height: 80px;
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group > * {
        width: 100%;
        margin-bottom: var(--space-sm);
    }
    
    .phase-controls {
        flex-direction: column;
        gap: var(--space-sm);
        margin-left: 0;
        margin-top: var(--space-md);
    }
    
    .assignee-badge {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .duration-bar {
        width: 80px;
        height: 6px;
    }
    
    .difficulty-star {
        width: 16px;
        height: 16px;
    }
    
    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .task-visual-indicators {
        justify-content: flex-start;
        gap: var(--space-lg);
    }
}

/* ==========================================================================
   Modal Component
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: var(--space-2xl);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px var(--shadow);
    transform: translateY(20px);
    animation: modalSlideIn 0.3s ease-out forwards;
}

@keyframes modalSlideIn {
    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: var(--space-sm);
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border);
}

.modal-body {
    margin-bottom: var(--space-lg);
}

.modal-footer {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

/* ==========================================================================
   Loading States
   ========================================================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--card) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================================================
   Export Modal Styles
   ========================================================================== */

.export-section {
    margin-bottom: var(--space-xl);
}

.section-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text);
}

.radio-group, .checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.radio-option, .checkbox-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    transition: var(--transition);
    cursor: pointer;
}

.radio-option:hover, .checkbox-option:hover {
    background: var(--border);
    border-color: var(--primary);
}

.radio-option input, .checkbox-option input {
    margin: 0;
    cursor: pointer;
}

.radio-label, .checkbox-label {
    cursor: pointer;
    margin: 0;
    font-size: 0.9rem;
    user-select: none;
}

.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ==========================================================================
   Filter Chips Component
   ========================================================================== */

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding: var(--space-md) 0;
    border-top: 1px solid var(--border);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    animation: chipSlideIn 0.3s ease;
}

.filter-chip-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    transition: var(--transition);
}

.filter-chip-remove:hover {
    background: rgba(255, 255, 255, 0.2);
}

.filter-chip.assignee { background: var(--secondary); }
.filter-chip.difficulty { background: var(--warning); }
.filter-chip.phase { background: var(--accent); }
.filter-chip.duration { background: var(--danger); }
.filter-chip.search { background: var(--primary); }

@keyframes chipSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.filter-chip-exit {
    animation: chipSlideOut 0.2s ease forwards;
}

@keyframes chipSlideOut {
    to {
        opacity: 0;
        transform: translateX(-20px) scale(0.8);
    }
}

/* Mobile responsive modal */
@media (max-width: 768px) {
    .modal {
        width: 95%;
        max-height: 85vh;
        margin: var(--space-md);
    }
    
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .radio-group {
        gap: var(--space-sm);
    }
    
    .radio-option, .checkbox-option {
        padding: var(--space-md);
        min-height: 48px;
    }
}

/* ==========================================================================
   Team Summary Component
   ========================================================================== */

.section-separator {
    border: none;
    height: 1px;
    background: var(--border);
    margin: var(--space-3xl) 0 var(--space-2xl) 0;
}

.team-summary-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: var(--space-2xl);
    color: var(--text);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-3xl);
}

.team-card {
    background: var(--card);
    padding: var(--space-xl);
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--team-color, var(--primary));
}

.team-card[data-member="Aldo"]::before {
    background: #3b82f6; /* Blue */
}

.team-card[data-member="Nuri"]::before {
    background: #10b981; /* Green */
}

.team-card[data-member="Luis"]::before {
    background: #f59e0b; /* Orange */
}

.team-card[data-member="Silvia"]::before {
    background: #ef4444; /* Red */
}

.team-card[data-member="Caro"]::before {
    background: #8b5cf6; /* Purple */
}

.team-card[data-member="All"]::before {
    background: linear-gradient(135deg, #6b7280, #9ca3af); /* Gray gradient for team tasks */
}

.team-all-card {
    border: 2px dashed var(--border);
    background: var(--background-alt);
}

.team-all-card .team-name {
    color: var(--text-muted);
    font-style: italic;
}

.team-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

.team-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--primary);
}

.team-stats {
    font-size: 0.9rem;
    opacity: 0.8;
    color: var(--text);
}

/* Mobile responsive team grid */
@media (max-width: 768px) {
    .team-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: var(--space-md);
    }
    
    .team-card {
        padding: var(--space-lg);
    }
    
    .team-name {
        font-size: 1.1rem;
    }
    
    .team-stats {
        font-size: 0.85rem;
    }
}

/* ==========================================================================
   Enhanced Mobile & Touch Components
   ========================================================================== */

/* Mobile Filter Components */
.mobile-filter-trigger {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    padding: var(--space-lg) var(--space-xl);
    box-shadow: 0 4px 12px var(--shadow-heavy);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    z-index: var(--z-fixed);
    transition: var(--transition);
    min-height: var(--touch-target-large);
    transform: var(--gpu-acceleration);
}

.mobile-filter-trigger:hover {
    transform: translateY(-2px) var(--gpu-acceleration);
    box-shadow: 0 6px 16px var(--shadow-heavy);
}

.mobile-filter-trigger.has-filters {
    background: var(--secondary);
}

.mobile-filter-trigger .active-count {
    background: white;
    color: var(--primary);
    border-radius: var(--radius-full);
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.filter-bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    transition: opacity var(--transition);
    backdrop-filter: blur(4px);
}

.filter-bottom-sheet-overlay.active {
    opacity: 1;
}

.filter-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: var(--z-modal);
    transform: translateY(100%);
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.filter-bottom-sheet.active {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin: var(--space-md) auto var(--space-sm);
    cursor: grab;
}

.bottom-sheet-handle:active {
    cursor: grabbing;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-xl) var(--space-md);
    border-bottom: 1px solid var(--border);
}

.sheet-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.sheet-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius);
    transition: var(--transition);
    min-height: var(--touch-target);
    min-width: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sheet-close-btn:hover {
    background: var(--border);
    color: var(--text);
}

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg) var(--space-xl);
    overscroll-behavior: contain;
}

.bottom-sheet-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-md);
    background: var(--card);
}

.bottom-sheet-footer .btn {
    flex: 1;
}

.filter-section {
    margin-bottom: var(--space-2xl);
}

.filter-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text);
    font-size: 0.9rem;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: var(--space-lg);
}

.mobile-search-input {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 16px; /* Prevent iOS zoom */
    min-height: var(--touch-target-large);
}

.mobile-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius);
    min-height: var(--touch-target);
    min-width: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.filter-chips-container .filter-chip {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    min-height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    user-select: none;
}

.filter-chips-container .filter-chip:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.filter-chips-container .filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.active-filters-section {
    border-top: 1px solid var(--border);
    padding-top: var(--space-lg);
    margin-top: var(--space-lg);
}

.active-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.active-filter-chip {
    background: var(--primary);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    animation: chipSlideIn 0.3s ease;
}

.active-filter-chip .remove-filter {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: var(--radius-full);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
}

.active-filter-chip .remove-filter:hover {
    background: rgba(255, 255, 255, 0.3);
}

.filter-apply-feedback {
    position: fixed;
    top: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius);
    font-weight: 500;
    z-index: var(--z-toast);
    opacity: 0;
    transition: var(--transition);
}

.filter-apply-feedback.visible {
    opacity: 1;
}

/* Touch Gesture Components */
.pull-to-refresh-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--card);
    padding: var(--space-lg);
    z-index: var(--z-sticky);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
}

.pull-to-refresh-indicator.visible {
    opacity: 1;
    visibility: visible;
}

.pull-indicator-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
}

.pull-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.pull-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.refresh-toast,
.gesture-toast {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    color: var(--text);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px var(--shadow);
    font-weight: 500;
    z-index: var(--z-toast);
    opacity: 0;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.refresh-toast.visible,
.gesture-toast.visible {
    opacity: 1;
}

.tap-feedback {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-full);
    pointer-events: none;
    transform: scale(0);
    transition: transform 0.6s ease;
}

.tap-feedback.animate {
    transform: scale(4);
    opacity: 0;
}

.task-context-menu {
    position: fixed;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px var(--shadow);
    z-index: var(--z-popover);
    min-width: 160px;
    animation: contextMenuSlideIn 0.2s ease;
}

.context-menu-item {
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    min-height: var(--touch-target);
    display: flex;
    align-items: center;
}

.context-menu-item:last-child {
    border-bottom: none;
}

.context-menu-item:hover {
    background: var(--border);
}

@keyframes contextMenuSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Performance Optimizations */
.virtual-scroll-wrapper {
    contain: var(--contain);
    will-change: scroll-position;
    transform: var(--gpu-acceleration);
}

.virtual-scroll-viewport {
    contain: var(--contain);
    will-change: transform;
}

.lazy-loaded {
    animation: lazyFadeIn 0.3s ease;
}

@keyframes lazyFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.performance-indicator {
    font-family: monospace;
    line-height: 1.4;
}

/* Enhanced Responsive Design */
@media (max-width: 320px) {
    .container {
        padding: 0 var(--space-sm) var(--space-xl) var(--space-sm);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    button, .btn, select, .search-box {
        min-height: var(--touch-target-large) !important;
        padding: 0.75rem 1rem !important;
        font-size: 16px !important; /* Prevent iOS zoom */
        border-radius: var(--radius-sm);
    }
    
    .phase-header {
        min-height: 60px;
        padding: var(--space-xl) 1.25rem;
        border-radius: var(--radius-sm);
    }
    
    .task-card {
        min-height: 80px;
        padding: 1.25rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-sm);
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }
    
    .filter-group > * {
        width: 100%;
    }
    
    .phase-controls {
        flex-direction: column;
        gap: var(--space-sm);
        margin-left: 0;
        margin-top: var(--space-md);
        width: 100%;
    }
    
    .phase-controls .btn {
        width: 100%;
        justify-content: center;
    }
    
    .hero {
        padding: var(--space-2xl) 0;
        margin-bottom: var(--space-xl);
    }
    
    .hero h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }
    
    .controls {
        flex-wrap: wrap;
        gap: var(--space-md);
        justify-content: center;
    }
    
    .theme-switcher {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .header-content {
        flex-direction: column;
        gap: var(--space-lg);
        text-align: center;
    }
}

/* Large desktop optimizations */
@media (min-width: 1400px) {
    .container {
        max-width: 1600px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .task-card {
        padding: var(--space-2xl);
    }
    
    .hero h1 {
        font-size: 3rem;
    }
}

/* Safe area support for iOS */
@supports (padding: max(0px)) {
    .mobile-filter-trigger {
        bottom: max(var(--space-xl), var(--safe-area-bottom));
        right: max(var(--space-xl), var(--safe-area-right));
    }
    
    .filter-bottom-sheet {
        padding-bottom: max(0px, var(--safe-area-bottom));
    }
    
    .container {
        padding-left: max(var(--space-lg), var(--safe-area-left));
        padding-right: max(var(--space-lg), var(--safe-area-right));
    }
}

/* ==========================================================================
   Enhanced Export Modal Mobile Styles
   ========================================================================== */

/* Export Modal Enhancements */
.export-modal-overlay {
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.4);
}

.export-modal {
    contain: layout style paint;
    will-change: transform, opacity;
}

.export-modal.modal-mobile {
    width: 100vw;
    max-width: 100vw;
    height: auto;
    max-height: 85vh;
    bottom: 0;
    top: auto;
    left: 0;
    transform: translateY(100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 32px var(--shadow-heavy);
}

.export-modal.modal-slide-up {
    animation: slideUpModal 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile Modal Header Enhancements */
.export-modal-header {
    position: relative;
    padding: var(--space-lg) var(--space-xl) var(--space-md);
    border-bottom: 1px solid var(--border);
    background: var(--card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-drag-handle {
    position: absolute;
    top: var(--space-sm);
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    cursor: grab;
    touch-action: none;
}

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

.modal-title-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.4;
}

/* Mobile Modal Body Enhancements */
.export-modal-body.modal-body-mobile {
    padding: var(--space-lg) var(--space-xl);
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Mobile Section System */
.mobile-section-wrapper {
    margin-bottom: var(--space-lg);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.mobile-section-header {
    background: var(--card);
    padding: var(--space-lg);
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--border);
}

.mobile-section-header:active {
    background: var(--border);
}

.mobile-section-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-section-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.mobile-section-expand-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.mobile-section-content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.mobile-section-content.expanded {
    max-height: 500px;
    opacity: 1;
}

.mobile-section-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
}

.mobile-optimized-section {
    padding: var(--space-lg);
    background: var(--bg);
}

/* Touch Optimizations */
.touch-optimized {
    min-height: var(--touch-target);
    display: flex !important;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

.touch-optimized:active {
    background: var(--border);
    transform: scale(0.98);
}

.mobile-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Mobile Footer Enhancements */
.export-modal-footer.modal-footer-mobile {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--border);
    background: var(--card);
    position: sticky;
    bottom: 0;
}

.export-progress-container {
    margin-bottom: var(--space-lg);
}

.export-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.export-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 0.5s ease;
}

.modal-button-container {
    display: flex;
    gap: var(--space-lg);
    justify-content: stretch;
}

.modal-button-container .btn {
    flex: 1;
}

.btn-mobile {
    min-height: var(--touch-target-large);
    font-weight: 600;
    letter-spacing: 0.025em;
}

.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Mobile Focus Indicators */
.mobile-focus {
    outline: 3px solid var(--primary) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 1px var(--primary) !important;
}

/* Export Success Toast */
.export-success-toast {
    position: fixed;
    top: var(--space-xl);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--success);
    color: white;
    padding: var(--space-lg) var(--space-xl);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    z-index: var(--z-toast);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 8px 32px var(--shadow);
    backdrop-filter: blur(10px);
}

.export-success-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.success-icon {
    font-size: 1.25rem;
}

.success-text {
    font-weight: 500;
}

/* Safe Area Support */
.modal-safe-area {
    padding-top: max(var(--space-lg), env(safe-area-inset-top));
    padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom));
    padding-left: max(var(--space-lg), env(safe-area-inset-left));
    padding-right: max(var(--space-lg), env(safe-area-inset-right));
}

/* Landscape Mobile Adaptations */
.export-modal.modal-landscape {
    max-height: 90vh;
    width: 85vw;
    max-width: 700px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-lg);
}

.export-modal.modal-landscape .modal-body {
    max-height: calc(90vh - 160px);
}

/* Tablet Optimizations */
.export-modal.modal-tablet {
    width: 80vw;
    max-width: 600px;
    max-height: 80vh;
}

/* High DPI Screen Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .modal-drag-handle {
        height: 3px;
    }
    
    .export-progress-bar {
        height: 3px;
    }
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    .export-modal.modal-slide-up {
        animation: none;
        transform: translateY(0);
        opacity: 1;
    }
    
    .mobile-section-content {
        transition: none;
    }
    
    .mobile-section-expand-icon {
        transition: none;
    }
    
    .export-success-toast {
        transition: opacity 0.3s ease;
        transform: translateX(-50%) translateY(0);
    }
    
    .btn-loading::after {
        animation: none;
        display: none;
    }
}