/* PayZillion ISO 8583 Card Payments Simulator - Main Styles */

/* CSS Variables */
:root {
    /* Brand Colors - PayZillion */
    --pay-orange: #FFAA4D;
    --zillion-blue: #00386A;
    --pay-orange-light: #FFD4A3;
    --pay-orange-dark: #E6922B;
    --pay-orange-subtle: #FFF5EB;
    --zillion-blue-light: #1A5A8A;
    --zillion-blue-dark: #002244;
    --zillion-blue-subtle: #E6EEF5;
    
    /* Unified Accent Colors - Derived from brand */
    --accent-primary: var(--zillion-blue);
    --accent-secondary: var(--pay-orange);
    --accent-gradient: linear-gradient(135deg, var(--zillion-blue) 0%, var(--zillion-blue-light) 100%);
    --accent-gradient-horizontal: linear-gradient(90deg, var(--pay-orange), var(--zillion-blue));
    
    /* UI Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F7FA;
    --bg-tertiary: #E8ECF0;
    --text-primary: #1A1A2E;
    --text-secondary: #4A4A68;
    --text-muted: #6B6B84; /* Fixed: WCAG 4.5:1 contrast ratio */
    --border-color: #D1D5DB;
    --border-light: #E5E7EB;
    
    /* Status Colors - Harmonized with brand */
    --success: #10B981;
    --success-light: #D1FAE5;
    --error: #EF4444;
    --error-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --info: var(--zillion-blue-light);
    --info-light: var(--zillion-blue-subtle);
    
    /* Device Colors - Unified dark theme */
    --device-body: #1F2937;
    --device-body-light: #374151;
    --device-body-dark: #111827;
    --device-accent: var(--zillion-blue);
    
    /* ATM Specific */
    --atm-body: #1F2937;
    --atm-body-light: #374151;
    --atm-screen-bg: #0A1628;
    --atm-screen-text: #00D97E;
    --atm-screen-glow: rgba(0, 217, 126, 0.15);
    --atm-key-bg: #4A5568;
    
    /* POS Specific */
    --pos-body: #1F2937;
    --pos-body-light: #374151;
    --pos-screen-bg: #F0F4F8;
    
    /* E-Commerce Specific */
    --phone-body: #1F2937;
    --phone-body-light: #374151;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Fluid Spacing - scales with viewport */
    --space-xs: clamp(0.2rem, 0.5vw, 0.25rem);
    --space-sm: clamp(0.4rem, 1vw, 0.5rem);
    --space-md: clamp(0.75rem, 2vw, 1rem);
    --space-lg: clamp(1rem, 3vw, 1.5rem);
    --space-xl: clamp(1.5rem, 4vw, 2rem);
    --space-2xl: clamp(2rem, 5vw, 3rem);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Fluid Font Sizes - smooth scaling between breakpoints */
    --text-xs: clamp(0.65rem, 0.6rem + 0.25vw, 0.75rem);
    --text-sm: clamp(0.75rem, 0.7rem + 0.35vw, 0.875rem);
    --text-base: clamp(0.875rem, 0.8rem + 0.5vw, 1rem);
    --text-lg: clamp(1rem, 0.9rem + 0.6vw, 1.125rem);
    --text-xl: clamp(1.1rem, 1rem + 0.7vw, 1.25rem);
    --text-2xl: clamp(1.25rem, 1.1rem + 0.9vw, 1.5rem);
    --text-3xl: clamp(1.5rem, 1.3rem + 1.1vw, 1.875rem);
    --text-4xl: clamp(1.75rem, 1.5rem + 1.3vw, 2.25rem);
    
    /* Device Sizing - fluid width calculations */
    --device-atm-width: clamp(290px, 80vw, 440px);
    --device-pos-width: clamp(250px, 75vw, 320px);
    --device-ecom-width: clamp(280px, 85vw, 380px);
    --device-phone-width: clamp(270px, 82vw, 320px);
    --device-phone-height: clamp(460px, 80vh, 580px);
    
    /* Safe Area Insets for notched devices */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    
    /* Dynamic Viewport Height - fixes mobile Safari */
    --vh-full: 100vh;
    --vh-full: 100dvh;
    
    /* Container query support flag */
    --supports-container-queries: 1;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-primary: #1e1e2e;
    --bg-secondary: #181825;
    --bg-tertiary: #282838;
    --text-primary: #F0F0F5;
    --text-secondary: #B8B8C5;
    --text-muted: #8888A0;
    --border-color: #45455A;
    --border-light: #35354A;
    
    /* Status Colors - Brighter for dark mode visibility */
    --success: #4ADE80;
    --success-light: rgba(74, 222, 128, 0.25);
    --error: #F87171;
    --error-light: rgba(248, 113, 113, 0.25);
    --warning: #FBBF24;
    --warning-light: rgba(251, 191, 36, 0.25);
    --info: #60A5FA;
    --info-light: rgba(96, 165, 250, 0.3);
    
    /* Shadows - Darker with subtle blue tint */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 30px rgba(0, 0, 0, 0.6);
    
    /* Brand adjustments for dark mode - brighter */
    --pay-orange: #FFAA55;
    --pay-orange-subtle: rgba(255, 170, 85, 0.15);
    --zillion-blue: #4A90C0;
    --zillion-blue-light: #6AB0E0;
    --zillion-blue-subtle: rgba(74, 144, 192, 0.2);
}

