/* app.css - Enhanced CSS with Compact Spacing and GTD Focus Improvements */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: #333;
}

/* Sidebar Styles */
.sidebar {
    background: white;
    width: 280px;
    height: 100vh;
    position: fixed;
    left: -280px;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.open {
    transform: translateX(280px);
}

.sidebar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 300;
    color: #666;
    letter-spacing: 2px;
}

/* Navigation Sections */
.nav-section {
    margin-bottom: 25px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-left: 5px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    background-color: #f8f9fa;
    color: #4A90E2;
}

.nav-link.active {
    background-color: #4A90E2;
    color: white;
}

.nav-icon {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.nav-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 400;
}

.nav-count {
    background-color: #e9ecef;
    color: #666;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.nav-link.active .nav-count {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.nav-arrow {
    color: #999;
    font-size: 0.9rem;
}

/* Main Content Styles */
.main-content {
    min-height: 100vh;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(255, 255, 255, 0.1);
}

.main-content.sidebar-open {
    transform: translateX(280px);
}

/* Header Styles */
.header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: white;
}

/* Content Area Styles */
.content-area {
    padding: 20px;
    color: white;
}

.page-content {
    max-width: 600px;
    margin: 0 auto;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 30px; /* Increased margin since subtitle removed */
    color: white;
}

.page-subtitle {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 30px;
    color: white;
}

/* Context Filter Chips - IMPROVED */
.filter-chips {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping */
    gap: 4px; /* Even smaller gap */
    margin-bottom: 20px;
    padding: 0; /* Remove padding to use full width */
    width: 100%; /* Use full width */
    max-width: 100%; /* Prevent overflow */
}

