/* =====================
   아이젠하워 매트릭스 스타일
   ===================== */

#matrix-container {
    width: 100%;
    height: 100%;
    display: none;
    padding: 16px;
}

.matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr 1fr;
    gap: 12px;
    height: 100%;
}

.matrix-header {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4px 8px;
}

.matrix-header h2 {
    font-size: 16px;
    color: #333;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 뷰 전환 컨트롤 */
.matrix-view-controls {
    display: flex;
    gap: 4px;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 10px;
    margin: 0 auto;
}

.matrix-view-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.matrix-view-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #333;
}

.matrix-view-btn.active {
    background: white;
    color: #1a73e8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Task List 뷰 스타일 */
.matrix-tasklist-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    grid-column: 1 / -1;
    grid-row: 2 / 4;
}

.matrix-tasklist-bucket {
    border-radius: 12px;
    padding: 12px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border: 1px solid #ddd;
    transition: all 0.2s;
}

.matrix-tasklist-bucket.drag-over {
    outline: 2px dashed #1a73e8;
    background: rgba(26, 115, 232, 0.05);
}

.bucket-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
}

.bucket-count {
    font-size: 12px;
    font-weight: normal;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.bucket-tasks {
    flex: 1;
    overflow-y: auto;
}

.bucket-empty {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 30px 10px;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

.help-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #666;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.help-btn:hover {
    background: #e0e0e0;
}

.matrix-help {
    font-size: 12px;
    color: #666;
    padding: 8px 12px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-top: 8px;
}

.matrix-help code {
    background: #e8e8e8;
    padding: 1px 4px;
    border-radius: 3px;
}

.label-urgent {
    background: #fce4ec;
    color: #c62828;
}

.label-important {
    background: #e3f2fd;
    color: #1565c0;
}

/* Tag Guide */
.tag-guide {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

.tag-guide code {
    background: #f5f5f5;
    padding: 1px 4px;
    border-radius: 3px;
}

/* =====================
   Quadrants
   ===================== */

.matrix-quadrant {
    border-radius: 12px;
    padding: 12px;
    overflow-y: auto;
}

.quadrant-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quadrant-count {
    font-size: 12px;
    font-weight: normal;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Q1 - 긴급 & 중요 */
.quadrant-q1 {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

.quadrant-q1 .quadrant-header {
    color: #c62828;
    border-color: #ef5350;
}

.quadrant-q1 .matrix-task {
    border-color: #ef5350;
}

/* Q2 - 중요 (긴급X) */
.quadrant-q2 {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.quadrant-q2 .quadrant-header {
    color: #1565c0;
    border-color: #42a5f5;
}

.quadrant-q2 .matrix-task {
    border-color: #42a5f5;
}

/* Q3 - 긴급 (중요X) */
.quadrant-q3 {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.quadrant-q3 .quadrant-header {
    color: #e65100;
    border-color: #ff9800;
}

.quadrant-q3 .matrix-task {
    border-color: #ff9800;
}

/* Q4 - 나중에 */
.quadrant-q4 {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

.quadrant-q4 .quadrant-header {
    color: #616161;
    border-color: #9e9e9e;
}

.quadrant-q4 .matrix-task {
    border-color: #9e9e9e;
}

/* =====================
   Matrix Task Items
   ===================== */

.matrix-task {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 12px 10px 8px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    border-left: 3px solid;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.matrix-task:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.matrix-task:active {
    cursor: grabbing;
}

.matrix-task.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.matrix-task.completed {
    opacity: 0.6;
}

.matrix-task.completed .task-title {
    text-decoration: line-through;
}

/* Drag Handle */
/* 매트릭스 원형 체크박스 */
.matrix-checkbox {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    color: #ddd;
}

.matrix-checkbox:hover {
    border-color: #1a73e8;
    background: #f0f7ff;
    color: #1a73e8;
}

.matrix-checkbox.checked {
    border-color: #1a73e8;
    background: #1a73e8;
    color: #1a73e8;
}

.matrix-checkbox.checked:hover {
    background: #1557b0;
    border-color: #1557b0;
}

.drag-handle {
    color: #bbb;
    font-size: 12px;
    cursor: grab;
    user-select: none;
    padding: 2px 0;
    line-height: 1;
    transition: color 0.2s;
}

.matrix-task:hover .drag-handle {
    color: #888;
}

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

/* Task Content */
.task-content {
    flex: 1;
    min-width: 0;
}

.matrix-task .task-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.matrix-task .task-meta {
    font-size: 11px;
    color: #666;
    display: flex;
    gap: 8px;
}

.matrix-task .task-tags {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

/* 태그 스타일 */
.matrix-task .task-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.matrix-task .task-tag.urgent {
    background: #ffebee;
    color: #c62828;
}

.matrix-task .task-tag.important {
    background: #e3f2fd;
    color: #1565c0;
}

.matrix-task .task-tag.pmi {
    background: #f3e5f5;
    color: #9c27b0;
}

.matrix-task .task-tag.personal {
    background: #fff3e0;
    color: #ef6c00;
}

.matrix-task .task-tag.hashtag {
    background: #f3e5f5;
    color: #7b1fa2;
}

.matrix-task .task-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: none;
    gap: 4px;
}

.matrix-task:hover .task-actions {
    display: flex;
}

/* =====================
   Drag & Drop States
   ===================== */

.matrix-quadrant.can-drop {
    outline: 2px dashed transparent;
    transition: outline 0.2s, background 0.2s;
}

.matrix-quadrant.drag-over {
    outline: 2px dashed #1a73e8;
    background: rgba(26, 115, 232, 0.05);
}

.matrix-quadrant.drag-over .quadrant-tasks {
    min-height: 60px;
}

/* Empty State */
.matrix-empty {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 30px 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    transition: all 0.2s;
}

.matrix-quadrant.drag-over .matrix-empty {
    border-color: #1a73e8;
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.1);
}

/* =====================
   Mobile Swipe Styles
   ===================== */

.matrix-task {
    position: relative;
    overflow: hidden;
}

.matrix-task.swiping-left {
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.2) 0%, rgba(255, 255, 255, 0.9) 30%);
}

.matrix-task.swiping-right {
    background: linear-gradient(270deg, rgba(33, 150, 243, 0.2) 0%, rgba(255, 255, 255, 0.9) 30%);
}

.matrix-task.swiping-left::before {
    content: '✓ 완료';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #4caf50;
    font-weight: 600;
    font-size: 14px;
}

.matrix-task.swiping-right::after {
    content: '📌 이동';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #2196f3;
    font-weight: 600;
    font-size: 14px;
}

/* =====================
   Quadrant Selection Modal
   ===================== */

.quadrant-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.quadrant-modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    overflow: hidden;
    animation: slideUp 0.2s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.quadrant-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    color: #333;
}

.quadrant-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 4px;
}

.quadrant-modal-options {
    padding: 8px;
}

.quadrant-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    margin: 4px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fafafa;
}

.quadrant-option:hover {
    background: #f0f0f0;
    transform: translateX(4px);
}

.quadrant-option:active {
    transform: scale(0.98);
}

.quadrant-emoji {
    font-size: 24px;
}

.quadrant-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

/* Mobile Touch Hint */
@media (max-width: 768px) {
    .matrix-task {
        touch-action: pan-y pinch-zoom;
    }

    .drag-handle {
        display: none;
    }

    .matrix-task::before,
    .matrix-task::after {
        pointer-events: none;
    }

    .matrix-task.swiping-active {
        background: linear-gradient(90deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.15), rgba(33, 150, 243, 0.1));
        box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
    }
}

/* =====================
   Task Action Panel (통합 액션 패널)
   ===================== */

.task-action-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 1001;
    animation: fadeIn 0.2s ease;
}