/* Dark mode specific overrides for better visibility */
[data-theme="dark"] .card-selector-dropdown {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .card-selector-dropdown option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .atm-body,
[data-theme="dark"] .pos-body {
    background: linear-gradient(180deg, #2a2a40 0%, #1a1a2e 100%);
}

[data-theme="dark"] .atm-screen,
[data-theme="dark"] .pos-screen {
    background: #0a0a15;
}

[data-theme="dark"] .log-container {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .log-entry {
    border-color: var(--border-light);
}

[data-theme="dark"] .channel-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .channel-btn.active {
    background: var(--zillion-blue);
    border-color: var(--zillion-blue);
}

[data-theme="dark"] .test-scenario-selector,
[data-theme="dark"] .active-card-selector {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-color: var(--border-color);
}

[data-theme="dark"] .receipt-popup-hint {
    background: rgba(255, 255, 255, 0.05);
    border-top-color: rgba(255, 255, 255, 0.1);
    color: #999;
}

[data-theme="dark"] .card-opt-network {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Respect system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1e1e2e;
        --bg-secondary: #181825;
        --bg-tertiary: #282838;
        --text-primary: #F0F0F5;
        --text-secondary: #B8B8C5;
        --text-muted: #8888A0;
        --border-color: #45455A;
        --border-light: #35354A;
        --success: #4ADE80;
        --success-light: rgba(74, 222, 128, 0.25);
        --error: #F87171;
        --error-light: rgba(248, 113, 113, 0.25);
        --warning: #FBBF24;
        --warning-light: rgba(251, 191, 36, 0.25);
        --info: #60A5FA;
        --info-light: rgba(96, 165, 250, 0.3);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.5);
        --shadow-xl: 0 20px 30px rgba(0, 0, 0, 0.6);
        --pay-orange: #FFAA55;
        --pay-orange-subtle: rgba(255, 170, 85, 0.15);
        --zillion-blue: #4A90C0;
        --zillion-blue-light: #6AB0E0;
        --zillion-blue-subtle: rgba(74, 144, 192, 0.2);
    }
}

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

html {
    font-size: clamp(14px, 0.875rem + 0.25vw, 18px);
    scroll-behavior: smooth;
    /* Prevent text size adjustment on orientation change */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: var(--vh-full);
    display: flex;
    flex-direction: column;
    /* Safe area padding for notched devices */
    padding-top: var(--safe-area-top);
    padding-right: var(--safe-area-right);
    padding-bottom: var(--safe-area-bottom);
    padding-left: var(--safe-area-left);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
    margin-bottom: var(--space-md);
}

a {
    color: var(--zillion-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--zillion-blue-light);
}

/* Header */
.main-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.logo {
    font-size: var(--text-2xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.logo-pay {
    color: var(--pay-orange);
}

.logo-zillion {
    color: var(--zillion-blue);
}

.header-title {
    font-size: var(--text-lg);
    font-weight: 500;
    color: var(--text-secondary);
    display: none;
}

@media (min-width: 1024px) {
    .header-title {
        display: block;
    }
}

.main-nav {
    display: none;
    gap: var(--space-sm);
    margin-left: auto;
}

@media (min-width: 768px) {
    .main-nav {
        display: flex;
    }
}

.nav-item, .nav-btn {
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-item:hover, .nav-btn:hover {
    background: var(--zillion-blue-subtle);
    color: var(--zillion-blue);
}

.nav-item.active, .nav-btn.active {
    background: linear-gradient(135deg, var(--zillion-blue) 0%, var(--zillion-blue-light) 100%);
    color: white;
    border-color: var(--zillion-blue);
    box-shadow: 0 2px 8px rgba(0, 56, 106, 0.2);
}

.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    margin-left: auto;
}

@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none;
    }
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all var(--transition-fast);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-md);
    gap: var(--space-sm);
}

.mobile-nav.active {
    display: flex;
}

@media (min-width: 768px) {
    .mobile-nav {
        display: none !important;
    }
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-xl);
    width: 100%;
}

/* Sections */
.section, .main-section {
    display: none;
}

.section.active, .main-section.active {
    display: block;
    overflow-x: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin: 0;
}

/* Channel Selector */
.channel-selector {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   UNIFIED SIMULATOR CONTROL BAR
   ═══════════════════════════════════════════════════════════════ */
.sim-control-bar {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: var(--space-lg);
    background: var(--bg-primary);
    border-radius: var(--radius-xl, 16px);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: visible;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

/* Channel Tabs Row */
.sim-channels {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-xl, 16px) var(--radius-xl, 16px) 0 0;
    overflow: hidden;
}

.sim-channels .channel-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 0;
    box-shadow: none;
}

.sim-channels .channel-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sim-channels .channel-tab.active {
    color: var(--zillion-blue);
    background: var(--bg-primary);
    border-bottom-color: var(--zillion-blue);
    box-shadow: none;
}

.sim-channels .channel-tab .channel-icon {
    font-size: 1.25em;
}

.sim-channels .channel-tab .channel-label {
    font-size: inherit;
    font-weight: inherit;
}

/* Settings Row (card + timeout) */
.sim-settings-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 10px 16px;
    flex-wrap: wrap;
    border-radius: 0 0 var(--radius-xl, 16px) var(--radius-xl, 16px);
    background: var(--bg-primary);
}

/* Card Group */
.sim-card-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sim-card-select {
    flex: 0 1 220px;
    min-width: 160px;
    padding: 7px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.sim-card-select:hover { border-color: var(--zillion-blue-light); }
.sim-card-select:focus { outline: none; border-color: var(--zillion-blue); box-shadow: 0 0 0 3px rgba(0,56,106,.12); }

/* Custom Card Dropdown */
.sim-card-dropdown {
    position: relative;
    flex: 0 1 280px;
    min-width: 200px;
}

.sim-card-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
    text-align: left;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
}

.sim-card-dropdown-btn #card-dropdown-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-btn-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 1;
}

.dropdown-btn-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sim-card-dropdown-btn:hover { border-color: var(--zillion-blue-light); }
.sim-card-dropdown-btn:focus { outline: none; border-color: var(--zillion-blue); box-shadow: 0 0 0 3px rgba(0,56,106,.12); }
.sim-card-dropdown.open .sim-card-dropdown-btn { border-color: var(--zillion-blue); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.card-dropdown-arrow {
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.sim-card-dropdown.open .card-dropdown-arrow { transform: rotate(180deg); }

.sim-card-dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1.5px solid var(--zillion-blue);
    border-top: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.sim-card-dropdown.open .sim-card-dropdown-list { display: block; }

.sim-card-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color);
}
.sim-card-option:last-child { border-bottom: none; }
.sim-card-option:hover { background: rgba(0,56,106,.08); }
.sim-card-option.selected { background: rgba(0,56,106,.12); }