.filter-chip {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 10px; /* Even smaller padding */
    border-radius: 12px; /* Smaller border radius */
    font-size: 0.75rem; /* Smaller font size */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 1; /* Allow shrinking */
    min-height: 24px; /* Smaller minimum touch target */
    display: flex;
    align-items: center;
    max-width: calc(50% - 2px); /* Ensure at least 2 per row */
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.filter-chip.active {
    background: white;
    color: #4A90E2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Project Sections - UPDATED FOR NAVIGATION */
.project-section {
    margin-bottom: 15px;
}

.project-header {
    display: flex;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.project-header:hover {
    opacity: 0.8;
}

.project-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: white;
    margin-right: 8px;
    flex: 1;
}

/* Project chevron for navigation (not collapse) */
.project-chevron {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    transition: transform 0.2s ease;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-header:hover .project-chevron {
    color: rgba(255, 255, 255, 0.9);
    transform: translateX(2px);
}

/* COMPACT TASK ITEMS - Updated for due dates and focus */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

.task-item {
    background: white;
    border-radius: 0;
    padding: 8px 16px;
    display: flex;
    align-items: flex-start; /* Changed to flex-start for better alignment */
    gap: 12px;
    transition: all 0.2s ease;
    box-shadow: none;
    border-bottom: 1px solid #f0f0f0;
    min-height: 44px;
}

/* First and last task get rounded corners */
.task-item:first-child {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.task-item:last-child {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    border-bottom: none;
}

/* Only task gets full rounded corners */
.task-item:only-child {
    border-radius: 12px;
}

.task-item:hover {
    background-color: #f8f9fa;
    z-index: 1;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px; /* Align with text baseline */
}

.task-checkbox:hover {
    border-color: #4A90E2;
}

.task-checkbox.checked {
    background: #4A90E2;
    border-color: #4A90E2;
}

.task-checkbox.checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* Allow text to wrap properly */
}

/* FIXED: Task text with proper due date alignment */
.task-text {
    font-size: 1rem;
    color: #333;
    line-height: 1.3;
    display: flex;
    align-items: flex-start; /* Start alignment for multi-line */
    justify-content: space-between; /* Space between text and due date */
    gap: 8px;
    width: 100%;
}

.task-text.completed {
    text-decoration: line-through;
    color: #999;
}

/* Task name - allows wrapping */
.task-name {
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* FIXED: Due date positioning */
.task-due {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 500;
    flex-shrink: 0; /* Don't shrink */
    white-space: nowrap; /* Don't wrap */
    align-self: flex-start; /* Align to top when text wraps */
    margin-top: 1px; /* Small offset for better alignment */
}

.task-due.overdue {
    background: #ffebee;
    color: #d32f2f;
}

.task-star {
    width: 24px;
    height: 24px;
    cursor: pointer;
    color: #ddd;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px; /* Align with text baseline */
}

.task-star:hover {
    color: #ffd700;
    transform: scale(1.1);
}

.task-star.focus {
    color: #ffd700;
}

/* COMPACT INBOX TASK ITEMS */
.inbox-task-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.inbox-task-item {
    background: white;
    border-radius: 0;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    min-height: 44px;
}

.inbox-task-item:first-child {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.inbox-task-item:last-child {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    border-bottom: none;
}

.inbox-task-item:only-child {
    border-radius: 12px;
}

.inbox-task-item:hover {
    background-color: #f8f9fa;
}

/* Project Detail Page Styles - NirvanaHQ Layout */
.project-detail-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    position: relative;
    background: transparent;
}

/* Top Navigation (NirvanaHQ style) */
.project-top-nav {
    padding: 12px 20px;
    background: transparent;
    position: relative;
    z-index: 10;
}

.project-back-btn {
    background: none;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px 0;
    transition: opacity 0.2s ease;
}

.project-back-btn:hover {
    opacity: 0.8;
}

.back-arrow {
    font-size: 1.4rem;
    font-weight: bold;
}

.back-text {
    font-weight: 500;
}

/* Project Header Card (white card like NirvanaHQ) */
.project-header-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.project-detail-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    flex: 1;
    margin: 0;
}

.project-menu-dots {
    font-size: 1.2rem;
    color: #999;
    margin-right: 12px;
}

.project-star {
    font-size: 1.2rem;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s ease;
}

.project-star:hover {
    color: #ffd700;
}

/* Project Filter Section */
.project-filter-section {
    padding: 0 20px;
    position: relative;
    z-index: 5;
}

.project-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-filter-chip {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.project-filter-chip:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.project-filter-chip.active {
    background: white;
    color: #4A90E2;
}

/* Next Up Section */
.next-up-section {
    flex: 1;
    padding: 0 20px 20px;
    position: relative;
    z-index: 1;
}

.next-up-header {
    font-size: 1.3rem;
    font-weight: 500;
    color: white;
    margin-bottom: 16px;
}

/* Project Task List - Using SAME spacing as main Next Action page */
.project-task-list {
    /* Project task list now uses standard task-list styling for identical spacing */
}

/* Task context subtitle (for project view) */
.task-context {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.2;
    margin-top: 2px;
}

/* Remove project-specific task styling - use main page classes instead */
/* Commented out to use main .task-item and .task-list classes:

.project-task-card {
    ... removed to use .task-item instead
}

.project-task-checkbox {
    ... removed to use .task-checkbox instead  
}

.project-task-content {
    ... removed to use .task-content instead
}

.project-task-name {
    ... removed to use .task-name instead
}

.project-task-details {
    ... removed to use .task-context instead
}

.project-task-right {
    ... removed to use .task-star instead
}

.project-task-due {
    ... removed to use .task-due instead
}

.project-task-star {
    ... removed to use .task-star instead
}
*/

/* Empty Project State */
.empty-project-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.empty-project-state p {
    font-size: 1rem;
    font-weight: 300;
}

/* Ensure project view doesn't interfere with main view */
.project-detail-page {
    /* Isolate project view completely */
    isolation: isolate;
}

/* Main view should not show when project view is active */
.next-page-content.project-active .filter-chips {
    display: none !important;
}

.next-page-content.project-active .project-section {
    display: none !important;
}

.project-task-star {
    width: 24px;
    height: 24px;
    cursor: pointer;
    color: #ddd;
    font-size: 16px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-task-star:hover {
    color: #ffd700;
    transform: scale(1.1);
}

.project-task-star.focus {
    color: #ffd700;
}

/* Empty Project State */
.empty-project-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.empty-project-state p {
    font-size: 1rem;
    font-weight: 300;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 300;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #4A90E2;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    transition: all 0.3s ease;
    z-index: 100;
}

.fab:hover {
    background: #357ABD;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.4);
}

.fab:active {
    transform: scale(0.95);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Page visibility */
.next-page-content {
    display: none;
}

.next-page-content.active {
    display: block;
}

/* Priority and Context Tags - HIDDEN IN INBOX */
.priority-indicator {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: bold;
}

.priority-1 { background: #dc3545; color: white; } /* Urgent */
.priority-2 { background: #fd7e14; color: white; } /* High */
.priority-3 { background: #ffc107; color: black; } /* Normal */

.context-tag {
    display: inline-block;
    font-size: 0.7rem;
    color: #666;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

/* HIDE PRIORITY INDICATORS IN INBOX */
.inbox-task-item .priority-indicator {
    display: none !important;
}

/* Toast Notifications */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4A90E2;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        left: -280px;
    }
    
    .sidebar.open {
        transform: translateX(280px);
    }
    
    .main-content.sidebar-open {
        transform: translateX(280px);
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .content-area {
        padding: 15px;
    }
    
    .fab {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    /* Even tighter spacing on mobile */
    .task-item,
    .inbox-task-item {
        padding: 6px 12px;
        min-height: 40px;
    }
    
    /* Better filter chip spacing on mobile */
    .filter-chips {
        gap: 4px;
        margin-bottom: 20px;
    }
    
    .filter-chip {
        padding: 5px 10px;
        font-size: 0.75rem;
        min-height: 26px;
    }
    
    /* Better due date handling on mobile */
    .task-due {
        font-size: 0.7rem;
        padding: 1px 5px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 260px;
        left: -260px;
    }
    
    .sidebar.open {
        transform: translateX(260px);
    }
    
    .main-content.sidebar-open {
        transform: translateX(260px);
    }
    
    .page-title {
        font-size: 1.8rem;
    }
    
    .header {
        padding: 15px;
    }
    
    /* Extra compact filter chips on small screens */
    .filter-chip {
        padding: 4px 8px;
        font-size: 0.7rem;
        min-height: 24px;
    }
    
    /* Extra compact due dates on small screens */
    .task-due {
        font-size: 0.65rem;
        padding: 1px 4px;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
.menu-btn:focus,
.nav-link:focus,
.fab:focus,
.filter-chip:focus,
.task-checkbox:focus,
.task-star:focus,
.project-header:focus,
.back-button:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Animation for page transitions */
.page-content {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}