/**
 * SubmitFox Filing Tunnel CSS
 * 
 * This stylesheet controls visibility and styling during the Filing Tunnel.
 * The tunnel is a focused, no-escape checkout flow that maximizes conversion.
 * 
 * Modes:
 * - mode-tunnel: User is in filing flow (pre-submission)
 * - mode-focused: Wizard-specific focus (hides chrome)
 * - mode-app: Post-submission dashboard mode
 * - mode-marketing: Public marketing pages
 */

/* ===================================================================
   TUNNEL MODE: Hide everything except the filing flow
   =================================================================== */

/* Hide main navigation and chrome */
body.mode-tunnel .header,
body.mode-tunnel .nav-main,
body.mode-tunnel .auth-buttons,
body.mode-tunnel footer,
body.mode-tunnel .app-layout-header,
body.mode-tunnel .app-layout-footer {
    display: none !important;
}

/* Hide dashboard and all its elements */
body.mode-tunnel #section-dashboard,
body.mode-tunnel #hmrcConnectionCard,
body.mode-tunnel #myReturnsCard,
body.mode-tunnel #purchaseBanner,
body.mode-tunnel #purchasedReturnsContainer,
body.mode-tunnel .dashboard-stats,
body.mode-tunnel .quick-stats {
    display: none !important;
}

/* Hide marketing sections */
body.mode-tunnel #section-landing,
body.mode-tunnel #section-howitworks,
body.mode-tunnel #section-pricing,
body.mode-tunnel #section-whoisthisfor {
    display: none !important;
}

/* Hide upgrade/purchase modals during tunnel */
body.mode-tunnel #upgradeModal,
body.mode-tunnel .upgrade-prompt {
    display: none !important;
}

/* Allow focused header (wizard header) to show */
body.mode-tunnel .focused-header {
    display: flex !important;
}

/* Prevent accidental escape from tunnel via logo click */
body.mode-tunnel .focused-logo {
    pointer-events: none;
    opacity: 0.9;
    cursor: default;
}

/* Keep FoxChat visible during tunnel (it helps completion) */
body.mode-tunnel .foxchat-widget,
body.mode-tunnel #foxchatWidget,
body.mode-tunnel #foxchatPanel {
    display: block !important;
}

/* ===================================================================
   TUNNEL HEADER PILL: Shows price and payment status
   =================================================================== */

.tunnel-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #111827;
    color: #ffffff;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    margin-left: auto;
}

.tunnel-pill .muted {
    opacity: 0.8;
    font-weight: 500;
}

.tunnel-pill.locked {
    background: #111827;
}

.tunnel-pill.locked::before {
    content: "🔒";
    margin-right: 0.25rem;
}

.tunnel-pill.unlocked {
    background: #065f46;
}

.tunnel-pill.unlocked::before {
    content: "✓";
    margin-right: 0.25rem;
}

