﻿/* To-Do List Tile */
.todo-tile {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    padding: 16px;
    height: 100%;
    box-sizing: border-box;
}

/* Header */
.todo-tile__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.todo-tile__header-icon {
    color: #ef4444 !important;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    margin: 0;
}

.todo-tile__header-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #111827;
}

/* Loading */
.todo-tile__loading {
    display: flex;
    justify-content: center;
    padding: 32px 0;
}

/* Empty / All Completed State */
.todo-tile__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 16px;
    gap: 8px;
}

.todo-tile__empty-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.todo-tile__empty-icon md-icon {
    color: #16a34a;
    width: 28px;
    height: 28px;
}

.todo-tile__empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.todo-tile__empty-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* Task List */
.todo-tile__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Task Card */
.todo-task {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    transition: background-color 0.15s ease, transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.todo-task:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.todo-task__top-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* Icon Badge */
.todo-task__icon-badge {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid;
    flex-shrink: 0;
}

.todo-task__icon-badge md-icon {
    width: 20px;
    height: 20px;
}

/* Task Type Color Modifiers */
.todo-task--article .todo-task__icon-badge {
    background-color: #eff6ff;
    border-color: #bfdbfe;
}

.todo-task--article .todo-task__icon-badge md-icon {
    color: #2563eb;
}

.todo-task--video .todo-task__icon-badge {
    background-color: #fef2f2;
    border-color: #fecaca;
}

.todo-task--video .todo-task__icon-badge md-icon {
    color: #dc2626;
}

.todo-task--audio .todo-task__icon-badge {
    background-color: #faf5ff;
    border-color: #e9d5ff;
}

.todo-task--audio .todo-task__icon-badge md-icon {
    color: #9333ea;
}

.todo-task--flow .todo-task__icon-badge {
    background-color: #f0fdf4;
    border-color: #bbf7d0;
}

.todo-task--flow .todo-task__icon-badge md-icon {
    color: #16a34a;
}

.todo-task--offline .todo-task__icon-badge {
    background-color: #fff7ed;
    border-color: #fed7aa;
}

.todo-task--offline .todo-task__icon-badge md-icon {
    color: #ea580c;
}

/* Task Content */
.todo-task__content {
    flex: 1;
    min-width: 0;
}

.todo-task__title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin: 0;
    line-height: 1.4;
    padding-right: 0;
    word-wrap: break-word;
}

.todo-task__meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    flex-wrap: wrap;
}

.todo-task__meta-separator {
    margin: 0 2px;
}

.todo-task__due-date {
    color: #c2410c;
    font-weight: 500;
}

.todo-task__details-toggle {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    color: rgb(0, 121, 173);
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
}

.todo-task__details-toggle:hover {
    text-decoration: underline;
}

.todo-task__description {
    font-size: 13px;
    color: #374151;
    margin-top: 8px;
    line-height: 1.5;
}

.todo-task__description img {
    max-width: 100%;
    height: auto;
}

/* Coach chip */
.todo-task__coach-chip {
    float: right;
    margin-left: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 8px 12px;
    border-radius: 10px;
    background-color: #9810FA;
    color: #ffffff;
    white-space: nowrap;
}

.todo-task__coach-chip md-icon {
    height: 16px;
    width: 16px;
    min-height: 16px;
    min-width: 16px;
    fill: #FFF;
}

/* Task Actions */
.todo-task__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.todo-task__actions .todo-task__action-btn {
    flex: 1;
    margin: 0;
    background-color: rgb(0, 121, 173);
    color: white;
    min-width: 100px;
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    min-height: 32px;
    line-height: 32px;
    border-radius: 6px;
}

.todo-task__actions .todo-task__action-btn:hover {
    background-color: rgb(0, 105, 150);
}

.todo-task__actions .todo-task__delete-btn {
    margin: 0;
    min-width: 36px;
    min-height: 32px;
    line-height: 32px;
    padding: 0;
    border-radius: 6px;
    color: #6b7280;
}

.todo-task__actions .todo-task__delete-btn:hover {
    color: #dc2626;
    background-color: #fef2f2;
}

.todo-task__actions .todo-task__delete-btn md-icon {
    width: 18px;
    height: 18px;
    color: inherit;
}

