/* Modern, clean styling for the training tool */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* Header with inline navigation */
.header-with-nav {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content {
    flex: 1;
}

/* Logo and title layout */
.logo-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-logo {
    width: 100px !important;
    height: 100px !important;
    max-width: 100px !important;
    max-height: 100px !important;
    object-fit: contain;
    flex-shrink: 0;
}

h1 {
    color: #2d3748;
    margin: 0 0 5px 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.subtitle {
    color: #718096;
    font-size: 1.1rem;
    margin: 0;
}

/* Responsive header */
@media (max-width: 768px) {
    .header-with-nav {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .header-content {
        text-align: center;
    }
    
    .logo-title {
        flex-direction: column;
        gap: 10px;
    }
    
    .site-logo {
        width: 70px !important;
        height: 70px !important;
        max-width: 70px !important;
        max-height: 70px !important;
    }
}

/* Stage navigation */
.stage-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stage-btn {
    padding: 12px 24px;
    margin: 0 5px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    background: #e2e8f0;
    color: #4a5568;
}

.stage-btn.active {
    background: #4299e1;
    color: white;
}

.stage-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Top-Level Navigation (inline with header) */
.top-nav {
    display: flex;
    gap: 0;
    padding: 4px;
    background: #f7fafc;
    border-radius: 8px;
    width: fit-content;
    margin: 0;
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    background: transparent;
    color: #4a5568;
}

.nav-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.nav-btn.active {
    background: #4299e1;
    color: white;
    box-shadow: 0 2px 4px rgba(66, 153, 225, 0.3);
}

/* Page Content */
.page-content {
    animation: fadeIn 0.3s ease-in-out;
}

.about-hidden {
    display: none !important;
}

.page-content {
    display: block;
}

.about-content-page {
    /* About page specific styles */
    background: #f9f9f9;
    padding: 20px;
}

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

/* Navigation separator */
.nav-separator {
    width: 1px;
    height: 30px;
    background: #cbd5e0;
    margin: 0 10px;
}

/* Story navigation */
.story-nav {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.story-nav button {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.story-nav button:hover:not(:disabled) {
    background: #e9ecef;
    transform: translateY(-1px);
}

.story-nav button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#story-counter {
    font-weight: bold;
    color: #495057;
    padding: 0 10px;
}

/* Tooltip styles for Stage 1 positive feedback */
.tooltip-container {
    position: relative;
    cursor: help;
}

.tooltip-container:hover {
    background-color: #f0f8ff !important;
    border-color: #4299e1 !important;
}

.tooltip-hint {
    opacity: 0.6;
    font-size: 12px;
    margin-left: 8px;
    transition: opacity 0.2s;
}

.tooltip-container:hover .tooltip-hint {
    opacity: 1;
}

/* Custom tooltip for better content display */
.custom-tooltip {
    position: absolute;
    background: #2d3748;
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    z-index: 1000;
    max-width: min(300px, 90vw);
    min-width: min(200px, 80vw);
    max-height: min(300px, 50vh);
    overflow-y: auto;
    white-space: normal;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid #4a5568;
    display: none;
    word-wrap: break-word;
    /* Default positioning - will be set by JavaScript */
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .custom-tooltip {
        font-size: 11px;
        padding: 10px;
        max-width: 95vw;
        min-width: 250px;
        max-height: 40vh;
    }
}

/* Arrow styling - will be positioned by JavaScript */
.custom-tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 6px solid transparent;
}

/* Right arrow */
.custom-tooltip.arrow-right::before {
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    border-right-color: #2d3748;
}

/* Left arrow */
.custom-tooltip.arrow-left::before {
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    border-left-color: #2d3748;
}

/* Bottom arrow */
.custom-tooltip.arrow-bottom::before {
    bottom: -6px;
    left: 20px;
    border-top-color: #2d3748;
}

/* Top arrow */
.custom-tooltip.arrow-top::before {
    top: -6px;
    left: 20px;
    border-bottom-color: #2d3748;
}

/* Enhanced story elements for Stage 1 */
.story-text {
    background: #f7fafc; 
    padding: 15px; 
    border-radius: 6px; 
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.criteria-text {
    background: #f0fff4; 
    padding: 8px 12px; 
    border-radius: 4px; 
    border: 1px solid #c6f6d5; 
    display: block;
    transition: all 0.3s ease;
}

/* Main content area */
.main-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

/* Epic display */
.epic-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
}

/* Epic acceptance criteria styling */
.epic-criteria {
    background: #e6f3ff;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #4299e1;
}

.epic-criteria li {
    color: #2d3748;
    font-weight: 500;
    margin-bottom: 6px;
}

.epic-title {
    font-size: 20px;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 10px;
}

.epic-description {
    color: #4a5568;
    line-height: 1.6;
}

/* User story cards */
.story-container {
    margin-top: 30px;
}

.story-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.story-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
}

.story-description {
    margin-bottom: 15px;
}

.story-description textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.story-description textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* Acceptance criteria */
.acceptance-criteria {
    margin-top: 15px;
}

.criteria-label {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    display: block;
}

.criteria-list {
    list-style: none;
}

.criteria-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
}

.criteria-item input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 14px;
}