.card-opt-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.card-opt-status.active { background: #4caf50; box-shadow: 0 0 4px rgba(76,175,80,.5); }
.card-opt-status.expired { background: #ff9800; box-shadow: 0 0 4px rgba(255,152,0,.5); }
.card-opt-status.blocked { background: #f44336; box-shadow: 0 0 4px rgba(244,67,54,.5); }
.card-opt-status.lost { background: #9e9e9e; box-shadow: 0 0 4px rgba(158,158,158,.5); }
.card-opt-status.stolen { background: #9c27b0; box-shadow: 0 0 4px rgba(156,39,176,.5); }
.card-opt-status.restricted { background: #ff5722; box-shadow: 0 0 4px rgba(255,87,34,.5); }

.card-opt-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.card-opt-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-opt-detail {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.3px;
}

.card-opt-balance {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

.card-opt-network {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 30px;
    background: #f0f4f8;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.08);
    overflow: hidden;
}

/* ── Network logo overrides inside dropdown list items ── */
.card-opt-network .network-logo-generic {
    font-size: 14px;
    font-weight: 600;
    color: #00386A;
    -webkit-text-fill-color: #00386A;
}

/* ── Network logo overrides inside dropdown button ── */
.sim-card-dropdown-btn .network-logo-generic {
    font-size: 14px;
    font-weight: 600;
    color: #00386A;
    -webkit-text-fill-color: #00386A;
}

/* Card Preview */
.sim-card-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--zillion-blue) 0%, var(--zillion-blue-light) 100%);
    border-radius: var(--radius-md);
    font-size: 12px;
    color: white;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,56,106,.2);
    transition: transform 0.15s;
}

.sim-card-preview:hover { transform: translateY(-1px); }

.sim-card-preview .card-icon { font-size: 1.1em; }

.sim-card-preview .card-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.3;
}

.sim-card-preview .card-pan {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.sim-card-preview .card-balance {
    font-size: 10px;
    opacity: 0.85;
}

.sim-card-preview .card-pin-hint {
    font-size: 10px;
    opacity: 0.8;
    cursor: pointer;
}

.sim-card-preview .card-pin-hint .pin-actual { display: none; }
.sim-card-preview .card-pin-hint.pin-revealed .pin-value { display: none; }
.sim-card-preview .card-pin-hint.pin-revealed .pin-actual { display: inline; color: #ffd54f; font-weight: 700; }

.sim-card-preview .card-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    flex-shrink: 0;
    box-shadow: 0 0 4px rgba(76,175,80,.5);
}

.sim-card-preview .card-status-dot.expired { background: #ff9800; box-shadow: 0 0 4px rgba(255,152,0,.5); }
.sim-card-preview .card-status-dot.blocked { background: #f44336; box-shadow: 0 0 4px rgba(244,67,54,.5); }

/* Timeout Toggle */
.sim-timeout-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: background 0.15s;
    flex-shrink: 0;
    user-select: none;
}

.sim-timeout-toggle:hover { background: var(--bg-tertiary); }

.sim-timeout-toggle input { display: none; }

.sim-toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--border-color);
    border-radius: 20px;
    transition: background 0.25s;
    flex-shrink: 0;
}

.sim-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.sim-timeout-toggle input:checked + .sim-toggle-track {
    background: #e67e22;
}

.sim-timeout-toggle input:checked + .sim-toggle-track .sim-toggle-thumb {
    transform: translateX(16px);
}

.sim-toggle-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sim-timeout-toggle input:checked ~ .sim-toggle-text {
    color: #e67e22;
}

/* Dark mode overrides */
[data-theme="dark"] .sim-control-bar {
    background: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .sim-channels {
    background: rgba(255,255,255,.03);
}

/* Responsive */
@media (max-width: 640px) {
    .sim-control-bar {
        border-radius: var(--radius-lg);
        margin-left: 8px;
        margin-right: 8px;
    }

    .sim-channels .channel-tab {
        padding: 12px 8px;
        gap: 4px;
        flex-direction: column;
        font-size: 11px;
    }

    .sim-channels .channel-tab .channel-icon {
        font-size: 1.4em;
    }

    .sim-settings-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 12px;
    }

    .sim-card-group {
        flex-direction: column;
        align-items: stretch;
    }

    .sim-card-select {
        flex: 1;
        width: 100%;
    }

    .sim-card-dropdown {
        flex: 1;
        min-width: unset;
    }

    .sim-card-preview {
        width: 100%;
        justify-content: center;
    }

    .sim-timeout-toggle {
        justify-content: center;
        padding: 8px 12px;
        background: var(--bg-tertiary);
        border-radius: var(--radius-md);
    }
}

.channel-btn, .channel-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 120px;
}

.channel-btn:hover, .channel-tab:hover {
    border-color: var(--zillion-blue);
    background: var(--zillion-blue-subtle);
}

.channel-btn.active, .channel-tab.active {
    border-color: var(--zillion-blue);
    background: linear-gradient(135deg, var(--zillion-blue) 0%, var(--zillion-blue-light) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 56, 106, 0.25);
}

/* Global focus visibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.channel-tab:focus-visible,
.nav-item:focus-visible,
.log-btn:focus-visible {
    outline: 3px solid rgba(74, 144, 192, 0.6);
    outline-offset: 2px;
}

/* Channel Content */
.channel-content {
    display: none;
}

.channel-content.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    position: relative;
}

/* Active terminal highlight */
.terminal-active {
    box-shadow:
        0 0 0 2px rgba(74, 144, 192, 0.6),
        0 12px 32px rgba(0, 0, 0, 0.2);
}


#atm-channel.channel-content.active,
#pos-channel.channel-content.active {
    align-items: center;
}

.channel-icon {
    font-size: var(--text-2xl);
}

.channel-label {
    font-weight: 600;
    font-size: var(--text-sm);
}

/* Network Simulation Toggle */
.network-simulation-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-lg);
}

/* Network Timeout Toggle - Enhanced UI */
.test-scenario-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: var(--shadow-sm);
}

.scenario-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.scenario-label::before {
    content: '⏱️';
    font-size: 1.1em;
}

/* Network Timeout Toggle Switch */
.timeout-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
    flex-shrink: 0;
}

.timeout-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.timeout-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.timeout-toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.timeout-toggle input:checked + .timeout-toggle-slider {
    background-color: #e67e22;
}

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

.timeout-toggle input:focus + .timeout-toggle-slider {
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.2);
}

.toggle-hint {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-left: var(--space-sm);
    flex: 1 1 100%;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition-fast);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.toggle-label input:checked + .toggle-slider {
    background: var(--zillion-blue);
}