/* View All Link */
.todo-tile__view-all {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: rgb(0, 121, 173);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.todo-tile__view-all:hover {
    text-decoration: underline;
}

/* Completion Animation */
.todo-task--completing {
    transform: scale(1.02);
    opacity: 0.8;
    box-shadow: 0 0 0 2px #16a34a;
}

.todo-task--completed {
    background-color: #f0fdf4;
}

.todo-task--completed .todo-task__icon-badge {
    background-color: #dcfce7 !important;
    border-color: #86efac !important;
}

.todo-task--completed .todo-task__icon-badge md-icon {
    color: #16a34a !important;
    transition: transform 0.3s ease;
    transform: scale(1.2) rotate(360deg);
}

.todo-task--completed .todo-task__title {
    text-decoration: line-through;
    color: #6b7280;
}

.todo-task__completed-msg {
    font-size: 13px;
    color: #16a34a;
    font-weight: 500;
    margin-top: 6px;
    display: none;
}

.todo-task--completed .todo-task__completed-msg {
    display: block;
}

.todo-task--completed .todo-task__actions {
    display: none;
}

.todo-task--removing {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Completed Task Items (View All - Completed Tab) */
.todo-task--completed-item .todo-task__icon-badge {
    background-color: #dcfce7;
    border-color: #86efac;
}

.todo-task--completed-item .todo-task__icon-badge md-icon {
    color: #16a34a;
}

.todo-task__title--completed {
    text-decoration: line-through;
    color: #6b7280;
}

.todo-task__review-btn.md-button {
    width: 100%;
    margin: 0;
    border: 1px solid #d1d5db;
    background-color: transparent;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    min-height: 32px;
    line-height: 32px;
    border-radius: 6px;
}

.todo-task__review-btn.md-button:hover {
    background-color: #f9fafb;
}

/* ==================== */
/* Dialog Shared Styles */
/* ==================== */

/* View All Dialog */
.todo-view-all-dialog {
    max-width: 672px;
    width: 90vw;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.todo-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}

.todo-dialog__header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.todo-dialog__header-icon {
    color: #ef4444 !important;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
}

.todo-dialog__header-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #111827;
}

.todo-dialog__close-btn.md-button {
    margin: 0;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    color: #6b7280;
    border-radius: 50%;
}

.todo-dialog__close-btn.md-button:hover {
    background-color: #f3f4f6;
}

.todo-dialog__close-btn md-icon {
    width: 20px;
    height: 20px;
}

/* Tab bar */
.todo-dialog__tabs {
    display: flex;
    padding: 0 26px 12px 12px;
}

.todo-dialog__tab.md-button {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    border-radius: 0;
    min-height: 40px;
    line-height: 40px;
    margin: 0 10px;
    padding: 0;
    min-width: 60px !important;
}

.todo-dialog__tab--active {
    background-color: rgb(0, 121, 173);
    color: white;
}

.todo-dialog__tab--active:hover {
    background-color: rgb(0, 105, 150);
}

.todo-dialog__tab--inactive {
    background-color: #f3f4f6;
    color: #374151;
}

.todo-dialog__tab--inactive:hover {
    background-color: #e5e7eb;
}

/* Scrollable content */
.todo-dialog__content {
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 400px;
}

.todo-dialog__list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Dialog Empty State */
.todo-dialog__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 16px;
    gap: 8px;
}

