/* ═══════════════════════════════════════════════════════
   WIA Talk + Braille Unified Demo
   통합 데모 페이지 스타일
   ═══════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────
   Hero Section
   ─────────────────────────────────────────────────────── */
.hero-unified {
    padding: 120px 0 60px;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 50%, #BFDBFE 100%);
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, #2563EB 0%, #10B981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.hero-desc {
    font-size: 1.125rem;
    color: var(--gray-700);
    margin-bottom: 2rem;
}

.hero-pipeline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.pipeline-step {
    padding: 0.75rem 1.5rem;
    background: white;
    border-radius: var(--radius-lg);
    font-weight: 600;
    color: var(--gray-900);
    box-shadow: var(--shadow-md);
}

.pipeline-arrow {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: bold;
}

/* ───────────────────────────────────────────────────────
   Demo Section
   ─────────────────────────────────────────────────────── */
.demo-section {
    padding: 60px 0;
    background: var(--gray-50);
}

/* ───────────────────────────────────────────────────────
   Status Bar
   ─────────────────────────────────────────────────────── */
.status-bar {
    display: flex;
    justify-content: space-around;
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.status-label {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.status-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

/* ───────────────────────────────────────────────────────
   Demo Grid
   ─────────────────────────────────────────────────────── */
.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.demo-panel {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.panel-header {
    padding: 2rem;
    background: var(--gradient-primary);
    color: white;
    text-align: center;
}

.panel-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.panel-header p {
    opacity: 0.95;
}

.braille-panel .panel-header {
    background: var(--gradient-secondary);
}

.panel-content {
    padding: 2rem;
}

/* ───────────────────────────────────────────────────────
   Video Container
   ─────────────────────────────────────────────────────── */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--gray-900);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

#webcam {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ───────────────────────────────────────────────────────
   Controls
   ─────────────────────────────────────────────────────── */
.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.controls .btn {
    flex: 1;
}

/* ───────────────────────────────────────────────────────
   Gesture Info
   ─────────────────────────────────────────────────────── */
.gesture-info {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: var(--gray-700);
}

.info-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

/* ───────────────────────────────────────────────────────
   Output Sections
   ─────────────────────────────────────────────────────── */
.output-section {
    margin-bottom: 1.5rem;
}

.output-label {
    display: block;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.output-box {
    padding: 1.5rem;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    min-height: 80px;
    font-size: 1.125rem;
    line-height: 1.8;
    transition: all var(--transition-base);
}

.output-box:focus {
    outline: none;
    border-color: var(--secondary);
}

.text-output {
    color: var(--gray-900);
    font-weight: 600;
}

.ipa-output {
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 1rem;
}

.braille-output {
    font-size: 2rem;
    color: var(--secondary);
    font-family: 'Braille', monospace;
    letter-spacing: 0.5rem;
    text-align: center;
    padding: 2rem;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ───────────────────────────────────────────────────────
   Connection Indicator
   ─────────────────────────────────────────────────────── */
.connection-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 3rem;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: 3rem;
}

.connection-side {
    text-align: center;
}

.connection-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.connection-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    line-height: 1.6;
}

.connection-line {
    position: relative;
    width: 200px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.connection-pulse {
    position: absolute;
    top: -4px;
    left: 0;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        left: 0;
        transform: scale(1);
    }
    50% {
        left: calc(100% - 12px);
        transform: scale(1.5);
    }
}

/* ───────────────────────────────────────────────────────
   History Panel
   ─────────────────────────────────────────────────────── */
.history-panel {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.history-panel h3 {
    font-size: 1.5rem;
    color: var(--gray-900);
    margin-bottom: 1.5rem;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    color: var(--gray-700);
    padding: 2rem;
}

.history-item {
    padding: 1.5rem;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    transition: all var(--transition-base);
}

.history-item:hover {
    background: var(--gray-100);
    transform: translateX(4px);
}

.history-time {
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.history-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.history-field {
    display: flex;
    flex-direction: column;
}

.history-field-label {
    font-size: 0.75rem;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.history-field-value {
    font-weight: 600;
    color: var(--gray-900);
}

.history-field-value.braille {
    font-size: 1.5rem;
    color: var(--secondary);
    font-family: 'Braille', monospace;
}

/* ───────────────────────────────────────────────────────
   Philosophy Section
   ─────────────────────────────────────────────────────── */
.philosophy-section {
    padding: 4rem 0;
    background: linear-gradient(135deg, #1E40AF 0%, #059669 100%);
    color: white;
    text-align: center;
}

.philosophy-section h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 2rem;
}

.philosophy-section p {
    font-size: 1.125rem;
    line-height: 2;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.95;
}

/* ───────────────────────────────────────────────────────
   Responsive Design
   ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .demo-grid {
        grid-template-columns: 1fr;
    }

    .connection-line {
        width: 100px;
    }

    .history-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-pipeline {
        flex-direction: column;
    }

    .pipeline-arrow {
        transform: rotate(90deg);
    }

    .connection-indicator {
        flex-direction: column;
    }

    .connection-line {
        width: 4px;
        height: 100px;
    }

    .connection-pulse {
        animation: pulse-vertical 2s ease-in-out infinite;
    }

    @keyframes pulse-vertical {
        0%, 100% {
            top: 0;
            transform: scale(1);
        }
        50% {
            top: calc(100% - 12px);
            transform: scale(1.5);
        }
    }

    .status-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .braille-output {
        font-size: 1.5rem;
        letter-spacing: 0.25rem;
    }
}

@media (max-width: 480px) {
    .demo-grid {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
    }

    .output-box {
        font-size: 1rem;
    }
}

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

.output-box.updated {
    animation: fadeIn 0.3s ease;
}

/* ───────────────────────────────────────────────────────
   Loading State
   ─────────────────────────────────────────────────────── */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    to {
        left: 100%;
    }
}
