/* ============================================================================
   WEEKLY PLANNER AI MODAL
   ============================================================================ */

/* Backdrop */
.wp-backdrop {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay-bg);
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-slow) var(--ease-in-out);
}

.wp-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal */
.wp-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    z-index: calc(var(--z-modal) + 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Phase 2 — Step 0 "Inbox to Zero" + suspend state.
   Suspended = hidden but ALIVE: the fetched plan (a paid cloud call)
   survives while the Phase-1 inbox processor owns the screen.
   visibility (not display) keeps layout/scroll state for instant resume. */
.wp-modal.wp-suspended,
.wp-backdrop.wp-suspended {
    visibility: hidden;
}

.wp-step-inbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    padding: 32px 24px;
}

.wp-inbox-prompt {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.wp-inbox-prompt svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #4A90D9;
}

.wp-inbox-clarify-btn {
    min-height: 44px;
    padding: 10px 24px;
}

.wp-inbox-zero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Success #10B981 — reserved for TRUE ZERO only (spec §7). 200ms fade. */
.wp-inbox-tick {
    color: var(--color-green-text);
    font-size: var(--font-size-2xl);
    line-height: 1;
    opacity: 0;
    animation: wp-tick-fade var(--duration-normal) var(--ease-in-out) forwards;
}

@keyframes wp-tick-fade {
    to { opacity: 1; }
}

.wp-inbox-zero-headline {
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
}

.wp-inbox-zero-sub {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    font-style: italic;
}

/* Fail-forward plan error rendered UNDER Step 0 (never clobbering it). */
.wp-error-inline {
    margin-top: 24px;
    padding: 16px;
}

/* Header */
.wp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.wp-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wp-header-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

.wp-header-icon svg {
    width: 100%;
    height: 100%;
}

.wp-header-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
}

.wp-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all var(--duration-normal) var(--ease-in-out);
}

.wp-close-btn svg {
    width: 18px;
    height: 18px;
}

.wp-close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Progress dots */
.wp-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    flex-shrink: 0;
}

.wp-step-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-circle);
    background: var(--border-light);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-in-out);
}

.wp-step-dot.active {
    width: 24px;
    border-radius: var(--radius-sm);
    background: var(--accent-blue);
}

.wp-step-dot.completed {
    background: var(--accent-blue);
    opacity: 0.5;
}

/* Body */
.wp-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Loading */
.wp-loading,
.wp-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: 16px;
}

.wp-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-blue);
    border-radius: var(--radius-circle);
    animation: dp-spin 0.8s linear infinite;
}

.wp-loading p,
.wp-error p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
}

/* Footer */
.wp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.wp-step-label {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    font-weight: 500;
}

.wp-btn {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-in-out);
    min-height: 36px;
}

.wp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.wp-btn-primary:hover:not(:disabled) {
    background: var(--accent-fill-hover);
}

.wp-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.wp-btn-secondary:hover {
    background: var(--border-light);
}

/* Step common */
.wp-step {
    min-height: 200px;
}

.wp-step-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 16px 0;
}

.wp-section {
    margin-top: 16px;
}

.wp-section-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.wp-empty {
    color: var(--text-tertiary);
    font-style: italic;
}
