/* ========================================
   INVENT YOUR CALENDAR - Interactive Teaching Tool
   ======================================== */

/* --- Hero --- */
.invent-hero {
    text-align: center;
    padding: var(--space-10) var(--space-4) var(--space-6);
}
.invent-hero h1 {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-blue-300);
    margin: 0 0 var(--space-3);
}
.invent-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-base);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.6;
}

/* --- Container --- */
.invent-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--space-4) var(--space-10);
}

/* --- Progress bar --- */
.invent-progress {
    height: 4px;
    background: var(--bg-surface);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--space-3);
}
.invent-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-blue-400), var(--color-purple-500));
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* --- Breadcrumbs --- */
.invent-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    min-height: 28px;
}
.invent-crumb {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 100px;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-family: var(--font-display);
}
.invent-crumb-icon {
    font-size: 14px;
}
.invent-crumb-sep {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    user-select: none;
}

/* --- Step panel --- */
.invent-step {
    opacity: 0;
    transform: translateY(20px);
    animation: inventStepIn 0.4s ease forwards;
    margin-bottom: var(--space-8);
    scroll-margin-top: 130px;
}
@keyframes inventStepIn {
    to { opacity: 1; transform: translateY(0); }
}

.invent-step-number {
    display: inline-block;
    font-family: var(--font-display);
    font-size: var(--text-xs);
    color: var(--color-blue-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-2);
}

.invent-step-question {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2);
    line-height: 1.3;
}

.invent-step-why {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
    margin: 0 0 var(--space-5);
}

/* --- Choice cards grid --- */
.invent-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}
.invent-choices.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}
.invent-choices.cols-4 {
    grid-template-columns: repeat(2, 1fr);
}

/* --- Choice card --- */
.invent-choice {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-4);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
    text-align: center;
    position: relative;
}
.invent-choice:hover {
    border-color: var(--color-blue-400);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12);
}
.invent-choice:active {
    transform: scale(0.98);
}
.invent-choice.selected {
    border-color: var(--color-purple-500);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}
.invent-choice.selected::after {
    content: '\2713';
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 14px;
    color: var(--color-purple-500);
    font-weight: 700;
}

.invent-choice-icon {
    font-size: 32px;
    margin-bottom: var(--space-2);
    display: block;
    line-height: 1;
}

.invent-choice-label {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.invent-choice-desc {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* --- Collapsed answered step --- */
.invent-answered {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
    cursor: pointer;
    transition: border-color 0.2s;
}
.invent-answered:hover {
    border-color: var(--color-blue-400);
}
.invent-answered-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.invent-answered-text {
    flex: 1;
    min-width: 0;
}
.invent-answered-q {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.invent-answered-a {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
}
.invent-answered-edit {
    font-size: var(--text-xs);
    color: var(--color-blue-400);
    flex-shrink: 0;
    font-family: var(--font-display);
}

/* ========================================
   RESULT SCREEN
   ======================================== */

.invent-result {
    animation: inventStepIn 0.5s ease forwards;
    scroll-margin-top: 130px;
}

/* Reveal header */
.result-reveal {
    text-align: center;
    padding: var(--space-8) 0 var(--space-6);
}
.result-reveal h2 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-blue-300);
    margin: 0 0 var(--space-2);
}
.result-formula {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}
.result-formula-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px 12px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 100px;
    font-family: var(--font-display);
    font-size: var(--text-xs);
    color: var(--color-purple-500);
    font-weight: 600;
}

/* Match cards */
.result-matches {
    margin-bottom: var(--space-6);
}
.result-matches-heading {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-3);
}
.result-match-card {
    background: var(--bg-surface);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 3px solid var(--accent-highlight);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-3);
}
.result-match-name {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}
.result-match-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.result-match-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-family: var(--font-display);
    font-weight: 600;
}
.result-match-badge.cat {
    background: rgba(139, 92, 246, 0.12);
    color: var(--color-purple-500);
    border: 1px solid rgba(139, 92, 246, 0.2);
}
.result-match-badge.year {
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-blue-400);
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.result-match-used {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    line-height: 1.5;
}
.result-match-fact {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
}

/* No exact match */
.result-new {
    text-align: center;
    padding: var(--space-6);
    background: var(--bg-surface);
    border: 1px dashed var(--color-purple-500);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}
.result-new h3 {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    color: var(--color-purple-500);
    margin: 0 0 var(--space-2);
}
.result-new p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* Close matches */
.result-close-heading {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}
.result-close-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-2);
}

/* What if section */
.result-whatif {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-default);
}
.result-whatif-heading {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}
.result-whatif-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
    overflow: hidden;
}
.result-whatif-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    text-align: left;
}
.result-whatif-toggle:hover {
    background: var(--bg-surface-hover);
}
.result-whatif-chevron {
    transition: transform 0.2s;
    font-size: 12px;
    color: var(--text-secondary);
}
.result-whatif-item.open .result-whatif-chevron {
    transform: rotate(180deg);
}
.result-whatif-body {
    display: none;
    padding: 0 var(--space-4) var(--space-4);
}
.result-whatif-item.open .result-whatif-body {
    display: block;
}
.result-whatif-cal {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin: 2px;
}

/* Actions */
.result-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    margin-top: var(--space-8);
    flex-wrap: wrap;
}
.invent-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.15s;
}
.invent-btn:active { transform: scale(0.97); }
.invent-btn-primary {
    background: var(--color-blue-400);
    color: #fff;
}
.invent-btn-primary:hover { filter: brightness(1.1); }
.invent-btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}
.invent-btn-secondary:hover { border-color: var(--color-blue-400); }

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

@media (max-width: 600px) {
    .invent-hero h1 { font-size: var(--text-2xl); }
    .invent-container { padding: 0 var(--space-3) var(--space-8); }
    .invent-choices,
    .invent-choices.cols-3,
    .invent-choices.cols-4 {
        grid-template-columns: 1fr;
    }
    .invent-step-question { font-size: var(--text-lg); }
    .invent-choice { padding: var(--space-4) var(--space-3); }
    .invent-choice-icon { font-size: 26px; }
    .result-reveal h2 { font-size: var(--text-xl); }
    .result-actions { flex-direction: column; align-items: stretch; }
}

@media (min-width: 601px) and (max-width: 768px) {
    .invent-choices.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}