.criteria-item button {
    margin-left: 8px;
    padding: 8px 12px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.add-criteria-btn {
    padding: 8px 16px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
}

/* Action buttons */
.action-buttons {
    margin-top: 20px;
    text-align: center;
}

.btn {
    padding: 12px 24px;
    margin: 0 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Feedback display */
.feedback-section {
    margin-top: 30px;
    padding: 20px;
    border-radius: 8px;
    display: none;
}

.feedback-section.show {
    display: block;
}

.feedback-score {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
}

.feedback-overall {
    background: #f7fafc;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 16px;
}

.feedback-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.feedback-item {
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #cbd5e0;
}

.feedback-item.excellent {
    background: #f0fff4;
    border-left-color: #48bb78;
}

.feedback-item.good {
    background: #f7fafc;
    border-left-color: #4299e1;
}

.feedback-item.needs-improvement {
    background: #fffaf0;
    border-left-color: #ed8936;
}

.feedback-item.poor {
    background: #fff5f5;
    border-left-color: #e53e3e;
}

/* Legacy support */
.feedback-item.valid {
    background: #f0fff4;
    border-left-color: #48bb78;
}

.feedback-item.invalid {
    background: #fff5f5;
    border-left-color: #e53e3e;
}

.feedback-component {
    font-weight: 600;
    margin-bottom: 5px;
}

.feedback-message {
    margin-bottom: 8px;
}

.feedback-suggestion {
    font-size: 14px;
    color: #718096;
    font-style: italic;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #718096;
}

.hidden {
    display: none;
}

/* Stage-specific instructions */
.stage-instructions {
    background: #edf2f7;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #4299e1;
}

.stage-instructions h3 {
    color: #2d3748;
    margin-bottom: 10px;
}

.stage-instructions p {
    color: #4a5568;
    line-height: 1.6;
}

/* About Page Styles */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
}

.about-section {
    margin-bottom: 40px;
    padding: 25px;
    background: #f9fafb;
    border-radius: 10px;
    border-left: 4px solid #4299e1;
}

.about-section h3 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 20px;
}

.about-section p {
    color: #4a5568;
    margin-bottom: 15px;
}

.about-section ul {
    color: #4a5568;
    padding-left: 20px;
}

.about-section li {
    margin-bottom: 8px;
}

.instruction-steps {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.step {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.step h4 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 16px;
}

.step p {
    margin: 0;
    color: #4a5568;
}

.creator-info {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-top: 15px;
}

.contact-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-block;
    padding: 8px 16px;
    background: #4299e1;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: background 0.2s ease;
}

.contact-link:hover {
    background: #3182ce;
}

.site-footer {
    margin-top: 50px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.site-footer p {
    margin: 0;
    color: #4a5568;
    font-size: 14px;
}

.site-footer p + p {
    margin-top: 5px;
    font-size: 12px;
    color: #718096;
}

.site-footer a {
    color: #4299e1;
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    color: #3182ce;
}

/* ========== SIDE PANEL FEEDBACK SYSTEM ========== */

/* Make story container work with side panel */
.story-container {
    position: relative;
}

/* Feedback icon/button next to hoverable elements */
.feedback-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #4299e1;
    color: white;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s ease;
    border: none;
    vertical-align: middle;
}

.feedback-icon:hover {
    background: #3182ce;
    transform: scale(1.1);
}

.feedback-icon.active {
    background: #2c5282;
}

/* Side panel container */
.insights-panel {
    position: fixed;
    right: -400px;
    top: 280px; /* Start at approximately where story section begins */
    width: 400px;
    height: calc(100vh - 280px); /* Adjust height to match */
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.insights-panel.open {
    right: 0;
}

.panel-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(102, 126, 234, 0.1);
    border: none;
    color: #667eea;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    z-index: 10;
}

.panel-close-btn:hover {
    background: rgba(102, 126, 234, 0.2);
}

/* Panel content */
.insights-panel-content {
    padding: 20px;
    padding-top: 50px; /* Space for close button */
}

/* Insight item in panel */
.insight-item {
    background: #f7fafc;
    border-left: 4px solid #4299e1;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.insight-item.observation {
    border-left-color: #48bb78;
    background: #f0fff4;
}

.insight-item.guidance {
    border-left-color: #ed8936;
    background: #fffaf0;
}

.insight-item strong {
    display: block;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 14px;
}

.insight-item p {
    margin: 0;
    color: #4a5568;
    line-height: 1.6;
    font-size: 14px;
}

/* Highlight text that has feedback */
.has-feedback {
    background: rgba(66, 153, 225, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.has-feedback:hover {
    background: rgba(66, 153, 225, 0.2);
}

.has-feedback.active {
    background: rgba(66, 153, 225, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .insights-panel {
        width: 100%;
        right: -100%;
    }
}

