/* ==========================================================================
   Universal Sign Language to 3D Avatar Synthesizer — Classic Warm (Cream + Brown) UI
   ========================================================================== */

/* 1. Custom Font-Face */
@font-face {
    font-family: "HamNoSys";
    src: url("../fonts/HamNoSys.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

/* 2. Global CSS Variables & Classic Design Tokens */
:root {
    --bg-color: #FAF7F2;          /* Cream White Background */
    --card-bg: #FFFFFF;           /* Off-White / Pure White Card Container */
    --card-border: #E5E0D8;       /* Warm subtle card border */
    --text-main: #111827;         /* Deep dark charcoal / black text */
    --text-muted: #4B5563;        /* Dark slate muted text */
    --primary: #991B1B;           /* Rich Maroon / Warm Brown accent */
    --primary-light: rgba(153, 27, 27, 0.08);
    --primary-border: rgba(153, 27, 27, 0.25);
    
    --primary-btn: #1D4ED8;       /* Primary button blue */
    --primary-hover: #1E40AF;     /* Primary button hover */
    --accent-emerald: #059669;
    --accent-amber: #D97706;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-hamnosys: 'HamNoSys', monospace;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;

    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 14px 36px rgba(0, 0, 0, 0.08);
}

/* 3. Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 5rem;
}

/* Layout Container */
.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 2.5rem 1.75rem;
}

/* 4. Header Styles */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header-badges {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1.25rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
}

.badge-primary {
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    color: var(--primary);
}

.badge-accent {
    background: rgba(120, 53, 15, 0.08);
    border: 1px solid rgba(120, 53, 15, 0.25);
    color: #78350F;
}

.badge-success {
    background: rgba(5, 150, 105, 0.08);
    border: 1px solid rgba(5, 150, 105, 0.25);
    color: var(--accent-emerald);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 6px var(--accent-emerald);
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 3.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.app-header h1 span {
    color: var(--primary);
}

.header-subtext {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 820px;
    margin: 0 auto;
    font-weight: 500;
}

/* 5. Reusable White Card Style */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 2rem;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

/* 6. Main 50/50 Viewport Grid */
.main-viewport-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 960px) {
    .main-viewport-grid {
        grid-template-columns: 1fr;
    }
}

.viewport-panel {
    display: flex;
    flex-direction: column;
    min-height: 520px;
    margin-bottom: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--card-border);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-num {
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
}

.panel-title h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.panel-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.85rem;
    background: #F3F4F6;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
}

/* 7. Dropzone / Upload Area */
.upload-dropzone {
    border: 2px dashed #CBD5E1;
    background: #FAF7F2;
    border-radius: var(--radius-md);
    padding: 2.2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 1.25rem;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(153, 27, 27, 0.04);
    transform: translateY(-2px);
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.upload-primary-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.upload-secondary-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.browse-link {
    color: var(--primary-btn);
    text-decoration: underline;
    font-weight: 600;
}

/* Sample Clips Section */
.sample-section {
    margin-bottom: 1.25rem;
}

.sample-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
}

.sample-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sample-chip-btn {
    background: #F3F4F6;
    border: 1px solid var(--card-border);
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sample-chip-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

/* Video Preview Player Display */
.video-display-wrapper {
    background: #0F172A;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--card-border);
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 260px;
}

.video-overlay-header {
    background: #1E293B;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.video-tag-pill {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #38BDF8;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-timer {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #94A3B8;
}

#input-video-player {
    width: 100%;
    height: 100%;
    max-height: 320px;
    object-fit: contain;
    background: #000000;
}

/* 8. WebGL 3D Avatar Viewport */
.avatar-select-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.custom-select {
    background: #F3F4F6;
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font-heading);
    cursor: pointer;
    outline: none;
    font-weight: 600;
}

.custom-select:focus {
    border-color: var(--primary);
}

.avatar-canvas-wrapper {
    background: radial-gradient(circle at center, #334155 0%, #1E293B 70%, #0F172A 100%);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--card-border);
    flex: 1;
    position: relative;
    min-height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CWASA Canvas Overrides */
.CWASAAvatar {
    width: 100% !important;
    height: 100% !important;
    min-height: 380px;
    display: block;
}

.avatar-render-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.85rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.avatar-tech-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.avatar-fps-badge {
    font-family: var(--font-mono);
    color: var(--accent-emerald);
    font-weight: 600;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-align: center;
    padding: 2rem;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(153, 27, 27, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.25rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    font-weight: 700;
}

.loader-sub {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 320px;
}

/* 9. Unified Synchronized Control Center Bar */
.synchronized-control-card {
    padding: 1.4rem 2rem;
    margin-bottom: 2rem;
    background: #FFFFFF;
    border: 1px solid var(--card-border);
}

.sync-controls-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.sync-buttons-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-primary-glow {
    background: var(--primary-btn);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.3);
}

.btn-primary-glow:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.4);
}

