/* ===================================
   Global Styles & Variables
   =================================== */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-light);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Header
   =================================== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header h1 i {
    margin-right: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
}

/* ===================================
   Progress Bar
   =================================== */
.progress-container {
    background: var(--bg-white);
    padding: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: -1;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    position: relative;
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
    font-size: 1rem;
}

.step span {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.step.active .step-icon {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.step.active span {
    color: var(--primary-color);
    font-weight: 600;
}

.step.completed .step-icon {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.step.completed span {
    color: var(--success-color);
}

/* ===================================
   Main Content & Stages
   =================================== */
.main-content {
    padding: 2rem 0 4rem;
    min-height: calc(100vh - 400px);
}

.stage {
    display: none;
    animation: fadeIn 0.5s ease;
}

.stage.active {
    display: block;
}

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

.stage-header {
    text-align: center;
    margin-bottom: 2rem;
}

.stage-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.stage-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.requirement {
    background: #fef3c7;
    color: #92400e;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-weight: 500;
}

/* ===================================
   Stage 1: Scenario Selection
   =================================== */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.scenario-card {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    cursor: pointer;
}

.scenario-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.scenario-card.selected {
    border-color: var(--primary-color);
    background: #eef2ff;
}

.scenario-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}

.scenario-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.scenario-desc {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.scenario-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background: var(--bg-light);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.813rem;
    font-weight: 500;
}

.custom-input-box {
    background: var(--bg-white);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-top: 2rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

.custom-input-box h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.custom-input-box input,
.custom-input-box textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: inherit;
    font-size: 1rem;
}

.custom-input-box textarea {
    min-height: 100px;
    resize: vertical;
}

/* ===================================
   Stage 2: Friction Hunt
   =================================== */
.scenario-context {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.scenario-context h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.friction-counter {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.counter-box {
    flex: 1;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
}

.counter-box.digital {
    border-color: var(--primary-color);
}

.counter-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.counter-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.counter-box.digital .counter-value {
    color: var(--primary-color);
}

.friction-input-area {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.friction-suggestions {
    margin-bottom: 2rem;
}

.friction-suggestions h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.friction-suggestions h4 i {
    color: var(--warning-color);
}

.suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-tag {
    background: #fef3c7;
    color: #92400e;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-tag:hover {
    background: #fde68a;
    transform: translateY(-2px);
}

.add-friction-form {
    border-top: 2px solid var(--border-color);
    padding-top: 2rem;
    margin-bottom: 2rem;
}

.add-friction-form h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.add-friction-form select,
.add-friction-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: inherit;
    font-size: 1rem;
}

.add-friction-form select:focus,
.add-friction-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.add-friction-form textarea {
    min-height: 80px;
    resize: vertical;
}

.friction-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.friction-item {
    background: var(--bg-light);
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: start;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.friction-item.physical {
    border-left-color: var(--secondary-color);
}

.friction-content {
    flex: 1;
}

.friction-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.friction-type-badge.digital {
    background: #dbeafe;
    color: #1e40af;
}

.friction-type-badge.physical {
    background: #ede9fe;
    color: #6b21a8;
}

.friction-text {
    color: var(--text-primary);
    line-height: 1.5;
}

.friction-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.25rem;
    transition: var(--transition);
}

.friction-remove:hover {
    transform: scale(1.2);
}

/* ===================================
   Stage 3: Journey Map
   =================================== */
.journey-map {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.journey-stage {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--primary-color);
}

.journey-stage:nth-child(2) { border-left-color: #06b6d4; }
.journey-stage:nth-child(3) { border-left-color: #10b981; }
.journey-stage:nth-child(4) { border-left-color: #f59e0b; }
.journey-stage:nth-child(5) { border-left-color: #8b5cf6; }

.journey-stage-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stage-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.journey-stage:nth-child(2) .stage-number { background: #06b6d4; }
.journey-stage:nth-child(3) .stage-number { background: #10b981; }
.journey-stage:nth-child(4) .stage-number { background: #f59e0b; }
.journey-stage:nth-child(5) .stage-number { background: #8b5cf6; }

.journey-stage-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.stage-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
}

.journey-fields {
    display: grid;
    gap: 1rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.journey-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.journey-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.journey-input[type="text"] {
    height: 45px;
}

textarea.journey-input {
    min-height: 80px;
    resize: vertical;
}

/* ===================================
   Stage 4: Journey Rescue
   =================================== */
.rescue-section {
    margin-bottom: 2rem;
}

.rescue-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.dropoff-selection {
    display: grid;
    gap: 1rem;
}

.dropoff-option {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.dropoff-option:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.dropoff-option.selected {
    border-color: var(--primary-color);
    background: #eef2ff;
}

.dropoff-option h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropoff-option p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.fixes-section {
    animation: fadeIn 0.5s ease;
}

.fixes-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.fix-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--primary-color);
}

.fix-card:nth-child(2) { border-left-color: var(--success-color); }
.fix-card:nth-child(3) { border-left-color: var(--secondary-color); }

.fix-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fix-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.fix-card:nth-child(2) .fix-number { background: var(--success-color); }
.fix-card:nth-child(3) .fix-number { background: var(--secondary-color); }

.fix-header h4 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
}

.fix-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.fix-examples {
    background: var(--bg-light);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.fix-examples strong {
    color: var(--text-primary);
}

.fix-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    min-height: 100px;
    resize: vertical;
    transition: var(--transition);
}

.fix-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ===================================
   Stage 5: Results
   =================================== */
.results-container {
    display: grid;
    gap: 2rem;
}

.score-card {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.score-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.score-breakdown {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.score-label {
    font-weight: 500;
}

.score-value {
    font-weight: 700;
    font-size: 1.25rem;
}

.score-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    margin-top: 0.5rem;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.score-total .score-value {
    font-size: 2rem;
}

.results-section {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.results-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-item {
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.result-item strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.journey-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.journey-table th,
.journey-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.journey-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-primary);
}

.journey-table td {
    color: var(--text-secondary);
}

.export-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

/* ===================================
   Buttons
   =================================== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.select-scenario {
    width: 100%;
}

.stage-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

/* ===================================
   Footer
   =================================== */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .progress-steps {
        overflow-x: auto;
        padding-bottom: 1rem;
    }
    
    .step span {
        font-size: 0.75rem;
    }
    
    .scenarios-grid {
        grid-template-columns: 1fr;
    }
    
    .friction-counter {
        flex-direction: column;
    }
    
    .stage-actions {
        flex-direction: column;
    }
    
    .stage-actions .btn {
        width: 100%;
    }
    
    .export-actions {
        flex-direction: column;
    }
    
    .export-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .stage-header h2 {
        font-size: 1.5rem;
    }
    
    .friction-input-area,
    .custom-input-box {
        padding: 1rem;
    }
}

/* ===================================
   Print Styles
   =================================== */
@media print {
    .header,
    .progress-container,
    .stage-actions,
    .export-actions,
    .footer {
        display: none;
    }
    
    .results-container {
        box-shadow: none;
    }
    
    .stage {
        display: block !important;
    }
}