/* ===== Welcome Hero Section (v88, updated v89) ===== */
/* Fonts for showcase swatches are loaded dynamically by showcase-config.js */

.welcome-hero {
    background: #fafbfc;
    border: 1px solid #d0d7de;
    border-top: 3px solid #111;
    border-radius: 0 0 12px 12px;
    margin-bottom: 1.5rem;
    padding: 25px 40px 20px;
    text-align: center;
    position: relative;

    /* Insulation from themes */
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    color: #24292f !important;
}

/* --- Close Button (×) --- */
.welcome-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none !important;
    border: none !important;
    font-size: 1.6rem !important;
    line-height: 1 !important;
    color: #8b949e !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    transition: color 0.15s ease, background 0.15s ease !important;
    font-family: 'Inter', sans-serif !important;
    height: auto !important;
    width: auto !important;
}

.welcome-close:hover {
    color: #24292f !important;
    background: rgba(0, 0, 0, 0.06) !important;
}

/* --- Heading --- */
.welcome-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    letter-spacing: -0.5px;
    color: #111 !important;
}

.welcome-subtitle {
    font-size: 1.15rem;
    color: #57606a !important;
    margin: 0 0 20px 0;
    font-weight: 400;
    line-height: 1.5;
}

/* ===== Calendar Swatch Cards (v89) ===== */
.welcome-showcase {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.showcase-card {
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.showcase-card:hover {
    transform: translateY(-4px);
}

.showcase-card:hover .showcase-swatch {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18) !important;
}

/* The swatch container — mimics a real month card */
.showcase-swatch {
    width: 140px;
    height: 165px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 10px 8px 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.25s ease;
    box-sizing: border-box;
}

/* Month title — rendered in each theme's actual font */
.swatch-month {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 6px;
    line-height: 1.2;
    white-space: nowrap;
}

/* Sunset gradient text effect */
.swatch-month-gradient {
    background: linear-gradient(90deg, #ff6f00, #d81b60);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Weekday header row */
.swatch-weekdays {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    text-align: center;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    padding-bottom: 4px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    letter-spacing: 0.5px;
}

/* Day number grid — 4 columns to match the cropped swatch look */
.swatch-days {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    text-align: center;
    font-size: 0.8rem;
    gap: 0;
    flex: 1;
    align-content: start;
}

.swatch-days span {
    padding: 5px 0;
    line-height: 1.3;
}

/* Grid variant: 1px borders without doubling */
.swatch-days-grid {
    border-top: 1px solid var(--grid-color, #ccc);
    border-left: 1px solid var(--grid-color, #ccc);
    flex-grow: 0; /* Prevents the left border from stretching past the bottom cells */
}
.swatch-days-grid span {
    border-bottom: 1px solid var(--grid-color, #ccc);
    border-right: 1px solid var(--grid-color, #ccc);
}

/* Inherit borders to inner cells without doubling up */
.swatch-days-inherit-border {
    align-content: stretch;
}
.swatch-days-inherit-border span {
    border-bottom: inherit;
    border-right: inherit;
}
/* Remove inner borders that touch the outer container */
.swatch-days-inherit-border span:nth-child(4n) {
    border-right: none;
}
.swatch-days-inherit-border span:nth-last-child(-n+4) {
    border-bottom: none;
}

/* Gapped Grid variant (floating tiles) */
.swatch-days-tiles {
    gap: 3px;
    padding: 0 4px 4px 4px;
}
.swatch-days-tiles span {
    background-color: var(--tile-bg, transparent);
    border: var(--tile-border, none);
    border-radius: var(--tile-radius, 0);
}

.showcase-name {
    margin-top: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #57606a !important;
    font-family: 'Inter', sans-serif;
}

/* --- How It Works Steps --- */
.welcome-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.welcome-step {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 12px 18px;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

.step-text {
    font-size: 0.85rem;
    text-align: left;
    line-height: 1.3;
    color: #24292f !important;
    font-family: 'Inter', sans-serif;
}

.step-text strong {
    font-weight: 700;
    color: #111 !important;
}

.step-arrow {
    font-size: 1.2rem;
    color: #aaa;
    font-weight: 300;
}

/* --- CTA Buttons --- */
.welcome-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.welcome-cta-primary {
    background: #111 !important;
    color: #fff !important;
    border: 2px solid #111 !important;
    padding: 12px 28px !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    font-family: 'Inter', sans-serif !important;
    transition: background 0.2s ease, transform 0.15s ease !important;
}

.welcome-cta-primary:hover {
    background: #333 !important;
    transform: translateY(-1px);
}

.welcome-cta-secondary {
    background: #fff !important;
    color: #111 !important;
    border: 2px solid #d0d7de !important;
    padding: 12px 28px !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    font-family: 'Inter', sans-serif !important;
    transition: all 0.2s ease !important;
}

.welcome-cta-secondary:hover {
    border-color: #111 !important;
    background: #f6f8fa !important;
    transform: translateY(-1px);
}

/* --- Dismiss --- */
.welcome-dismiss {
    padding-top: 10px;
    border-top: 1px solid #e1e4e8;
}

.welcome-dismiss label {
    font-size: 0.8rem;
    color: #8b949e !important;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.welcome-dismiss input[type="checkbox"] {
    cursor: pointer;
}

/* --- Print Hiding --- */
@media print {
    .welcome-hero {
        display: none !important;
    }
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .welcome-hero {
        padding: 30px 20px 25px;
    }

    .welcome-title {
        font-size: 1.6rem;
    }

    .welcome-showcase {
        gap: 12px;
    }

    .showcase-swatch {
        width: 125px;
        height: 155px;
        padding: 10px 8px 6px;
    }

    .swatch-month {
        font-size: 0.8rem;
    }

    .swatch-days {
        font-size: 0.75rem;
    }

    .welcome-steps {
        flex-direction: column;
        gap: 8px;
    }

    .step-arrow {
        transform: rotate(90deg);
    }

    .welcome-actions {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 600px) {
    .welcome-showcase {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .showcase-card {
        flex-shrink: 0;
    }
}

/* --- Entrance Animation --- */
@keyframes welcomeFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-hero {
    animation: welcomeFadeIn 0.6s ease-out;
}

.showcase-card:nth-child(1) { animation: welcomeFadeIn 0.5s ease-out 0.1s both; }
.showcase-card:nth-child(2) { animation: welcomeFadeIn 0.5s ease-out 0.15s both; }
.showcase-card:nth-child(3) { animation: welcomeFadeIn 0.5s ease-out 0.2s both; }
.showcase-card:nth-child(4) { animation: welcomeFadeIn 0.5s ease-out 0.25s both; }
.showcase-card:nth-child(5) { animation: welcomeFadeIn 0.5s ease-out 0.3s both; }
.showcase-card:nth-child(6) { animation: welcomeFadeIn 0.5s ease-out 0.35s both; }

/* ===== Coach Mark Tooltip (v89) ===== */
/* Uses 'all: initial' to create a CSS clean room — no theme bleed possible */

/* Pulse animation on the template ui-group / random button */
/* Uses outline (not box-shadow) because .btn-small has box-shadow !important */
@keyframes coachPulse {
    0%, 100% { outline: 3px solid transparent; outline-offset: 2px; }
    50% { outline: 3px solid rgba(59, 130, 246, 0.5); outline-offset: 2px; }
}

.coach-pulse {
    animation: coachPulse 1.2s ease-in-out 4 !important;
    border-radius: 6px;
    position: relative;
    z-index: 2;
}

/*
 * The tooltip is appended to document.body (outside .app-container),
 * so theme CSS cannot inherit into it. No 'all: initial' needed.
 * Position (top, left, transform) is set via inline JS.
 */
.coach-mark-tooltip {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #111;
    color: #fff;
    padding: 9px 14px 9px 16px;
    border-radius: 8px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.2px;
    white-space: nowrap;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    animation: coachMarkIn 0.35s ease-out both;
    pointer-events: auto;
    box-sizing: border-box;
}

/* Upward-pointing arrow */
.coach-mark-arrow {
    position: absolute;
    display: block;
    top: -5px;
    left: 50%;
    width: 10px;
    height: 10px;
    background: #111;
    transform: translateX(-50%) rotate(45deg);
    z-index: -1;
}

/* Text span */
.coach-mark-text {
    color: #fff;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Dismiss button */
.coach-mark-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: color 0.15s ease;
}

.coach-mark-dismiss:hover {
    color: #fff;
}

/* Entrance animation — slight bounce to draw the eye */
@keyframes coachMarkIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(-3px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Fade out */
.coach-mark-fade-out {
    opacity: 0 !important;
    transform: translateX(-50%) translateY(6px) !important;
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

/* Hide tooltips in print */
@media print {
    .coach-mark-tooltip,
    .peek-tooltip {
        display: none !important;
    }
}

/* ===== Peek Tooltip for Prev/Next Buttons (v89) ===== */
/* Appended to document.body — same theme-isolation pattern as coach marks */

.peek-tooltip {
    position: absolute;
    display: inline-block;
    background: #24292f;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    animation: peekIn 0.15s ease-out;
}

.peek-label {
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
}

.peek-arrow {
    position: absolute;
    top: -4px;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #24292f;
    transform: translateX(-50%) rotate(45deg);
    z-index: -1;
}

@keyframes peekIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
