/* Shared App Simulation Styles */
.app-sim {
    width: 100%;
    height: 100%;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    position: relative;
    font-size: 13px; /* Scaled down slightly for preview */
}

/* App Header */
.app-header {
    height: 40px;
    background: white;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 0 10px;
    flex-shrink: 0;
}

.app-logo {
    color: #4A90E2;
    font-weight: bold;
    margin-right: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.app-tabs {
    display: flex;
    height: 100%;
}

.app-tab {
    padding: 0 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    height: 100%;
    box-sizing: border-box;
}

.app-tab.active {
    color: #4A90E2;
    border-bottom-color: #4A90E2;
    font-weight: 500;
}

/* App Body */
.app-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.app-sidebar {
    width: 200px;
    background: white;
    border-right: 1px solid #ddd;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Main Content */
.app-content {
    flex: 1;
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* UI Components */
.app-btn {
    padding: 8px 12px;
    background: #4A90E2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.app-btn.secondary {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
}

.app-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 10px;
}

.app-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    box-sizing: border-box;
    background: #f9f9f9;
}

.app-input-label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

/* Hero Animation Specifics (Scan Flow) */
.hero-scan-scene {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.scan-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    background: #fcfcfc;
    width: 300px;
    max-width: 90%;
    position: absolute;
    transition: opacity 0.5s;
}

.scan-processing {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    pointer-events: none;
}

.scan-result-form {
    position: absolute;
    width: 320px;
    max-width: 90%;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

/* Keyframes for Hero Sequence */
.hero-anim-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.hero-anim-wrapper .scan-upload-area {
    animation: fadeOutUpload 8s infinite;
}

.hero-anim-wrapper .scan-processing {
    animation: showProcessing 8s infinite;
}

.hero-anim-wrapper .scan-result-form {
    animation: showResult 8s infinite;
}

@keyframes fadeOutUpload {
    0%, 20% { opacity: 1; transform: scale(1); }
    25%, 90% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes showProcessing {
    0%, 20% { opacity: 0; }
    25%, 45% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes showResult {
    0%, 45% { opacity: 0; transform: translateY(20px); }
    50%, 90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(20px); }
}

/* Progress Bar */
.progress-bar {
    width: 200px;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: #4A90E2;
    width: 0;
    animation: fillProgress 2s linear infinite; /* Runs during processing phase */
}

@keyframes fillProgress {
    0% { width: 0; }
    100% { width: 100%; }
}

/* Simulated Cursor */
.app-cursor {
    width: 0; 
    height: 0; 
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-bottom: 22px solid #333;
    position: absolute;
    z-index: 100;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
    transform: rotate(-45deg);
    top: 110%; /* Start off screen */
    left: 50%;
    animation: heroCursorMove 8s infinite;
}

.app-cursor::after {
    content: '';
    position: absolute;
    top: 2px;
    left: -8px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid white;
}

@keyframes heroCursorMove {
    0% { top: 80%; left: 80%; }
    10% { top: 60%; left: 50%; } /* Move to upload button */
    15% { transform: rotate(-45deg) scale(0.9); } /* Click */
    20% { transform: rotate(-45deg) scale(1); }
    25% { top: 90%; left: 90%; } /* Move away */
    100% { top: 90%; left: 90%; }
}

/* Demo 1: Autofill/Templates */
.demo1-scene {
    display: flex;
    width: 100%;
    height: 100%;
}

.demo1-sidebar {
    width: 140px;
    background: white;
    border-right: 1px solid #ddd;
    padding: 10px;
}

.demo1-list-item {
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    color: #333;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.demo1-list-item.active {
    background: #e6f0fa;
    color: #4A90E2;
}

.demo1-content {
    flex: 1;
    padding: 20px;
    background: #f5f5f5;
    position: relative;
}

.demo1-form {
    background: white;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.typing-text::after {
    content: '|';
    animation: blinkCursor 0.8s infinite;
}

.typing-field-1::before {
    content: '';
    animation: typeField1 6s infinite;
}

@keyframes typeField1 {
    0%, 20% { content: ''; }
    30% { content: 'Иван'; }
    40% { content: 'Иванов '; }
    60% { content: 'Иванов Иван'; }
    80%, 100% { content: 'Иванов Иван Иванович'; }
}

@keyframes blinkCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.demo1-form .app-btn {
    animation: pulseButton 6s infinite;
}

@keyframes pulseButton {
    0%, 60% { transform: scale(1); }
    65% { transform: scale(1.04); }
    70% { transform: scale(0.98); }
    75%, 100% { transform: scale(1); }
}

/* Demo 2: Editor */
.editor-paper {
    width: 280px;
    height: 380px;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin: 0 auto;
    padding: 20px;
    font-family: 'Times New Roman', serif;
    font-size: 10px;
    line-height: 1.4;
    position: relative;
}

.editor-text-line {
    height: 8px;
    background: #eee;
    margin-bottom: 6px;
    width: 100%;
}

.editor-text-line.typing {
    width: 0;
    background: #333;
    animation: typeLine 4s infinite;
}

@keyframes typeLine {
    0% { width: 0; }
    50% { width: 100%; }
    100% { width: 100%; }
}

.gen-anim .app-btn {
    animation: pressButton 6s infinite;
}

@keyframes pressButton {
    0%, 70% { transform: scale(1); }
    75% { transform: scale(0.95); }
    80% { transform: scale(1.02); }
    85%, 100% { transform: scale(1); }
}

/* Reuse anim container from before but cleaner */
.anim-container {
    width: 100%;
    max-width: 500px;
    height: 350px;
    background: transparent;
    padding: 0;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
    margin: 0 auto;
}

@media (max-width: 600px) {
    .app-sidebar {
        width: 60px;
    }
    .app-sidebar div:not(.app-btn) {
        display: none;
    }
    .app-btn {
        font-size: 10px;
        padding: 4px;
    }
}
