/* ==========================================================================
   MY PROGRESS — Bottom Sheet Drawer
   ========================================================================== */

/* ---------- Drawer Container + Overlay ---------- */
.progress-drawer {
    position: fixed;
    inset: 0;
    z-index: 100010;
    pointer-events: none;
    visibility: hidden;
}

.progress-drawer.open {
    pointer-events: all;
    visibility: visible;
}

.progress-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progress-drawer.open .progress-drawer-overlay {
    opacity: 1;
}

/* ---------- Bottom Sheet Panel ---------- */
.progress-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 75vh;
    max-height: 85vh;
    background: var(--surface-white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.progress-drawer.open .progress-sheet {
    transform: translateY(0);
}

/* Desktop: centered modal */
@media (min-width: 769px) {
    .progress-sheet {
        left: 50%;
        right: auto;
        bottom: auto;
        top: 50%;
        max-width: 440px;
        width: 440px;
        height: 580px;
        max-height: 80vh;
        border-radius: var(--radius-lg);
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .progress-drawer.open .progress-sheet {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ---------- Drag Handle ---------- */
.progress-drag-handle {
    display: flex;
    justify-content: center;
    padding: 0.75rem 0 0.25rem;
    flex-shrink: 0;
}

.progress-drag-handle span {
    width: 36px;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
}

@media (min-width: 769px) {
    .progress-drag-handle { display: none; }
}

/* ---------- View Stack / Viewport ---------- */
.progress-viewport {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.progress-view-stack {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.progress-view-stack.no-transition {
    transition: none !important;
}

.progress-view {
    position: absolute;
    inset: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(12px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.progress-view-stack.no-transition .progress-view {
    transition: none !important;
}

.progress-view.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

/* ---------- View Headers ---------- */
.progress-view-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    min-height: 52px;
}

.progress-view-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.progress-view-title h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.progress-view-title i {
    color: var(--primary-blue);
    flex-shrink: 0;
}

.progress-view-title span {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.progress-close:hover {
    color: var(--text-main);
}

.progress-back {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s;
}

.progress-back:hover {
    color: var(--primary-navy);
}

/* ---------- View Body ---------- */
.progress-view-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    -webkit-overflow-scrolling: touch;
}

/* ---------- Home View: Overview ---------- */
.progress-overview-bar {
    height: 8px;
    background: var(--bg-off-white);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-overview-fill {
    height: 100%;
    background: var(--success-green);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.progress-overview-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* Section Cards */
.progress-section-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.progress-section-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-off-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    font-family: inherit;
    width: 100%;
}

.progress-section-card:hover {
    border-color: var(--primary-blue);
    background: white;
}

.progress-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.progress-card-info {
    flex: 1;
    min-width: 0;
}

.progress-card-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.progress-card-subtitle {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.progress-card-chevron {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Home Footer */
.progress-home-footer {
    text-align: center;
}

.progress-privacy {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.progress-privacy i {
    margin-right: 0.25rem;
}

.progress-reset-btn {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.progress-reset-btn:hover {
    background: var(--alert-red);
    border-color: var(--alert-red);
    color: white;
}

/* ---------- Checklist View ---------- */
.progress-checklist-content {
    padding: 0;
}

.progress-mini-bar {
    height: 6px;
    background: var(--bg-off-white);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.progress-mini-fill {
    height: 100%;
    background: var(--success-green);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-mini-text {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.progress-check-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.15s;
}

.progress-check-item:last-child {
    border-bottom: none;
}

.progress-check-item:hover {
    background: var(--bg-off-white);
}

.progress-check-item input[type="checkbox"] {
    accent-color: var(--success-green);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.progress-check-item span {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.4;
}

.progress-check-item.checked span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* ---------- Timeline View ---------- */
.progress-timeline-content {
    padding: 0;
}

.progress-timeline {
    position: relative;
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

.progress-timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-subtle);
}

.progress-step {
    position: relative;
    padding-bottom: 1.25rem;
}

.progress-step:last-child {
    padding-bottom: 0;
}

.progress-step-marker {
    position: absolute;
    left: -1.5rem;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-white);
    border: 2px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.progress-step-marker i {
    font-size: 0.6rem;
    color: white;
}

.progress-step.complete .progress-step-marker {
    background: var(--success-green);
    border-color: var(--success-green);
}

.progress-step.next .progress-step-marker {
    border-color: var(--primary-blue);
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(30, 64, 175, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(30, 64, 175, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .progress-step.next .progress-step-marker {
        animation: none;
    }
}

.progress-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-subtle);
}

.progress-step.next .progress-step-dot {
    background: var(--primary-blue);
}

.progress-step-body {
    background: var(--bg-off-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-left: 0.5rem;
}

.progress-step.complete .progress-step-body {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.05);
}

.progress-step.next .progress-step-body {
    border-color: rgba(30, 64, 175, 0.3);
}

.progress-step-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.progress-step-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.progress-optional {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
}

.progress-step-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}

.progress-step-toggle input[type="checkbox"] {
    accent-color: var(--success-green);
    cursor: pointer;
}

.progress-step-body p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.35rem;
    line-height: 1.4;
}

.progress-step-date {
    font-size: 0.75rem;
    color: var(--success-green);
    display: block;
    margin-bottom: 0.25rem;
}

.progress-step-link {
    font-size: 0.8rem;
    color: var(--primary-blue);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.15s;
}

.progress-step-link:hover {
    color: var(--primary-navy);
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] .progress-sheet {
    background: #1e293b;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .progress-drawer-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .progress-drag-handle span {
    background: #475569;
}

[data-theme="dark"] .progress-view-header {
    border-bottom-color: #334155;
}

/* ---------- Print ---------- */
@media print {
    .progress-drawer {
        display: none !important;
    }
}