.toggle-label input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Simulator Container - Side by Side Layout */
.simulator-wrapper {
    display: flex;
    flex-direction: row;
    gap: var(--space-xl);
    align-items: flex-start;
    justify-content: center;
    width: 100%;
}

.simulator-left {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.simulator-right {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

@media (max-width: 900px) {
    .simulator-wrapper {
        flex-direction: row;
        align-items: flex-start;
        gap: var(--space-sm);
    }
    
    .simulator-left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .simulator-right {
        flex: 0 0 100px;
        max-width: 100px;
    }

    /* Compact vertical flow for tablet */
    .transaction-flow {
        padding: var(--space-xs) var(--space-sm);
    }

    .flow-title {
        font-size: 9px;
        margin-bottom: var(--space-xs);
        letter-spacing: 0.3px;
    }

    .flow-diagram {
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }

    .flow-node {
        width: 72px;
        height: 50px;
        padding: var(--space-xs);
        border-radius: var(--radius-sm);
    }

    .node-icon {
        font-size: 14px;
    }

    .node-label {
        font-size: 7px;
        white-space: nowrap;
    }

    .node-status {
        font-size: 6px;
        min-height: 8px;
    }

    .flow-arrow {
        height: 14px;
        width: 3px;
    }

    .arrow-line {
        width: 3px;
        height: 100%;
        border-radius: 1.5px;
    }

    .arrow-packet {
        width: 6px;
        height: 6px;
    }

    /* Flow info labels - compact */
    .flow-info-label {
        font-size: 6px;
        padding: 1px 3px;
    }
}

/* Small mobile: flow diagram ABOVE simulator, horizontal layout */
@media (max-width: 576px) {
    .simulator-wrapper {
        flex-direction: column;
        align-items: center;
    }

    /* Move flow diagram above the simulator on mobile */
    .simulator-right {
        order: -1;
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
    }

    .simulator-left {
        order: 1;
        flex: 1 1 auto;
        width: 100%;
    }

    /* Horizontal flow diagram on mobile */
    .transaction-flow {
        padding: var(--space-sm);
        border-radius: var(--radius-md);
    }

    .flow-title {
        font-size: 10px;
        margin-bottom: var(--space-xs);
    }

    .flow-diagram {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 2px;
        flex-wrap: nowrap;
    }

    .flow-node {
        width: clamp(56px, 18vw, 72px);
        height: 44px;
        padding: 4px;
    }

    .node-icon {
        font-size: 12px;
    }

    .node-label {
        font-size: clamp(6px, 1.8vw, 8px);
        white-space: nowrap;
    }

    .node-status {
        font-size: 6px;
        min-height: 8px;
    }

    .flow-arrow {
        height: auto;
        width: clamp(16px, 4vw, 28px);
        flex-direction: row;
    }

    .arrow-line {
        width: 100%;
        height: 3px;
    }

    .arrow-packet {
        width: 6px;
        height: 6px;
    }

    .flow-info-label {
        font-size: 6px;
        padding: 1px 2px;
    }
}

.simulator-container {
    display: flex;
    justify-content: center;
}

.device-simulator {
    display: none;
}

.device-simulator.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

/* Transaction Flow Visualization */
.transaction-flow {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
}

.flow-title {
    text-align: center;
    margin-bottom: var(--space-sm);
    color: var(--zillion-blue);
    font-size: var(--text-sm);
    font-weight: 600;
}


.flow-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
}

.flow-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 90px;
    height: 70px;
    transition: all var(--transition-fast);
}

.flow-node.active {
    border-color: var(--zillion-blue);
    background: var(--zillion-blue-subtle);
    box-shadow: 0 0 12px rgba(0, 56, 106, 0.2);
}

.flow-node.success {
    border-color: var(--success);
    background: var(--success-light);
}

.flow-node.error {
    border-color: var(--error);
    background: var(--error-light);
}

.node-icon {
    font-size: var(--text-lg);
}

.node-label {
    font-size: 10px;
    font-weight: 600;
    text-align: center;
}

.node-status {
    font-size: 9px;
    color: var(--text-muted);
    min-height: 12px;
}

.flow-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 20px;
    width: 4px;
}

.arrow-line {
    width: 4px;
    height: 100%;
    background: var(--border-color);
    border-radius: 2px;
    position: relative;
    overflow: visible;
}

.arrow-packet {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
}

.arrow-packet.request {
    background: var(--zillion-blue);
    top: -5px;
}

.arrow-packet.response {
    background: var(--success);
    bottom: -5px;
}

.arrow-packet.animating-request {
    animation: packetMoveDown 0.8s ease-in-out forwards;
}

.arrow-packet.animating-response {
    animation: packetMoveUp 0.8s ease-in-out forwards;
}

@keyframes packetMoveDown {
    0% { top: -6px; opacity: 1; }
    100% { top: calc(100% - 6px); opacity: 1; }
}

@keyframes packetMoveUp {
    0% { bottom: -6px; opacity: 1; }
    100% { bottom: calc(100% - 6px); opacity: 1; }
}

.arrow-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: center;
    min-height: 14px;
}

/* ISO Message Log Container - Below simulators */
.iso-message-log-container {
    width: 100%;
    max-width: 900px;
    margin: var(--space-xl) auto 0;
}

/* ISO Message Log */
.iso-message-log {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--zillion-blue);
    color: white;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.log-header h3 {
    color: white;
    margin: 0;
    font-size: var(--text-sm);
}

.log-actions {
    display: flex;
    gap: var(--space-xs);
}