.todo-dialog__empty-icon {
    width: 48px;
    height: 48px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.todo-dialog__empty-icon md-icon {
    color: #16a34a;
    width: 28px;
    height: 28px;
}

.todo-dialog__empty-icon--muted {
    background: #f3f4f6;
}

.todo-dialog__empty-icon--muted md-icon {
    color: #9ca3af;
}

.todo-dialog__empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.todo-dialog__empty-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Action Dialog */
.todo-action-dialog {
    max-width: 672px;
    width: 90vw;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.todo-action-dialog .todo-modal-bckgnd {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 16px;
}

/* Fixed footer for flows inside the todo action dialog.
   Uses flex to fill available space so the button row stays at the
   bottom, and sticky positioning to pin it during scroll.
   .todo-modal-bckgnd remains the sole scroll container. */

.todo-action-dialog--flow .todo-modal-bckgnd {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

/* Neutralize inline contentMaxHeight styles, fill available space */
.todo-action-dialog--flow .todo-modal-bckgnd > div {
    overflow: visible !important;
    max-height: none !important;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.todo-action-dialog--flow flow-segment-display {
    padding-bottom: 0 !important;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.todo-action-dialog--flow flow-segment {
    height: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.todo-action-dialog--flow .flow-container {
    height: auto;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Flow content should not create its own scroll container */
.todo-action-dialog .flow-component-wrapper {
    max-height: none;
    overflow: visible;
}

/* Pin the action buttons at the bottom of the scroll area */
.todo-action-dialog--flow .flow-actions-button-row {
    position: sticky !important;
    bottom: 0;
    left: auto !important;
    right: auto !important;
    background: white;
    border-top: 1px solid #e0e0e0;
    box-shadow: none !important;
    z-index: 1;
}

.todo-action-dialog__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.todo-action-dialog__icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-action-dialog__icon md-icon {
    width: 20px;
    height: 20px;
}

.todo-action-dialog__title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
    padding: 0 10px;
}

.todo-action-dialog__meta {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

.todo-action-dialog__placeholder {
    background-color: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 20px;
}

.todo-action-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.todo-action-dialog__actions md-button {
    margin: 0;
    text-transform: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    min-height: 36px;
    line-height: 36px;
}

.todo-action-dialog__cancel {
    border: 1px solid #d1d5db;
    color: #374151;
}

.todo-action-dialog__cancel:hover {
    background-color: #f9fafb;
}

.todo-action-dialog__complete {
    background-color: rgb(0, 121, 173) !important;
    color: white !important;
}

.todo-action-dialog__complete:hover {
    background-color: rgb(0, 105, 150) !important;
}

/* Delete Confirmation Dialog */
.todo-delete-dialog {
    max-width: 400px;
    width: 90vw;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.todo-delete-dialog__icon-wrapper {
    width: 48px;
    height: 48px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.todo-delete-dialog__icon-wrapper md-icon {
    color: #dc2626;
    width: 24px;
    height: 24px;
}

.todo-delete-dialog__title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    text-align: center;
    margin: 0 0 8px;
}

.todo-delete-dialog__warning {
    font-size: 14px;
    color: #6b7280;
    text-align: center;
    margin: 0 0 16px;
}

.todo-delete-dialog__preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 20px;
}

.todo-delete-dialog__preview-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.todo-delete-dialog__preview-icon md-icon {
    width: 16px;
    height: 16px;
}

.todo-delete-dialog__preview-info {
    flex: 1;
    min-width: 0;
}

.todo-delete-dialog__preview-title {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.todo-delete-dialog__preview-time {
    font-size: 12px;
    color: #6b7280;
    margin: 2px 0 0;
}

.todo-delete-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.todo-delete-dialog__actions md-button {
    margin: 0;
    text-transform: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    min-height: 36px;
    line-height: 36px;
}

.todo-delete-dialog__cancel-btn {
    border: 1px solid #d1d5db;
    color: #374151;
}

.todo-delete-dialog__cancel-btn:hover {
    background-color: #f9fafb;
}

.todo-delete-dialog__remove-btn {
    background-color: #dc2626 !important;
    color: white !important;
}

.todo-delete-dialog__remove-btn:hover {
    background-color: #b91c1c !important;
}

/* Panel backdrop overlay */
.md-panel-outer-wrapper:has(.todo-dialog-panel) > md-backdrop {
    background-color: rgba(255, 255, 255, 0.5) !important;
}

@media (max-width: 480px) {
    .todo-dialog-panel {
        width: 100%;
        height: 100%;
        max-height: 100%;
    }

    .todo-action-dialog,
    .todo-view-all-dialog {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        padding: 16px;
    }

    .todo-dialog__content {
        max-height: none !important;
    }

    .todo-dialog__tabs {
        padding: 8px 12px !important;
        padding-bottom: 24px !important;
    }

    .todo-dialog-panel .content-display {
        padding: 16px !important;
    }
}
