/* ══════════════════════════════════════════════════
   Interactive App Demo — Mini PingPad Preview
   ══════════════════════════════════════════════════ */

/* ── Container ── */
.app-demo-section {
    padding: 0 0 120px;
    background: var(--bg-primary);
}

.app-demo-wrap {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

/* ── Window frame ── */
.app-demo-window {
    background: var(--bg-section);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow:
        0 0 0 0.5px rgba(0, 0, 0, 0.03),
        0 20px 60px rgba(0, 0, 0, 0.08),
        0 12px 80px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
}

.app-demo-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.app-demo-titlebar-text {
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-right: 44px;
}

/* ── Body layout ── */
.app-demo-body {
    display: grid;
    grid-template-columns: 164px 1fr;
    height: 420px;
    position: relative;
    overflow: hidden;
}

/* ── Sidebar ── */
.app-demo-sidebar {
    background: #1a1a1e;
    padding: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.app-demo-logo {
    padding: 4px 14px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-demo-logo-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-demo-logo-icon svg {
    width: 14px;
    height: 14px;
    fill: #fff;
}

.app-demo-logo-text {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

.app-demo-nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    cursor: default;
    transition: background 0.2s ease, color 0.2s ease;
    border-radius: 0;
    margin: 0 6px;
    border-radius: 6px;
}

.app-demo-nav-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: 0.6;
}

.app-demo-nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-demo-nav-item.active svg {
    opacity: 1;
}

.app-demo-nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 14px;
}

/* ── Content area ── */
.app-demo-content {
    background: #f8f8fa;
    position: relative;
    overflow: hidden;
}

.app-demo-screen {
    position: absolute;
    inset: 0;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Allow dropdown to overflow in new campaign form */
.app-demo-screen[data-screen="new-campaign"] {
    overflow: visible;
}

.app-demo-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.app-demo-screen-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ── Dashboard screen ── */
.app-dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.app-dash-stat {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}

.app-dash-stat-label {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
    font-weight: 500;
}

.app-dash-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.app-dash-stat-value.accent {
    color: var(--accent);
}

.app-dash-chart {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}

.app-dash-chart-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.app-dash-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100px;
    padding-bottom: 18px;
    position: relative;
}

.app-dash-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.app-dash-bar {
    width: 100%;
    max-width: 28px;
    border-radius: 4px 4px 0 0;
    background: var(--accent);
    opacity: 0.8;
    transition: height 0.5s ease;
}

.app-dash-bar-label {
    font-size: 9px;
    color: var(--text-tertiary);
}

/* ── Campaigns screen ── */
.app-camp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.app-camp-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: default;
    font-family: inherit;
}

.app-camp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-camp-row {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-camp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #30d158;
    flex-shrink: 0;
}

.app-camp-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.app-camp-meta {
    font-size: 11px;
    color: var(--text-tertiary);
}

.app-camp-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 980px;
    background: rgba(48, 209, 88, 0.1);
    color: #30d158;
}

/* ── New Campaign screen ── */
.app-new-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.app-new-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-new-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.app-new-input {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    min-height: 32px;
    display: flex;
    align-items: center;
}

.app-new-input.focused {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.app-new-input-placeholder {
    color: var(--text-tertiary);
}

.app-new-textarea {
    min-height: 64px;
    align-items: flex-start;
    line-height: 1.5;
}

/* Dropdown */
.app-new-select-wrap {
    position: relative;
}

.app-new-select {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
}

.app-new-select.focused {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.app-new-select.has-value {
    color: var(--text-primary);
}

.app-new-select-arrow {
    font-size: 10px;
    color: var(--text-tertiary);
}

.app-new-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    z-index: 10;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-new-dropdown.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.app-new-dropdown-item {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: default;
    transition: background 0.15s ease;
}

.app-new-dropdown-item.highlighted {
    background: rgba(0, 113, 227, 0.08);
    color: var(--accent);
}

.app-new-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: default;
    font-family: inherit;
    align-self: flex-start;
    margin-top: 4px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-new-submit.clicked {
    transform: scale(0.96);
}

/* Success overlay */
.app-new-success {
    position: absolute;
    inset: 0;
    background: rgba(248, 248, 250, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.app-new-success.visible {
    opacity: 1;
}

.app-new-success-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(48, 209, 88, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-new-success-icon svg {
    width: 24px;
    height: 24px;
    stroke: #30d158;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-new-success-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.app-new-success-sub {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ── Contacts screen ── */
.app-contacts-table {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.app-contacts-table-head {
    display: grid;
    grid-template-columns: 1.5fr 1fr 0.6fr 0.8fr;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.app-contacts-table-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 0.6fr 0.8fr;
    gap: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.app-contacts-table-row:last-child {
    border-bottom: none;
}

.app-contacts-name {
    font-weight: 500;
}

.app-contacts-phone {
    color: var(--text-secondary);
}

.app-contacts-state {
    color: var(--text-tertiary);
}

.app-contacts-list-tag {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 113, 227, 0.08);
    color: var(--accent);
    display: inline-block;
}

/* ── Numbers screen ── */
.app-numbers-table {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.app-numbers-table-head {
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 0.7fr 1fr;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.app-numbers-table-row {
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 0.7fr 1fr;
    gap: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.app-numbers-table-row:last-child {
    border-bottom: none;
}

.app-numbers-status {
    font-size: 10px;
    font-weight: 600;
    color: #30d158;
}

.app-numbers-group {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ── Settings screen ── */
.app-settings-section {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.app-settings-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 10px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.app-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

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

.app-settings-label {
    font-size: 12px;
    color: var(--text-primary);
}

.app-settings-value {
    font-size: 12px;
    color: var(--text-tertiary);
}

.app-settings-toggle {
    width: 34px;
    height: 20px;
    border-radius: 10px;
    background: #30d158;
    position: relative;
}

.app-settings-toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    right: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.app-settings-toggle.off {
    background: var(--border);
}

.app-settings-toggle.off::after {
    right: auto;
    left: 2px;
}

/* ── Animated cursor ── */
.app-demo-cursor {
    position: absolute;
    width: 18px;
    height: 22px;
    z-index: 100;
    pointer-events: none;
    transition: left 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
                top 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.app-demo-cursor svg {
    width: 100%;
    height: 100%;
}

/* Click ripple effect */
.app-demo-click {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 113, 227, 0.25);
    pointer-events: none;
    z-index: 99;
    animation: demoClickRipple 0.4s ease-out forwards;
}

@keyframes demoClickRipple {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .app-demo-section {
        display: none;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .app-demo-wrap {
        max-width: 720px;
    }

    .app-demo-body {
        grid-template-columns: 140px 1fr;
        height: 380px;
    }

    .app-dash-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}