.log-btn {
    padding: 2px var(--space-sm);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    color: white;
    font-size: var(--text-xs);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.log-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.log-btn-toggle {
    font-weight: 700;
    letter-spacing: 1px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.log-btn-toggle.active {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
    color: #ffffff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ========================================
   ISO 8583 LOG CONTENT - Payment Switch Style
   Dark terminal background, monospace throughout
   ======================================== */
.log-content {
    min-height: 450px;
    max-height: 550px;
    overflow-y: auto;
    overflow-x: auto;
    padding: var(--space-md);
    background: #0a0e14;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12.5px;
    line-height: 1.5;
    color: #b0b8c4;
}

.log-placeholder {
    text-align: center;
    padding: var(--space-md);
    color: #4a5568;
}

.log-placeholder .hint {
    font-size: 10px;
    margin-top: var(--space-xs);
}

/* Log Entry */
.log-entry {
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-entry:last-child {
    margin-bottom: 0;
}

/* Paired highlight on hover */
.log-entry.pair-highlight {
    background: rgba(31, 111, 235, 0.08);
}

/* Message lines */
.log-msg-line {
    white-space: pre;
    overflow: hidden;
}

/* Separators — dim box-drawing chars */
.log-msg-separator {
    color: #2d3748;
    font-size: 11px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* Header line: timestamp >>> OUTGOING  MTI:0100  STAN:... RRN:... */
.log-msg-header {
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-ts {
    color: #718096;
}

.log-dir-icon {
    font-weight: 700;
}

/* Outgoing (request) = blue indicator, Incoming (response) = green */
.log-entry.request .log-dir-icon,
.log-entry.request .log-dir-label {
    color: #63b3ed;
}

.log-entry.response .log-dir-icon,
.log-entry.response .log-dir-label {
    color: #68d391;
}

.log-dir-label {
    font-weight: 700;
}

.log-msg-mti {
    color: #fc8181;
    font-weight: 600;
}

.log-msg-stan {
    color: #90cdf4;
}

.log-msg-rrn {
    color: #90cdf4;
}

/* MTI description line */
.log-msg-desc {
    color: #a0aec0;
    font-style: italic;
    padding-left: 2px;
}

/* Bitmap line */
.log-msg-bitmap {
    color: #718096;
    word-break: break-all;
    white-space: pre-wrap;
}

/* ========================================
   DATA ELEMENT FIELDS
   DE### [len] FieldName.......... Value
   ======================================== */
.log-fields {
    padding: 2px 0;
}

.log-field {
    display: flex;
    align-items: baseline;
    padding: 1px 0;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
}

.log-field-id {
    color: #ed8936;
    font-weight: 700;
    width: 5ch;
    flex-shrink: 0;
    margin-right: 1ch;
}

.log-field-len {
    color: #4a5568;
    font-size: 11px;
    width: 5ch;
    flex-shrink: 0;
    text-align: right;
    margin-right: 1ch;
}

.log-field-name {
    color: #a0aec0;
    font-size: 12px;
    width: 28ch;
    flex-shrink: 0;
    margin-right: 1ch;
}

.log-field-value {
    color: #68d391;
    word-break: break-all;
    white-space: pre-wrap;
    font-weight: 500;
}

/* Hex Dump Section */
.log-hex-dump {
    margin: 4px 0;
    padding: 0;
}

.log-hex-dump .log-msg-separator {
    color: #ff9f43;
    font-weight: 600;
}

.log-hex-content {
    margin: 0;
    padding: 4px 8px;
    color: #a0aec0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.5;
    background: rgba(255, 159, 67, 0.05);
    border-left: 2px solid rgba(255, 159, 67, 0.3);
    white-space: pre;
    overflow-x: auto;
}

/* ========================================
   ISO 8583 LOG - RESPONSIVE
   Payment switch text adapts to screen size
   Same monospace terminal look on all screens
   ======================================== */

/* Tablet view */
@media (max-width: 1024px) {
    .iso-message-log-container {
        max-width: 100%;
        margin: var(--space-md) 0;
    }
    
    .log-content {
        min-height: 300px;
        max-height: 400px;
        padding: var(--space-sm);
        font-size: 11.5px;
    }
}

/* Small tablet / large phone */
@media (max-width: 768px) {
    .log-content {
        min-height: 250px;
        max-height: 350px;
        font-size: 11px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .log-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-xs);
        padding: var(--space-sm);
    }
    
    .log-header h3 {
        font-size: var(--text-xs);
    }
    
    .log-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .log-field {
        font-size: 11px;
    }
    
    /* Ensure log entries don't wrap on smaller screens */
    .log-entry {
        min-width: 600px;
    }
}

/* Mobile phone - below 600px */
@media (max-width: 600px) {
    .iso-message-log-container {
        margin: var(--space-sm) 0;
        border-radius: var(--radius-md);
    }
    
    .iso-message-log {
        border-radius: var(--radius-md);
    }
    
    .log-content {
        min-height: 200px;
        max-height: 300px;
        padding: 8px;
        font-size: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Keep same terminal format — horizontal scroll instead of stacking */
    .log-entry {
        min-width: 560px;
    }
    
    .log-field {
        font-size: 10px;
    }
    
    .log-field-id {
        font-size: 10px;
    }
    
    .log-field-name {
        font-size: 10px;
    }
    
    .log-field-value {
        font-size: 10px;
    }
}

/* Very small phone screens */
@media (max-width: 400px) {
    .log-content {
        min-height: 180px;
        max-height: 250px;
        padding: 6px;
        font-size: 9px;
    }
    
    .log-entry {
        min-width: 520px;
    }
    
    .log-field {
        font-size: 9px;
    }
}

/* Touch device optimizations for log */
@media (hover: none) and (pointer: coarse) {
    .log-btn {
        min-height: 36px;
        padding: 6px 12px;
        font-size: var(--text-sm);
    }
    
    .log-actions {
        gap: var(--space-sm);
    }
    
    .log-entry {
        -webkit-tap-highlight-color: rgba(31, 111, 235, 0.2);
    }
}

/* Footer */
.main-footer {
    background: var(--zillion-blue);
    color: white;
    padding: var(--space-lg) var(--space-xl);
    text-align: center;
}

.footer-content p {
    margin: var(--space-xs) 0;
    font-size: var(--text-sm);
}

.footer-brand {
    font-weight: 600;
}

.footer-brand .logo-pay,
.footer-brand .logo-zillion {
    color: white;
}

.footer-credit {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--text-xs) !important;
}

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

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

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.text-warning {
    color: var(--warning);
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--zillion-blue);
    color: white;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--zillion-blue);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .main-header,
    .main-nav,
    .mobile-nav,
    .channel-selector,
    .network-simulation-toggle,
    .device-simulator,
    .log-actions,
    .main-footer {
        display: none !important;
    }
    
    .section, .main-section {
        display: block !important;
    }
}

/* Modal Base Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-md);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    font-size: var(--text-2xl);
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.receipt-modal-content {
    padding: var(--space-xl);
}

/* =========================================
   UI/UX IMPROVEMENTS - Phase 1 & 2
   ========================================= */

/* 1. Focus States & Keyboard Accessibility */
.atm-key:focus-visible,
.pos-key:focus-visible,
.softkey:focus-visible,
.channel-tab:focus-visible,
.nav-item:focus-visible,
.card-action-btn:focus-visible {
    outline: 3px solid var(--pay-orange);
    outline-offset: 2px;
    z-index: 10;
}

.atm-key:focus,
.pos-key:focus {
    box-shadow: 0 0 0 3px rgba(255, 170, 77, 0.5);
}

/* Keyboard shortcut hints */
.key-hint-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--zillion-blue);
    color: white;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.show-keyboard-hints .key-hint-badge {
    opacity: 1;
}

/* 4. Onboarding Overlay */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.onboarding-overlay.active {
    opacity: 1;
    visibility: visible;
}

.onboarding-content {
    background: white;
    border-radius: var(--radius-xl);
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--space-lg) var(--space-xl);
    position: relative;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.onboarding-header {
    text-align: center;
    margin-bottom: var(--space-md);
}

.onboarding-header .logo {
    font-size: var(--text-xl);
    margin-bottom: var(--space-xs);
}

.onboarding-header h2 {
    color: var(--zillion-blue);
    margin-bottom: 2px;
    font-size: var(--text-lg);
}

.onboarding-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: var(--text-sm);
}

.onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.onboarding-step {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--zillion-blue);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.onboarding-step:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.onboarding-step[data-color="blue"]  { border-left-color: #2563eb; }
.onboarding-step[data-color="green"] { border-left-color: #16a34a; }
.onboarding-step[data-color="purple"]{ border-left-color: #7c3aed; }
.onboarding-step[data-color="orange"]{ border-left-color: #ea580c; }
.onboarding-step[data-color="teal"]  { border-left-color: #0d9488; }

.onboarding-step[data-color="blue"]  .step-icon { background: rgba(37,99,235,0.1); }
.onboarding-step[data-color="green"] .step-icon { background: rgba(22,163,74,0.1); }
.onboarding-step[data-color="purple"] .step-icon { background: rgba(124,58,237,0.1); }
.onboarding-step[data-color="orange"] .step-icon { background: rgba(234,88,12,0.1); }
.onboarding-step[data-color="teal"]  .step-icon { background: rgba(13,148,136,0.1); }

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.step-content h4 {
    margin: 0 0 2px 0;
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.step-content p {
    margin: 0;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.onboarding-tip {
    background: var(--info-light);
    border-left: 3px solid var(--info);
    padding: var(--space-sm) var(--space-md);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: var(--space-md);
    font-size: var(--text-sm);
}

.onboarding-tip strong {
    color: var(--info);
}

.onboarding-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.onboarding-btn {
    padding: var(--space-sm) var(--space-xl);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.onboarding-btn.primary {
    background: var(--zillion-blue);
    color: white;
}

.onboarding-btn.primary:hover {
    background: var(--zillion-blue-light);
}

.onboarding-close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: none;
    border: none;
    font-size: var(--text-lg);
    cursor: pointer;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.onboarding-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.onboarding-footer {
    text-align: center;
    margin-top: var(--space-sm);
}

.onboarding-footer label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Mobile adjustments for onboarding */
@media (max-width: 500px) {
    .onboarding-content {
        padding: var(--space-md);
    }
    .step-icon {
        width: 34px;
        height: 34px;
        font-size: 17px;
    }
    .onboarding-step {
        gap: var(--space-sm);
        padding: var(--space-xs) var(--space-sm);
    }
}

/* 5. Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: var(--space-md);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 380px;
    pointer-events: none;
}

.toast-notification {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    transform: translateX(120%);
    transition: transform var(--transition-normal);
    pointer-events: auto;
    border-left: 4px solid var(--info);
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-notification.success {
    border-left-color: var(--success);
}

.toast-notification.error {
    border-left-color: var(--error);
}

.toast-notification.warning {
    border-left-color: var(--warning);
}

.toast-notification.info {
    border-left-color: var(--info);
}

.toast-icon {
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: 2px;
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    margin: -4px -4px -4px 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* 6. Transaction Filtering */
.transaction-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.filter-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-select,
.filter-input {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    background: white;
    min-width: 120px;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--zillion-blue);
}

.filter-input {
    min-width: 180px;
}

.filter-input::placeholder {
    color: var(--text-muted);
}

.filter-clear-btn {
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    color: var(--text-secondary);
}

.filter-clear-btn:hover {
    background: var(--border-color);
}

.no-results-row td {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

/* 7. Progress Indicators */
.progress-indicator {
    display: none;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--info-light);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.progress-indicator.active {
    display: flex;
}

.progress-steps {
    display: flex;
    gap: 4px;
    align-items: center;
}

.progress-step {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.progress-step.active {
    background: var(--zillion-blue);
    animation: pulse 1s infinite;
}

.progress-step.complete {
    background: var(--success);
}

.progress-connector {
    width: 20px;
    height: 2px;
    background: var(--border-color);
}

.progress-connector.complete {
    background: var(--success);
}

.progress-text {
    font-size: var(--text-sm);
    color: var(--zillion-blue);
    font-weight: 500;
    margin-left: auto;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 8. Mobile Navigation Improvements */
.mobile-nav {
    transform: translateY(-100%);
    transition: transform var(--transition-normal);
}

.mobile-nav.active {
    transform: translateY(0);
    display: flex;
}

.channel-selector {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: var(--space-xs);
}

.channel-selector::-webkit-scrollbar {
    display: none;
}

@media (max-width: 576px) {
    .channel-selector {
        justify-content: flex-start;
        flex-wrap: nowrap;
        padding: 0 var(--space-md);
    }
    
    .channel-tab {
        flex-shrink: 0;
    }
}

/* 9. Card Selector in Simulator - Enhanced UI */
.active-card-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.card-selector-label {
    font-size: var(--text-sm);
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.card-selector-label::before {
    content: '💳';
    font-size: 1.1em;
}

.card-selector-dropdown {
    flex: 0 1 auto;
    width: 260px;
    max-width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.card-selector-dropdown:hover {
    border-color: var(--zillion-blue-light);
}

.card-selector-dropdown:focus {
    outline: none;
    border-color: var(--zillion-blue);
    box-shadow: 0 0 0 3px rgba(0, 56, 106, 0.15);
}

.card-preview-mini {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, var(--zillion-blue) 0%, var(--zillion-blue-light) 100%);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: white;
    min-width: 200px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}

.card-preview-mini:hover {
    transform: translateY(-1px);
}

.card-preview-mini .card-icon {
    font-size: var(--text-xl);
    display: flex;
    align-items: center;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
}

/* Scale MC logo for mini preview */
.card-preview-mini .card-icon .network-logo-mc {
    width: 24px;
    height: 15px;
}

.card-preview-mini .card-icon .mc-dot {
    width: 14px;
    height: 14px;
}

.card-preview-mini .card-icon .mc-dot.yellow {
    left: 8px;
}

/* Generic text in mini preview */
.card-preview-mini .card-icon .network-logo-generic {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.card-preview-mini .card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-preview-mini .card-pan {
    font-family: 'Consolas', monospace;
    font-weight: 600;
    font-size: var(--text-sm);
    letter-spacing: 0.5px;
}

.card-preview-mini .card-balance {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.85);
}

.card-preview-mini .card-pin-hint {
    font-size: var(--text-xs);
    color: #ffd700;
    font-weight: 600;
    font-family: 'Consolas', monospace;
}

.card-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 4px var(--success);
}

.card-status-dot.expired {
    background: var(--warning);
    box-shadow: 0 0 4px var(--warning);
}

.card-status-dot.blocked {
    background: var(--error);
    box-shadow: 0 0 4px var(--error);
}

/* 10. ISO Log Readability Improvements */
.log-field.de-amount .log-field-value {
    color: #7EE787;
}

.log-field.de-identifier .log-field-value {
    color: #79C0FF;
}

.log-field.de-code .log-field-value {
    color: #FFA657;
}

.log-field.de-date .log-field-value {
    color: #D2A8FF;
}

.log-collapsible-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    padding: 4px 0;
    color: #8B949E;
    font-size: 10px;
}

.log-collapsible-header:hover {
    color: #C9D1D9;
}

.log-collapsible-icon {
    transition: transform var(--transition-fast);
}

.log-collapsible.collapsed .log-collapsible-icon {
    transform: rotate(-90deg);
}

.log-collapsible.collapsed .log-collapsible-content {
    display: none;
}

.log-de-count {
    background: #30363D;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
}

/* 11. Help Navigation Improvements */
.help-search-container {
    margin-bottom: var(--space-md);
}

.help-search-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.help-search-input:focus {
    outline: none;
    border-color: var(--zillion-blue);
}

.back-to-top-btn {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    width: 44px;
    height: 44px;
    background: var(--zillion-blue);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top-btn:hover {
    background: var(--zillion-blue-light);
    transform: translateY(-2px);
}

.help-toc {
    position: sticky;
    top: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}

.help-toc h4 {
    font-size: var(--text-sm);
    margin-bottom: var(--space-sm);
    color: var(--zillion-blue);
}

.help-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-toc-list li {
    margin-bottom: var(--space-xs);
}

.help-toc-list a {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.help-toc-list a:hover {
    color: var(--zillion-blue);
}

/* 12. Card Edit Confirmations */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.confirm-dialog-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.confirm-dialog-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
}

.confirm-dialog h3 {
    margin-bottom: var(--space-sm);
}

.confirm-dialog p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.confirm-dialog-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.confirm-btn {
    padding: var(--space-sm) var(--space-xl);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.confirm-btn.cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.confirm-btn.cancel:hover {
    background: var(--border-color);
}

.confirm-btn.danger {
    background: var(--error);
    color: white;
}

.confirm-btn.danger:hover {
    background: #DC2626;
}

.confirm-btn.primary {
    background: var(--zillion-blue);
    color: white;
}

.confirm-btn.primary:hover {
    background: var(--zillion-blue-light);
}

/* Reset single card button */
.reset-card-btn {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.reset-card-btn:hover {
    background: var(--warning);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════
   PIN MASKING (PCI Compliance)
   ═══════════════════════════════════════════════════════════════ */
.pin-masked {
    cursor: pointer;
    user-select: none;
}

.pin-masked .pin-actual {
    display: none;
}

.pin-masked .pin-value {
    display: inline;
    letter-spacing: 2px;
    color: #999;
}

.pin-masked.pin-revealed .pin-actual {
    display: inline;
}

.pin-masked.pin-revealed .pin-value {
    display: none;
}

.card-pin-hint.pin-masked {
    cursor: pointer;
    transition: opacity 0.2s;
}

.card-pin-hint.pin-masked:hover {
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════
   BITMAP VISUAL GRID
   ═══════════════════════════════════════════════════════════════ */
.bitmap-grid {
    display: inline-grid;
    grid-template-rows: repeat(8, 1fr);
    gap: 1px;
    margin: 4px 0;
    font-size: 0;
}

.bitmap-row {
    display: flex;
    gap: 1px;
}

.bitmap-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 20px;
    font-size: 9px;
    font-family: 'Courier New', monospace;
    background: var(--bg-secondary, #f5f5f5);
    color: var(--text-muted, #999);
    border-radius: 2px;
    cursor: default;
    transition: all 0.15s;
}

.bitmap-cell.active {
    background: var(--primary, #00386A);
    color: #fff;
    font-weight: bold;
}

.bitmap-hex {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: var(--text-muted, #888);
    margin-top: 4px;
    letter-spacing: 1px;
}

/* Dark mode bitmap */
[data-theme="dark"] .bitmap-cell {
    background: #2a2a3e;
    color: #666;
}

[data-theme="dark"] .bitmap-cell.active {
    background: #3b82f6;
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   FLOW INFO LABEL (MTI / Response Code)
   ═══════════════════════════════════════════════════════════════ */
.flow-info-label {
    position: absolute;
    top: 8px;
    right: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.3s ease;
    z-index: 5;
    pointer-events: none;
}

.flow-info-label.visible {
    opacity: 1;
    transform: translateY(0);
}

.flow-info-label.request {
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
}

.flow-info-label.approved {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.flow-info-label.declined {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

[data-theme="dark"] .flow-info-label.request {
    background: #1e3a5f;
    color: #90caf9;
}

[data-theme="dark"] .flow-info-label.approved {
    background: #1b3a1b;
    color: #a5d6a7;
}

[data-theme="dark"] .flow-info-label.declined {
    background: #3a1b1b;
    color: #ef9a9a;
}

.flow-diagram {
    position: relative;
}

/* ═══════════════════════════════════════════════════════════════
   CARD BRAND DETECTION (eCommerce)
   ═══════════════════════════════════════════════════════════════ */
.cc-brand-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.cc-brand-icon.visible {
    opacity: 1;
}

.brand-generic {
    color: #00386A;
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSE CODE BADGE (Transaction Table)
   ═══════════════════════════════════════════════════════════════ */
.rc-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    min-width: 24px;
    text-align: center;
}

.rc-badge.approved {
    background: #e8f5e9;
    color: #2e7d32;
}

.rc-badge.declined {
    background: #ffebee;
    color: #c62828;
}

.rc-badge.timeout {
    background: #fff3e0;
    color: #e65100;
}

.rc-badge.reversed {
    background: #e3f2fd;
    color: #1565c0;
}

[data-theme="dark"] .rc-badge.approved { background: #1b3a1b; color: #a5d6a7; }
[data-theme="dark"] .rc-badge.declined { background: #3a1b1b; color: #ef9a9a; }
[data-theme="dark"] .rc-badge.timeout { background: #3a2e1b; color: #ffcc80; }
[data-theme="dark"] .rc-badge.reversed { background: #1b2e3a; color: #90caf9; }

/* ═══════════════════════════════════════════════════════════════
   CARD NETWORK LOGOS (Card Management)
   ═══════════════════════════════════════════════════════════════ */
.network-logo-generic {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   PAY BUTTON LOADING STATE (eCommerce)
   ═══════════════════════════════════════════════════════════════ */
.pay-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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

/* ═══════════════════════════════════════════════════════════════
   RECEIPT COPY TOGGLE (POS)
   ═══════════════════════════════════════════════════════════════ */
.receipt-copy-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    justify-content: center;
}

.copy-toggle-btn {
    padding: 4px 12px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-toggle-btn.active {
    background: var(--primary, #00386A);
    color: #fff;
    border-color: var(--primary, #00386A);
}

.copy-toggle-btn:hover:not(.active) {
    background: #e8e8e8;
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER VERSION
   ═══════════════════════════════════════════════════════════════ */
.footer-version {
    font-size: 11px;
    color: var(--text-muted, #888);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   TRANSACTION ROW CLICKABLE
   ═══════════════════════════════════════════════════════════════ */
.transaction-row:hover {
    background: rgba(0, 56, 106, 0.04) !important;
    transition: background 0.15s;
}

[data-theme="dark"] .transaction-row:hover {
    background: rgba(255, 255, 255, 0.04) !important;
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE CONTRAST IMPROVEMENTS
   ═══════════════════════════════════════════════════════════════ */
[data-theme="dark"] .atm-display-content,
[data-theme="dark"] .atm-display-title {
    color: #33ff33;
}

[data-theme="dark"] .pos-display-title,
[data-theme="dark"] .pos-display-line {
    color: #e0e0e0;
}

[data-theme="dark"] .log-field-value {
    color: #90caf9;
}

[data-theme="dark"] .flow-node {
    border-color: #444;
    background: var(--bg-secondary, #2a2a3e);
}

[data-theme="dark"] .flow-node.active,
[data-theme="dark"] .flow-node.processing {
    border-color: #3b82f6;
}

[data-theme="dark"] .flow-node.complete {
    border-color: #4caf50;
}

[data-theme="dark"] .flow-node.error {
    border-color: #f44336;
}

/* ═══════════════════════════════════════════════════════════════
   POS AMOUNT CONFIRM SCREEN
   ═══════════════════════════════════════════════════════════════ */
.pos-amount-confirm {
    text-align: center;
    padding: 8px 0;
}

.pos-confirm-amount {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: inherit;
    margin: 4px 0;
}

.pos-confirm-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.pos-confirm-yes {
    background: #2e7d32 !important;
    color: #fff !important;
    border: none !important;
}

.pos-confirm-yes:hover {
    background: #1b5e20 !important;
}

.pos-confirm-no {
    background: #c62828 !important;
    color: #fff !important;
    border: none !important;
}

.pos-confirm-no:hover {
    background: #b71c1c !important;
}

/* ═══════════════════════════════════════════════════════════════
   SESSION RESET BUTTON
   ═══════════════════════════════════════════════════════════════ */
.header-icon-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header-icon-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
}

/* ═══════════════════════════════════════════════════════════════
   RESET ALL CARDS BUTTON
   ═══════════════════════════════════════════════════════════════ */
#reset-all-cards-btn {
    background: transparent;
    border: 1px solid var(--warning, #ff9800);
    color: var(--warning, #ff9800);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

#reset-all-cards-btn:hover {
    background: var(--warning, #ff9800);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   REQUEST/RESPONSE PAIRING (ISO Log)
   ═══════════════════════════════════════════════════════════════ */
.log-entry.paired {
    border-left: 3px solid transparent;
}

.log-entry.paired.request {
    border-left-color: #1565c0;
}

.log-entry.paired.response {
    border-left-color: #2e7d32;
}

/* Hover pairing highlight */
.log-entry.paired:hover {
    background: rgba(0, 56, 106, 0.04);
}

.log-entry.pair-highlight {
    background: rgba(0, 56, 106, 0.08) !important;
    transition: background 0.2s;
}

[data-theme="dark"] .log-entry.paired:hover,
[data-theme="dark"] .log-entry.pair-highlight {
    background: rgba(59, 130, 246, 0.1) !important;
}

/* ═══════════════════════════════════════════════════════════════
   CARD VISUAL ENHANCEMENT (Chip & Contactless)
   ═══════════════════════════════════════════════════════════════ */
.card-chip-icon {
    width: 30px;
    height: 22px;
    background: linear-gradient(135deg, #d4af37 0%, #f5d87e 40%, #d4af37 60%, #b8972e 100%);
    border-radius: 3px;
    display: inline-block;
    position: relative;
    border: 1px solid rgba(180, 150, 60, 0.5);
}

.card-chip-icon::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    border: 1px solid rgba(180, 150, 60, 0.4);
    border-radius: 1px;
}

.card-contactless-icon {
    font-size: 14px;
    opacity: 0.8;
}