/* Mobile: smaller pill */
@media (max-width: 640px) {
    .tunnel-pill {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ===================================================================
   COMMITMENT GATE: The pre-wizard commitment screen
   =================================================================== */

#section-tunnel-commit {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.commitment-card {
    max-width: 520px;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.commitment-header {
    background: linear-gradient(135deg, var(--fox) 0%, #f97316 100%);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.commitment-header h2 {
    color: white;
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.commitment-header .period-label {
    opacity: 0.9;
    font-size: 1rem;
}

.commitment-body {
    padding: 2rem;
}

.commitment-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.commitment-detail {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.commitment-detail-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.commitment-detail-text {
    flex: 1;
}

.commitment-detail-text strong {
    display: block;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.commitment-detail-text span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.commitment-reassurance {
    text-align: center;
    padding: 1rem;
    background: #ecfdf5;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    color: #065f46;
    font-size: 0.9375rem;
}

.commitment-reassurance svg {
    vertical-align: middle;
    margin-right: 0.25rem;
}

.commitment-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.commitment-actions .btn-primary {
    width: 100%;
    padding: 1rem;
    font-size: 1.0625rem;
    font-weight: 600;
}

.commitment-actions .btn-secondary-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: underline;
}

.commitment-actions .btn-secondary-link:hover {
    color: var(--text-primary);
}

/* ===================================================================
   PERIOD SELECTOR: Choose filing period screen
   =================================================================== */

#section-tunnel-period {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    padding: 2rem;
}

.period-selector-card {
    max-width: 480px;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.period-selector-card h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.375rem;
}

.period-selector-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.period-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.period-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.period-option:hover {
    border-color: var(--fox);
    background: #fff7ed;
}

.period-option.selected {
    border-color: var(--fox);
    background: #fff7ed;
}

.period-option input[type="radio"] {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    accent-color: var(--fox);
}

.period-option-label {
    flex: 1;
}

.period-option-label strong {
    display: block;
    font-size: 1rem;
}

.period-option-label span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.period-option .filed-badge {
    background: #d1fae5;
    color: #065f46;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===================================================================
   RETURN TYPE SELECTOR: Choose return type screen
   =================================================================== */

#section-tunnel-picker {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    padding: 2rem;
}

.return-picker-card {
    max-width: 600px;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
}

.return-picker-card h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    text-align: center;
}

.return-picker-card .subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

.return-type-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.return-type-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: white;
}

.return-type-card:hover {
    border-color: var(--fox);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.return-type-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.return-type-icon.vat {
    background: #dbeafe;
    color: #1d4ed8;
}

.return-type-icon.sa {
    background: #dcfce7;
    color: #16a34a;
}

.return-type-icon.ct {
    background: #ffedd5;
    color: #ea580c;
}

.return-type-info {
    flex: 1;
}

.return-type-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.125rem;
}

.return-type-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.return-type-price {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
}

/* ===================================================================
   HMRC CONNECTION STEP (Inside Tunnel)
   =================================================================== */

.tunnel-hmrc-connect {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

.tunnel-hmrc-connect h3 {
    margin-bottom: 1rem;
}

.tunnel-hmrc-connect p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.tunnel-hmrc-features {
    text-align: left;
    background: #f8fafc;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.tunnel-hmrc-features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.tunnel-hmrc-features li:last-child {
    margin-bottom: 0;
}

.tunnel-hmrc-features li svg {
    color: var(--hmrc-green);
    flex-shrink: 0;
}

.tunnel-hmrc-connect .btn {
    width: 100%;
}

/* ===================================================================
   PAYMENT MODAL (Pre-submission)
   =================================================================== */

.payment-modal-content {
    max-width: 440px;
}

.payment-summary {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.payment-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.payment-summary-row:last-child {
    margin-bottom: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
    font-weight: 700;
    font-size: 1.125rem;
}

.payment-reassurance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

.payment-reassurance svg {
    color: var(--hmrc-green);
}

/* ===================================================================
   AMENDMENT TUNNEL: Visual differentiation
   =================================================================== */

body.mode-amendment .focused-header {
    background: #f3f4f6;
    border-bottom: 2px solid #9ca3af;
}

body.mode-amendment .focused-header::after {
    background: linear-gradient(90deg, #6b7280 0%, #9ca3af 100%);
}

.amendment-banner {
    background: #f3f4f6;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #d1d5db;
}

.amendment-banner-icon {
    font-size: 1.25rem;
}

.amendment-banner-text {
    flex: 1;
    font-size: 0.875rem;
}

.amendment-banner-text strong {
    display: block;
    color: var(--text-primary);
}

.amendment-banner-text span {
    color: var(--text-muted);
}

.amendment-banner-free {
    background: #dcfce7;
    color: #166534;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Show amendment banner only in mode-amendment */
body.mode-amendment #amendmentBanner {
    display: flex !important;
}

/* Hide tunnel price pill in amendment mode (amendments are free) */
body.mode-amendment #tunnelHeaderPill {
    display: none !important;
}

/* Amendment changes indicator */
.field-changed {
    position: relative;
}

.field-changed::after {
    content: "Changed";
    position: absolute;
    top: 0;
    right: 0;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

.original-value {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.original-value::before {
    content: "Original: ";
}

/* ===================================================================
   NEW DASHBOARD: Single Mission Layout
   =================================================================== */

/* Section A: Status (calm, non-interactive) */
.dashboard-status {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.dashboard-status h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.dashboard-status .status-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.dashboard-status .status-message.up-to-date {
    color: var(--hmrc-green);
}

.dashboard-status .status-message.action-needed {
    color: var(--fox);
}

/* Section B: The Mission (one card, one CTA) */
.dashboard-mission {
    margin-bottom: 1.5rem;
}

.mission-card {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 2px solid var(--fox);
    border-radius: 12px;
    padding: 1.5rem;
}

.mission-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.mission-card-title {
    margin: 0;
    font-size: 1.125rem;
}

.mission-card-status {
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fox);
}

.mission-card-body {
    margin-bottom: 1rem;
}

.mission-next-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.mission-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.mission-card-actions {
    display: flex;
    justify-content: flex-end;
}

.mission-card-actions .btn {
    font-weight: 600;
}

/* Other drafts link (quiet) */
.other-drafts-link {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Section C: History & Proof (quiet, boring, read-only) */
.dashboard-history {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.5rem;
}

.dashboard-history h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-item-info {
    flex: 1;
    min-width: 200px;
}

.history-item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.history-item-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.history-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.history-item-actions .btn {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
}

/* Amend link - quieter styling */
.btn-amend {
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-light);
}

.btn-amend:hover {
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Empty state for history */
.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* ===================================================================
   RESPONSIVE ADJUSTMENTS
   =================================================================== */

@media (max-width: 640px) {
    .commitment-body {
        padding: 1.5rem;
    }
    
    .commitment-header {
        padding: 1.25rem 1.5rem;
    }
    
    .return-picker-card,
    .period-selector-card {
        padding: 1.5rem;
    }
    
    .return-type-card {
        padding: 1rem;
    }
    
    .return-type-icon {
        width: 40px;
        height: 40px;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .history-item-actions {
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* ===================================================================
   ANIMATIONS
   =================================================================== */

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

.tunnel-animate-in {
    animation: tunnelSlideIn 0.3s ease;
}

/* Price pulse on payment screen */
@keyframes pricePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.payment-amount {
    animation: pricePulse 2s ease-in-out infinite;
}