.task-action-panel {
    background: white;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}

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

    to {
        transform: translateY(0);
    }
}

/* 패널 헤더 - Task 제목 */
.panel-task-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.panel-task-icon {
    font-size: 28px;
}

.panel-task-title {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
}

.panel-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.panel-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 현재 분면 표시 */
.panel-current-quadrant {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

/* 섹션 타이틀 */
.panel-section-title {
    padding: 12px 20px 8px;
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

/* 분면 이동 그리드 */
.panel-quadrant-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 16px 16px;
}

.panel-quadrant-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.panel-quadrant-btn:hover {
    transform: translateX(4px);
}

.panel-quadrant-btn:active {
    transform: scale(0.98);
}

.panel-q-emoji {
    font-size: 22px;
}

.panel-q-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

/* 완료 버튼 섹션 */
.panel-complete-section {
    padding: 0 16px 24px;
    border-top: 1px solid #eee;
    margin-top: 8px;
    padding-top: 16px;
}

.panel-complete-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.panel-complete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.panel-complete-btn:active {
    transform: translateY(0);
}

.panel-complete-btn.completed {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.panel-complete-btn.completed:hover {
    box-shadow: 0 6px 16px rgba(255, 152, 0, 0.4);
}

.complete-icon {
    font-size: 20px;
}

.complete-text {
    font-size: 16px;
}