/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Stitch Brand Colors */
    --stitch-violet: #6e2cff;
    --stitch-violet-light: rgba(110, 44, 255, 0.15);
    --stitch-violet-hover: #5a1fef;
    --stitch-carbon: #1D1C1F;
    --stitch-black: #100E13;
    --stitch-platinum: #F2F2F2;
    --stitch-silver: #DFDFDF;
    --stitch-white: #FFFFFF;
    --stitch-amber: #FF5B00;
    
    /* Dark Mode Theme */
    --primary: var(--stitch-violet);
    --primary-hover: var(--stitch-violet-hover);
    --primary-light: var(--stitch-violet-light);
    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.15);
    --warning: var(--stitch-amber);
    --warning-light: rgba(255, 91, 0, 0.15);
    
    /* Dark Mode Colors */
    --text-primary: var(--stitch-platinum);
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --bg-primary: var(--stitch-black);
    --bg-secondary: var(--stitch-carbon);
    --bg-tertiary: #27262b;
    --border: #3f3f46;
    --border-light: #27272a;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
}

.logo svg rect {
    fill: var(--stitch-violet);
}

.header-help a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.header-help a:hover {
    color: var(--primary);
}

/* Main Content */
.main {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 40px 24px;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    max-width: 1000px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-content {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}

.welcome-icon {
    margin-bottom: 32px;
}

.welcome-icon svg circle:first-child {
    fill: var(--stitch-violet);
    fill-opacity: 0.1;
}

.welcome-icon svg circle:nth-child(2) {
    fill: var(--stitch-violet);
    fill-opacity: 0.2;
}

.welcome-icon svg path {
    stroke: var(--stitch-violet);
}

.welcome-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.welcome-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.time-estimate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* Store Input */
.store-input-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    text-align: left;
}

.store-input-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    flex: 1;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-suffix {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.input-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-large {
    padding: 18px 36px;
    font-size: 17px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

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

.prereq-note {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 24px;
}

.prereq-note strong {
    color: var(--text-primary);
}

/* Step Content */
.step-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 40px;
}

/* Progress Section */
.progress-section {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 100px;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 14px;
    color: var(--text-muted);
    white-space: nowrap;
}

.step-content h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.step-description {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}

@media (max-width: 800px) {
    .two-column {
        grid-template-columns: 1fr;
    }
    
    .visual-column {
        order: -1;
    }
}

/* Instructions Column */
.instruction-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 24px;
}

.instruction-card h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.instruction-list {
    list-style: none;
    margin-bottom: 24px;
}

.instruction-list li {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.instruction-list li:last-child {
    border-bottom: none;
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.step-text strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.step-text p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-buttons .btn-primary,
.action-buttons .btn-secondary {
    padding: 12px 20px;
    font-size: 14px;
}

/* Inline Action Buttons (within instruction steps) */
.inline-action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.btn-small {
    padding: 10px 16px !important;
    font-size: 14px !important;
}

.btn-small svg {
    width: 16px;
    height: 16px;
}

/* Troubleshooting */
.troubleshooting {
    margin-top: 24px;
    background: var(--warning-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.troubleshooting summary {
    padding: 16px 20px;
    font-weight: 600;
    cursor: pointer;
    color: var(--warning);
    display: flex;
    align-items: center;
    gap: 8px;
}

.troubleshooting summary::-webkit-details-marker {
    display: none;
}

.troubleshooting summary::before {
    content: '?';
    width: 24px;
    height: 24px;
    background: var(--warning);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.troubleshooting-content {
    padding: 0 20px 20px;
}

.trouble-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 91, 0, 0.2);
}

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

.trouble-item strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.trouble-item p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.trouble-item a {
    color: var(--primary);
}

/* Video Container */
.video-container {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.video-container video {
    width: 100%;
    display: block;
}

.video-caption {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    margin: 0;
    border-top: 1px solid var(--border);
}

/* Success Note */
.success-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--success-light);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.success-note svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.success-note span {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Info Banner */
.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--primary-light);
    border: 1px solid rgba(110, 44, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.info-banner svg {
    flex-shrink: 0;
    color: var(--primary);
    margin-top: 2px;
}

.info-banner span {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Inline Link */
.inline-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.inline-link:hover {
    text-decoration: underline;
}

/* Step Navigation */
.step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* Complete Screen */
.complete-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.success-animation {
    margin-bottom: 32px;
}

.success-animation svg {
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.checkmark {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: drawCheck 0.6s ease 0.2s forwards;
}

@keyframes drawCheck {
    to {
        stroke-dashoffset: 0;
    }
}

.complete-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--success);
}

.complete-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.completion-summary {
    background: var(--success-light);
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    margin-bottom: 40px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 16px;
}

.summary-item.completed {
    color: var(--text-primary);
}

/* Next Steps */
.next-steps {
    margin-bottom: 40px;
    text-align: left;
}

.next-steps h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.next-step-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 600px) {
    .next-step-cards {
        grid-template-columns: 1fr;
    }
}

.next-step-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.next-step-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.card-content {
    text-align: left;
}

.card-content strong {
    display: block;
    margin-bottom: 4px;
}

.card-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Help Section */
.help-section {
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.help-section p {
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.reset-link {
    color: var(--text-muted);
    font-size: 14px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    position: relative;
    animation: slideUp 0.3s ease;
    border: 1px solid var(--border);
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--border);
}

.modal h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.modal > p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.help-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

.help-option:hover {
    background: var(--border);
}

.help-option svg {
    color: var(--primary);
    flex-shrink: 0;
}

.help-option strong {
    display: block;
}

.help-option p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--stitch-violet);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1001;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 600px) {
    .main {
        padding: 24px 16px;
    }
    
    .step-content {
        padding: 24px;
    }
    
    .welcome-content h1 {
        font-size: 26px;
    }
    
    .step-content h2 {
        font-size: 24px;
    }
    
    .store-input-section {
        padding: 24px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn-primary,
    .action-buttons .btn-secondary {
        width: 100%;
    }
    
    .inline-action-buttons {
        flex-direction: column;
    }
    
    .inline-action-buttons .btn-primary,
    .inline-action-buttons .btn-secondary {
        width: 100%;
    }
    
    .step-navigation {
        flex-direction: column-reverse;
        gap: 12px;
    }
    
    .step-navigation .btn-primary,
    .step-navigation .btn-ghost {
        width: 100%;
    }
}
