/* ========================================
   Hero MR Demo Animation Module
   Animated Merge Request Demo for Hero Section
   ======================================== */

/* Code Demo Container */
.code-demo-container {
    position: relative;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

/* Merge Request Mockup */
.merge-request-mockup {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 2;
    border: 1px solid #e5e7eb;
}

/* MR Header */
.mr-header {
    background: #f9fafb;
    padding: 20px;
    border-bottom: 2px solid #e5e7eb;
    opacity: 0;
    animation: fadeInDown 0.6s ease 0.3s forwards;
}

.mr-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #10b981;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.mr-status-badge i {
    font-size: 11px;
}

.mr-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 10px;
    line-height: 1.4;
}

.mr-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: #6b7280;
}

.mr-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mr-id {
    color: #9ca3af;
    font-weight: 600;
}

/* MR Files Section */
.mr-files {
    background: white;
    opacity: 0;
    animation: fadeInUp 0.6s ease 0.8s forwards;
}

.file-header {
    background: #f3f4f6;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #374151;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.file-header i {
    color: #6b7280;
}

.file-stats {
    margin-left: auto;
    display: flex;
    gap: 10px;
    font-weight: 600;
}

.additions {
    color: #10b981;
}

.deletions {
    color: #ef4444;
}

/* Diff Content */
.diff-content {
    padding: 0;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 22px;
    position: relative;
}

.diff-line {
    display: flex;
    padding: 4px 16px;
    opacity: 0;
    animation: typeLine 0.5s ease forwards;
}

.diff-line:nth-child(1) { animation-delay: 1.3s; }
.diff-line:nth-child(2) { animation-delay: 1.7s; }
.diff-line:nth-child(3) { animation-delay: 2.1s; }
.diff-line:nth-child(4) { animation-delay: 2.5s; }
.diff-line:nth-child(5) { animation-delay: 2.9s; }

.diff-line.context {
    background: white;
    color: #374151;
}

.diff-line.removed {
    background: #fee2e2;
    color: #991b1b;
}

.diff-line.removed::before {
    content: '-';
    color: #ef4444;
    font-weight: bold;
    margin-right: 8px;
}

.diff-line.added {
    background: #d1fae5;
    color: #065f46;
}

.diff-line.added::before {
    content: '+';
    color: #10b981;
    font-weight: bold;
    margin-right: 8px;
}

.line-num {
    display: inline-block;
    min-width: 40px;
    text-align: right;
    color: #9ca3af;
    user-select: none;
    margin-right: 16px;
    font-size: 12px;
}

.line-code {
    flex: 1;
}

/* Syntax Highlighting */
.keyword { color: #569cd6; }
.function-name { color: #dcdcaa; }
.parameter { color: #9cdcfe; }
.variable { color: #9cdcfe; }
.string { color: #ce9178; }
.number { color: #b5cea8; }
.comment { color: #6a9955; }
.punctuation { color: #d4d4d4; }
.operator { color: #d4d4d4; }
.method { color: #dcdcaa; }
.function-call { color: #dcdcaa; }
.indent { display: inline-block; white-space: pre; }

/* Scanning Line Animation */
.scanning-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #10b981, transparent);
    opacity: 0;
    animation: scanCode 2s ease 3.2s forwards;
}

/* AI Insights Panel */
.ai-insights-panel {
    position: absolute;
    top: 50%;
    right: -290px;
    transform: translateY(-50%);
    width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    opacity: 0;
    animation: slideInRight 0.6s ease 3.8s forwards;
    z-index: 1;
}

.insight-header {
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}

.insights-content {
    padding: 16px;
}

.insight-item {
    margin-bottom: 14px;
    display: flex;
    gap: 12px;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.insight-item.summary {
    animation-delay: 4.3s;
}

.insight-item.security {
    animation-delay: 4.7s;
}

.insight-item.suggestion {
    animation-delay: 5.1s;
}

.insight-item i {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

.insight-item.summary i {
    background: #dbeafe;
    color: #2563eb;
}

.insight-item.security i {
    background: #fee2e2;
    color: #dc2626;
}

.insight-item.suggestion i {
    background: #fef3c7;
    color: #f59e0b;
}

.insight-text strong {
    display: block;
    font-size: 13px;
    color: #1f2937;
    margin-bottom: 4px;
}

.insight-text p {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* Suggested Questions */
.suggested-questions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    opacity: 0;
    animation: fadeInUp 0.6s ease 4.8s forwards;
}

.questions-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 10px;
}

.questions-header i {
    color: #2563eb;
}

.question-item {
    display: flex;
    align-items: start;
    gap: 8px;
    font-size: 12px;
    color: #374151;
    padding: 6px 8px;
    margin-bottom: 6px;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    animation: slideInLeft 0.4s ease forwards;
}

.question-item:nth-child(2) {
    animation-delay: 5.2s;
}

.question-item:nth-child(3) {
    animation-delay: 5.5s;
}

.question-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

.question-item i {
    color: #2563eb;
    font-size: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Generate Comment Button */
.generate-comment {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    opacity: 0;
    animation: fadeInUp 0.6s ease 5.8s forwards;
}

.generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.generate-btn i {
    font-size: 12px;
}

/* ========================================
   Keyframe Animations
   ======================================== */

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

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

@keyframes scanCode {
    0% {
        opacity: 0;
        top: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        top: 100%;
    }
}

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

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

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

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   Accessibility
   ======================================== */

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .mr-header,
    .mr-files,
    .diff-line,
    .scanning-line,
    .ai-insights-panel,
    .insight-item,
    .suggested-questions,
    .question-item,
    .generate-comment {
        animation: none !important;
        opacity: 1 !important;
    }
    
    .ai-insights-panel {
        transform: translateY(-50%) translateX(0);
    }
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet and below */
@media (max-width: 1024px) {
    .ai-insights-panel {
        position: static;
        transform: none;
        margin-top: 20px;
        width: 100%;
        max-width: 450px;
        animation: fadeInUp 0.6s ease 3.8s forwards;
    }
    
    .code-demo-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .merge-request-mockup {
        font-size: 12px;
    }
    
    .mr-header {
        padding: 16px;
    }
    
    .mr-title {
        font-size: 16px;
    }
    
    .diff-content {
        font-size: 12px;
        line-height: 20px;
    }
    
    .diff-line {
        padding: 3px 12px;
    }
    
    .line-num {
        min-width: 35px;
        margin-right: 12px;
    }
    
    .file-header {
        font-size: 12px;
        padding: 10px 12px;
    }
}