.btn-secondary {
    background: #F3F4F6;
    border: 1px solid var(--card-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #E5E7EB;
    transform: translateY(-1px);
}

.btn-secondary-sm {
    background: #F3F4F6;
    border: 1px solid var(--card-border);
    color: var(--text-main);
    font-size: 0.85rem;
    padding: 0.4rem 0.95rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.btn-secondary-sm:hover {
    background: #E5E7EB;
    border-color: #CBD5E1;
}

/* Toggle Switch Control */
.toggle-control {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
    margin-left: 0.5rem;
}

.toggle-control input {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 22px;
    background: #CBD5E1;
    border-radius: 999px;
    position: relative;
    transition: background 0.25s ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    background: #FFFFFF;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.25s ease;
}

.toggle-control input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-control input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* Synchronized Speed Controls */
.sync-speed-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.speed-control-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
}

.speed-buttons-row {
    display: flex;
    gap: 0.35rem;
}

.speed-btn {
    background: #F3F4F6;
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speed-btn:hover {
    background: #E5E7EB;
}

.speed-btn.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

.speed-slider-input {
    width: 90px;
    accent-color: var(--primary);
    cursor: pointer;
}

.speed-val-display {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 40px;
}

/* 10. Translation & Performance Metrics Card */
.translation-card {
    background: #FFFFFF;
    border-left: 5px solid var(--primary);
}

.section-micro-tag {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.3rem;
}

.gloss-hero-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.gloss-text {
    font-family: var(--font-heading);
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.metrics-pill-cluster {
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.metric-chip {
    background: #FAF7F2;
    border: 1px solid var(--card-border);
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.metric-val {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
}

.text-cyan { color: var(--primary-btn); }
.text-emerald { color: var(--accent-emerald); }
.text-purple { color: var(--primary); }

.meaning-description {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* 11. 10-Module HamNoSys Tag Classification Matrix */
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title-row h3 {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-main);
}

.section-intro-text {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.module-card {
    background: #FAF7F2;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}

.module-card:hover {
    border-color: var(--primary);
    background: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.mod-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.mod-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: #FFFFFF;
    background: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.mod-cat {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.mod-name {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.6rem;
}

.mod-tag-pill {
    background: #1E293B;
    color: #38BDF8;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.6rem;
    word-break: break-all;
}

.mod-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-top: auto;
}

/* 12. Notation & Symbol Breakdown */
.notation-display-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .notation-display-row {
        grid-template-columns: 1fr;
    }
}

.notation-block {
    background: #FAF7F2;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.notation-block-title {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.65rem;
}

.code-box-inline {
    font-family: var(--font-mono);
    color: #1E293B;
    font-size: 0.95rem;
    background: #FFFFFF;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
    word-break: break-all;
    line-height: 1.6;
    font-weight: 600;
}

.hamnosys-font-canvas {
    font-family: var(--font-hamnosys);
    font-size: 2.6rem;
    color: var(--text-main);
    background: #FFFFFF;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--card-border);
    text-align: center;
    letter-spacing: 0.15em;
    min-height: 64px;
}

.symbol-breakdown-wrapper {
    margin-top: 1.25rem;
}

.symbol-chips-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.65rem;
}

.sym-chip {
    display: inline-flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-pill);
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    gap: 0.45rem;
    transition: all 0.2s ease;
}

.sym-chip:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.sym-tag {
    font-family: var(--font-mono);
    color: var(--primary);
    font-weight: 700;
}

.sym-meaning {
    color: var(--text-main);
}

/* 13. SiGML Code Inspector */
.sigml-code-container {
    background: #1E293B;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.sigml-code-pre {
    padding: 1.25rem;
    max-height: 280px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: #F8FAFC;
}

.sigml-code-pre code {
    color: #7DD3FC;
}

/* Utility Hidden */
.hidden {
    display: none !important;
}

/* 14. Performance Measures & Validation Outcomes Card */
.metrics-card {
    background: #FFFFFF;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.5rem 1.75rem;
    margin-bottom: 2rem;
}

.perf-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0 1.5rem 0;
}

.perf-metric-box {
    background: #FAF7F2;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.perf-metric-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.perf-metric-num {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.perf-metric-num.text-success {
    color: #059669;
}

.perf-metric-lbl {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.perf-outcomes-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.perf-outcome-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.perf-outcome-lbl {
    font-weight: 600;
    color: var(--text-muted);
}

.perf-outcome-val {
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.88rem;
}
