/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #7c3aed;
    --secondary: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

.hidden {
    display: none !important;
}

/* Auth Screen */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 20px;
}

.auth-container {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--gray-600);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form input {
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-form button {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-form button:hover {
    background: var(--primary-dark);
}

.auth-form button:active {
    transform: scale(0.98);
}

.auth-hint {
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}

/* App Screen */
.app-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync-btn, .profile-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    color: var(--gray-600);
}

.sync-btn:hover, .profile-btn:hover {
    background: var(--gray-100);
}

.sync-btn.syncing {
    animation: spin 1s linear infinite;
}

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

.profile-avatar {
    font-size: 20px;
}

/* Task Input */
.task-input-container {
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.task-input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.add-icon {
    background: transparent;
    border: none;
    color: var(--primary);
    display: flex;
    align-items: center;
    cursor: pointer;
}

.task-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

.task-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.add-task-btn {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.add-task-btn:hover {
    background: var(--primary-dark);
}

.add-task-btn:active {
    transform: scale(0.98);
}

/* Tabs */
.tabs-container {
    background: white;
    position: sticky;
    top: 65px;
    z-index: 90;
    padding: 12px 16px;
}

.tabs {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    position: relative;
    padding: 4px;
    border-radius: 50px;
    justify-content: space-between;
}

/* Background track */
.tab-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-100);
    border-radius: 50px;
    z-index: 0;
}

/* Sliding pill */
.tab-pill {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(33.333% - 2.67px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
}

.tab-pill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%);
    animation: shimmer 2s infinite;
    border-radius: 50px;
}

@keyframes shimmer {
    0% { transform: translateX(0); }
    100% { transform: translateX(300%); }
}

.tab {
    flex: 1 1 0;
    padding: 12px 16px;
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 2;
}

/* Ensure child elements don't interfere with tab clicks */
.tab > * {
    pointer-events: none;
}

.tab-icon {
    font-size: 18px;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}

.tab-label {
    transition: all 0.3s;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: white;
}

.tab.active .tab-icon {
    transform: rotate(360deg) scale(1.1);
}

.tab-count {
    background: rgba(0, 0, 0, 0.1);
    color: var(--gray-600);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.3s;
}

.tab.active .tab-count {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Task Lists */
.task-lists {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.task-list {
    display: none;
    min-height: 400px;
}

.task-list.active {
    display: block;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
}

/* Tasks */
.task {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: move;
    transition: all 0.2s;
}

.task:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.task.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.task.drag-over {
    border-color: var(--primary);
    background: var(--gray-50);
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.task-title-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.task-title {
    font-size: 16px;
    color: var(--gray-900);
}

.task-assigned-by {
    font-size: 12px;
    color: var(--gray-500);
    font-style: italic;
}

.task.completed .task-title {
    text-decoration: line-through;
    color: var(--gray-500);
}

.task-actions {
    display: flex;
    gap: 8px;
}

.task-action-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--gray-500);
    font-size: 20px;
    border-radius: 4px;
    transition: all 0.2s;
}

.task-action-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Task Action Menu */
.task-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 160px;
    margin-top: 4px;
}

.task-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.task-menu-item:hover {
    background: var(--gray-50);
}

.task-menu-item.danger {
    color: var(--danger);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
}

.profile-field {
    margin-bottom: 20px;
}

.profile-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.profile-field input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
}

.profile-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.profile-field input[readonly] {
    background: var(--gray-50);
    color: var(--gray-600);
}

/* Buttons */
.btn-primary, .btn-secondary {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    color: var(--danger);
    border: 2px solid var(--danger);
}

.btn-secondary:hover {
    background: var(--danger);
    color: white;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .header-content {
        padding: 12px 16px;
    }
    
    .app-title {
        font-size: 18px;
    }
    
    .task-input-wrapper {
        padding: 12px 16px;
    }
    
    .add-icon {
        display: none;
    }
    
    .add-task-btn {
        padding: 12px 16px;
    }
    
    .tabs {
        padding: 0 16px;
    }
    
    .tab {
        padding: 12px 8px;
        font-size: 14px;
    }
    
    .task-lists {
        padding: 16px;
    }
    
    .task {
        padding: 12px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task {
    animation: slideIn 0.3s ease-out;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success Animation */
@keyframes checkmark {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.task-checkbox:checked {
    animation: checkmark 0.3s ease-out;
}