/* ========================================
   Gridkawa - "See It In Action" product demo
   Replica of the Event Grid app shell, driven by demo.js
   ======================================== */

.demo-section {
    padding: 100px 0;
    background: linear-gradient(180deg, #ffffff 0%, var(--light-bg) 100%);
}

.demo-player {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
    margin-top: 48px;
}

/* --- Scene tabs --- */
.demo-tabs { display: flex; flex-direction: column; gap: 10px; }

.demo-tab {
    position: relative;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: white;
    text-align: left;
    color: #334155;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.demo-tab:hover { border-color: #bfd4f6; transform: translateX(2px); }
.demo-tab:focus-visible { outline: 3px solid var(--secondary-color); outline-offset: 2px; }

.demo-tab[aria-selected="true"] {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(0, 102, 204, 0.12);
}

.demo-tab-icon {
    flex: 0 0 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    background: #eff6ff;
    color: var(--primary-color);
    transition: background 0.25s ease, color 0.25s ease;
}

.demo-tab[aria-selected="true"] .demo-tab-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.demo-tab-title { display: block; font-weight: 700; font-size: 0.95rem; color: var(--dark-color); }
.demo-tab-desc { display: block; font-size: 0.8rem; color: #64748b; line-height: 1.4; margin-top: 2px; }

.demo-tab-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.demo-tab[aria-selected="true"] .demo-tab-progress { width: var(--progress, 0%); }

.demo-controls { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding-left: 4px; }

.demo-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid #cbd5e1;
    background: white;
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

.demo-toggle:hover { border-color: var(--primary-color); color: var(--primary-color); }
.demo-toggle:focus-visible { outline: 3px solid var(--secondary-color); outline-offset: 2px; }

/* --- Browser frame (fixed design size, scaled to fit by demo.js) --- */
.demo-viewport { position: relative; width: 100%; }

.demo-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 960px;
    height: 580px;
    transform-origin: top left;
    border-radius: 14px;
    overflow: hidden;
    background: white;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.06);
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: #0f172a;
    line-height: 1.45;
}

.demo-chrome {
    height: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.demo-chrome .dot { width: 11px; height: 11px; border-radius: 50%; }
.demo-chrome .dot.r { background: #ff5f57; }
.demo-chrome .dot.y { background: #febc2e; }
.demo-chrome .dot.g { background: #28c840; }

.demo-url {
    margin-left: 14px;
    flex: 1;
    max-width: 460px;
    height: 24px;
    border-radius: 6px;
    background: white;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
}

.demo-url i { color: #16a34a; font-size: 11px; }
.demo-url b { color: #0f172a; font-weight: 500; }

/* --- App shell --- */
.eg-app { display: flex; height: 540px; }

.eg-side {
    flex: 0 0 188px;
    border-right: 1px solid #e2e8f0;
    padding: 14px 10px;
    background: white;
}

.eg-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; padding: 2px 8px 12px; }

.eg-brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #2563eb;
    display: grid;
    place-items: center;
    color: white;
    font-size: 13px;
}

.eg-side-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0.6px; color: #94a3b8; padding: 10px 8px 4px; text-transform: uppercase; }

.eg-nav {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 12.5px;
    color: #475569;
    transition: background 0.3s ease, color 0.3s ease;
}

.eg-nav i { font-size: 13px; }
.eg-nav.active { background: #eff6ff; color: #2563eb; font-weight: 600; }

.eg-main { flex: 1; min-width: 0; background: #f8fafc; display: flex; flex-direction: column; }

.eg-topbar {
    height: 44px;
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    color: #64748b;
}

.eg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.eg-stage { position: relative; flex: 1; padding: 20px 24px; overflow: hidden; }
.eg-stage > * { animation: egFadeIn 0.4s ease both; }

.eg-kicker { font-size: 11px; color: #64748b; }
.eg-h1 { font-size: 20px; font-weight: 700; margin: 0 0 14px; }

.eg-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
}

.eg-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.eg-field label { display: block; font-size: 11px; font-weight: 600; color: #334155; margin-bottom: 4px; }

.eg-input {
    position: relative;
    height: 32px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: white;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.eg-input.focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.eg-input .ph { color: #94a3b8; }
.eg-input.focus .caret { display: inline-block; width: 1px; height: 15px; background: #0f172a; margin-left: 1px; animation: egBlink 1s steps(1) infinite; }
.eg-input .caret { display: none; }
.eg-input .chev { margin-left: auto; color: #94a3b8; font-size: 11px; }

.eg-menu {
    position: absolute;
    top: 34px;
    left: -1px;
    right: -1px;
    z-index: 5;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    padding: 4px;
    animation: egPop 0.18s ease both;
}

.eg-menu div { padding: 6px 8px; border-radius: 5px; font-size: 12px; }
.eg-menu div.hover { background: #eff6ff; color: #2563eb; }

.eg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border-radius: 7px;
    border: 1px solid transparent;
    font-size: 12.5px;
    font-weight: 600;
    background: #2563eb;
    color: white;
    transition: transform 0.12s ease, background 0.2s ease;
}

.eg-btn.ghost { background: white; color: #334155; border-color: #cbd5e1; }
.eg-btn.success { background: #16a34a; }
.eg-btn.pressed { transform: scale(0.94); }

.eg-toggle { width: 32px; height: 18px; border-radius: 9px; background: #cbd5e1; position: relative; transition: background 0.25s ease; }
.eg-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: white; transition: transform 0.25s ease; }
.eg-toggle.on { background: #2563eb; }
.eg-toggle.on::after { transform: translateX(14px); }

.eg-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 600; }
.eg-badge.blue { background: #eff6ff; color: #2563eb; }
.eg-badge.green { background: #f0fdf4; color: #16a34a; }
.eg-badge.amber { background: #fffbeb; color: #d97706; }
.eg-badge.red { background: #fef2f2; color: #dc2626; }
.eg-badge.purple { background: #f5f3ff; color: #7c3aed; }

.eg-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.eg-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; font-weight: 600; text-align: left; padding: 6px 10px; border-bottom: 1px solid #e2e8f0; }
.eg-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.eg-table tr.new td { animation: egRowIn 0.6s ease both, egFlash 2s ease 0.2s; }

.eg-person { display: flex; align-items: center; gap: 8px; }
.eg-initials { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; color: white; flex: 0 0 24px; }

.eg-bar { height: 8px; border-radius: 4px; background: #e2e8f0; overflow: hidden; }
.eg-bar > span { display: block; height: 100%; border-radius: 4px; background: #2563eb; transition: width 0.7s cubic-bezier(.2,.8,.2,1), background 0.3s ease; }

.eg-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    animation: egRowIn 0.45s ease both;
}

.eg-list-item + .eg-list-item { border-top: 1px solid #f1f5f9; }
.eg-list-item .meta { margin-left: auto; }
.eg-list-item.leaving { animation: egRowOut 0.45s ease both; }

/* Quiz */
.eg-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12.5px;
    margin-bottom: 8px;
    background: white;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.eg-option .radio { width: 15px; height: 15px; border-radius: 50%; border: 2px solid #cbd5e1; transition: all 0.2s ease; }
.eg-option.picked { border-color: #2563eb; background: #eff6ff; }
.eg-option.picked .radio { border: 5px solid #2563eb; }

.eg-steps { display: flex; gap: 6px; margin-bottom: 14px; }
.eg-steps span { flex: 1; height: 5px; border-radius: 3px; background: #e2e8f0; transition: background 0.4s ease; }
.eg-steps span.done { background: #2563eb; }

.eg-ring { width: 120px; height: 120px; position: relative; }
.eg-ring svg { transform: rotate(-90deg); }
.eg-ring circle { fill: none; stroke-width: 10; }
.eg-ring .track { stroke: #e2e8f0; }
.eg-ring .val { stroke: #16a34a; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); }
.eg-ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 800; }

/* Attendance */
.eg-seg { display: inline-flex; border: 1px solid #e2e8f0; border-radius: 7px; overflow: hidden; }
.eg-seg span { padding: 3px 9px; font-size: 11px; color: #64748b; border-left: 1px solid #e2e8f0; transition: background 0.2s ease, color 0.2s ease; }
.eg-seg span:first-child { border-left: 0; }
.eg-seg span.on.p { background: #16a34a; color: white; }
.eg-seg span.on.l { background: #d97706; color: white; }
.eg-seg span.on.a { background: #dc2626; color: white; }

/* Certificates */
.eg-cert {
    position: relative;
    width: 330px;
    padding: 22px 26px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fffdf7, #fff8e6);
    border: 2px solid #e9c46a;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    text-align: center;
    animation: egCert 0.7s cubic-bezier(.2,.9,.3,1.2) both;
}

.eg-cert::before { content: ''; position: absolute; inset: 6px; border: 1px solid rgba(233, 196, 106, 0.6); border-radius: 6px; pointer-events: none; }
.eg-cert .seal { width: 40px; height: 40px; margin: 0 auto 6px; border-radius: 50%; background: #e9c46a; color: white; display: grid; place-items: center; font-size: 18px; }
.eg-cert .t { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: #a16207; }
.eg-cert .n { font-family: Georgia, 'Times New Roman', serif; font-size: 24px; font-style: italic; margin: 6px 0 2px; }
.eg-cert .c { font-size: 11.5px; color: #475569; }

.eg-check { width: 15px; height: 15px; border: 2px solid #cbd5e1; border-radius: 4px; display: inline-grid; place-items: center; font-size: 10px; color: white; transition: all 0.2s ease; }
.eg-check.on { background: #2563eb; border-color: #2563eb; }

.eg-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
    animation: egPop 0.35s ease both;
}

/* Toast */
.eg-toast {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #0f172a;
    color: white;
    font-size: 12px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.3);
    animation: egToast 0.4s cubic-bezier(.2,.9,.3,1.2) both;
}

.eg-toast i { color: #4ade80; font-size: 15px; }
.eg-toast.mail i { color: #60a5fa; }

/* Fake cursor + caption */
.demo-cursor {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 20;
    width: 22px;
    height: 22px;
    pointer-events: none;
    transform: translate(700px, 420px);
    transition: transform 0.75s cubic-bezier(.45,.05,.25,1), opacity 0.3s ease;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}

.demo-cursor::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.35);
    transform: scale(0);
    opacity: 0;
}

.demo-cursor.click::after { animation: egRipple 0.5s ease-out; }
.demo-cursor.hidden { opacity: 0; }

.demo-caption {
    min-height: 1.6em;
    margin-top: 18px;
    text-align: center;
    color: var(--dark-color);
    font-size: 1rem;
    font-weight: 600;
}

.demo-caption::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 10px;
    border-radius: 50%;
    background: var(--secondary-color);
    vertical-align: middle;
    box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.18);
}

.demo-caption:empty::before { display: none; }
.demo-caption.swap { animation: egCaption 0.35s ease both; }

@keyframes egFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes egBlink { 50% { opacity: 0; } }
@keyframes egPop { from { opacity: 0; transform: translateY(-4px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes egRowIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes egRowOut { to { opacity: 0; transform: translateX(16px); height: 0; padding-top: 0; padding-bottom: 0; } }
@keyframes egFlash { 0%, 40% { background: #eff6ff; } 100% { background: transparent; } }
@keyframes egToast { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes egCert { from { opacity: 0; transform: scale(0.7) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes egRipple { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes egCaption { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- Hero dashboard: live feed chip --- */
.hero-dashboard { position: relative; }

.hero-feed {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: white;
    color: #0f172a;
    font-size: 0.8rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hero-feed.show { opacity: 1; transform: none; }
.hero-feed i { font-size: 1.1rem; }
.hero-feed small { display: block; color: #64748b; font-size: 0.7rem; }

/* --- Responsive --- */
@media (max-width: 992px) {
    .demo-player { grid-template-columns: minmax(0, 1fr); }
    .demo-player > * { min-width: 0; }
    .demo-tabs { flex-direction: row; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
    .demo-tab { flex: 0 0 auto; width: auto; padding: 10px 14px; align-items: center; }
    .demo-tab-desc { display: none; }
    .demo-tab-icon { flex-basis: 32px; height: 32px; font-size: 1rem; }
    .demo-controls { order: 3; }
}

@media (max-width: 768px) {
    .demo-section { padding: 60px 0; }
    .demo-caption { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
    .demo-window *, .demo-window *::before, .demo-window *::after, .hero-feed {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
