/* ============================================
   EPC Tasks - iOS 26 Liquid Glass (Complete)
   ============================================ */

:root {
    /* System Colors */
    --color-bg: #F2F2F7;
    --color-surface: #FFFFFF;
    --color-text: #000000;
    --color-text-secondary: #8E8E93;
    --color-separator: rgba(60, 60, 67, 0.12);
    
    /* Accent Colors */
    --color-blue: #007AFF;
    --color-green: #34C759;
    --color-orange: #FF9F0A;
    --color-red: #FF3B30;
    --color-purple: #AF52DE;
    --color-indigo: #5856D6;
    
    /* Glass Materials */
    --glass-thick: rgba(255, 255, 255, 0.85);
    --glass-regular: rgba(255, 255, 255, 0.72);
    --glass-thin: rgba(255, 255, 255, 0.5);
    --blur: blur(20px) saturate(180%);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    
    /* Metrics */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============ Reset ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', sans-serif;
    font-size: 17px;
    line-height: 1.47;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    padding-bottom: calc(100px + var(--safe-bottom));
}

/* ============ Loading & Error States ============ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-separator);
    border-top-color: var(--color-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 16px;
    color: var(--color-text-secondary);
    font-size: 15px;
}

.error-state {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    z-index: 9998;
}

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

.error-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.error-text {
    font-size: 15px;
    color: var(--color-text-secondary);
    max-width: 280px;
}

/* ============ Header ============ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    height: calc(56px + var(--safe-top));
    padding-top: var(--safe-top);
    padding-left: 20px;
    padding-right: 20px;
    background: var(--glass-thick);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}

.header-back {
    width: 44px;
    height: 44px;
    margin-right: 8px;
    border: none;
    background: none;
    color: var(--color-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
}

/* ============ Main Content ============ */
.main-content {
    padding: 16px;
}

.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* ============ Quick Add ============ */
.quick-add {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.quick-add-input {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 17px;
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.quick-add-input:focus {
    outline: 2px solid var(--color-blue);
    outline-offset: -2px;
}

.quick-add-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-blue);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============ Categories Grid ============ */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.category-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.category-card:active {
    transform: scale(0.97);
}

.category-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.category-icon.blue { background: rgba(0, 122, 255, 0.15); }
.category-icon.orange { background: rgba(255, 159, 10, 0.15); }
.category-icon.green { background: rgba(52, 199, 89, 0.15); }
.category-icon.purple { background: rgba(175, 82, 222, 0.15); }

.category-info {
    display: flex;
    flex-direction: column;
}

.category-count {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
}

.category-label {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* ============ Sections ============ */
.section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
}

.section-action {
    font-size: 15px;
    color: var(--color-blue);
    background: none;
    border: none;
    font-weight: 500;
    cursor: pointer;
}

/* ============ Goals List ============ */
.goals-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.goal-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.goal-card:active {
    background: var(--color-bg);
}

.goal-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.goal-info {
    flex: 1;
}

.goal-name {
    font-size: 17px;
    font-weight: 500;
}

.goal-meta {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.goal-arrow {
    color: var(--color-text-secondary);
    font-size: 20px;
}

/* ============ Kanban Tabs ============ */
.kanban-tabs {
    display: flex;
    background: rgba(118, 118, 128, 0.12);
    border-radius: 9px;
    padding: 2px;
    margin-bottom: 16px;
}

.kanban-tab {
    flex: 1;
    padding: 7px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
}

.kanban-tab.active {
    background: var(--color-surface);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12), 0 3px 1px rgba(0,0,0,0.04);
}

/* ============ Task List ============ */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.task-card:active {
    background: var(--color-bg);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #C7C7CC;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.task-checkbox.checked {
    background: var(--color-blue);
    border-color: var(--color-blue);
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 600;
}

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

.task-title {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 4px;
    word-wrap: break-word;
}

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

.task-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.task-due.overdue {
    color: var(--color-red);
    font-weight: 600;
}

.task-due.today {
    color: var(--color-blue);
    font-weight: 500;
}

.task-priority {
    width: 4px;
    border-radius: 2px;
    margin-right: 4px;
}

.task-priority.p1 { background: #C7C7CC; }
.task-priority.p2 { background: var(--color-blue); }
.task-priority.p3 { background: var(--color-orange); }
.task-priority.p4 { background: var(--color-red); }

/* ============ Team List ============ */
.team-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}

.team-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--color-blue), var(--color-indigo));
}

.team-info { flex: 1; }
.team-name { font-size: 17px; font-weight: 500; }
.team-role { font-size: 13px; color: var(--color-text-secondary); }

/* Pending Cards */
.pending-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 159, 10, 0.1);
    border: 1px solid rgba(255, 159, 10, 0.3);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 8px;
}

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

.btn-approve, .btn-reject {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    color: white;
    cursor: pointer;
}

.btn-approve { background: var(--color-green); }
.btn-reject { background: var(--color-red); }

/* ============ Bottom Tab Bar ============ */
.tab-bar {
    position: fixed;
    bottom: 24px;
    left: 16px;
    right: 16px;
    height: 64px;
    max-width: 400px;
    margin: 0 auto;
    background: var(--glass-thick);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 200;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: none;
    background: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    padding: 8px 16px;
}

.tab-item.active {
    color: var(--color-blue);
}

.tab-icon {
    font-size: 24px;
}

.tab-label {
    font-size: 10px;
    font-weight: 600;
}

/* ============ FAB ============ */
.fab {
    position: fixed;
    bottom: calc(100px + var(--safe-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 18px;
    background: var(--color-text);
    color: white;
    font-size: 32px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    cursor: pointer;
    z-index: 150;
    transition: transform 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

/* ============ Modals ============ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    align-items: flex-end;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
}

.modal-sheet {
    position: relative;
    width: 100%;
    max-height: 90vh;
    background: var(--color-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    animation: slideUp 0.35s ease;
}

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

.modal-handle {
    width: 36px;
    height: 5px;
    background: #E5E5EA;
    border-radius: 3px;
    margin: 8px auto 16px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 16px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--color-bg);
    font-size: 20px;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.modal-body {
    padding: 0 20px;
    overflow-y: auto;
    max-height: 55vh;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-bottom));
}

/* ============ Forms ============ */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.flex-1 { flex: 1; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    font-size: 17px;
    color: var(--color-text);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: 2px solid var(--color-blue);
    outline-offset: -2px;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* ============ Buttons ============ */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:active {
    opacity: 0.7;
}

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

.btn-secondary {
    flex: 1;
    background: var(--color-bg);
    color: var(--color-text);
}

/* ============ Pickers ============ */
.emoji-picker,
.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.emoji-option,
.color-option {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 24px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.emoji-option {
    background: var(--color-bg);
}

.emoji-option.selected,
.color-option.selected {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.3);
}

/* ============ Assignees Picker ============ */
.assignees-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.assignee-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-bg);
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    font-size: 15px;
}

.assignee-chip.selected {
    background: rgba(0, 122, 255, 0.1);
    border-color: var(--color-blue);
}

.assignee-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    background: var(--color-blue);
}

/* ============ Toast ============ */
.toast-container {
    position: fixed;
    bottom: calc(110px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
}

.toast {
    padding: 14px 24px;
    background: rgba(50, 50, 50, 0.9);
    backdrop-filter: blur(20px);
    color: white;
    border-radius: 20px;
    font-size: 15px;
    animation: toastIn 0.3s ease;
}

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

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

.empty-text {
    font-size: 15px;
}