/* ============================================
   IMEI Tracker - Modern UI Styles
   ============================================ */

:root {
    /* Colors - Dark theme (default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-card-hover: #1c1c28;
    --bg-input: #1a1a25;
    --border: #2a2a3a;
    --border-focus: #6366f1;
    --text-primary: #e8e8f0;
    --text-secondary: #8888a0;
    --text-muted: #555568;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --tac-color: #818cf8;
    --serial-color: #34d399;
    --check-color: #fbbf24;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

.light-theme {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f9f9fb;
    --bg-input: #f0f0f5;
    --border: #e0e0e8;
    --border-focus: #6366f1;
    --text-primary: #1a1a2e;
    --text-secondary: #666680;
    --text-muted: #999aad;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea {
    touch-action: manipulation;
}

/* ============================================
   Background Effects
   ============================================ */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
    animation: float 20s ease-in-out infinite;
}

.glow-1 {
    width: 600px;
    height: 600px;
    background: #6366f1;
    top: -200px;
    left: -100px;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: #8b5cf6;
    bottom: -150px;
    right: -100px;
    animation-delay: -7s;
}

.glow-3 {
    width: 400px;
    height: 400px;
    background: #06b6d4;
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(10px, 30px) scale(1.02); }
}

/* ============================================
   App Layout
   ============================================ */
.app {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Header
   ============================================ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius-md);
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.05em;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* ============================================
   Tabs
   ============================================ */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 28px;
}

.tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--text-secondary);
    background: var(--bg-card);
}

.tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.tab svg {
    flex-shrink: 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* ============================================
   Input Section
   ============================================ */
.input-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    padding-right: 64px;
}

.input-wrapper input,
input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

textarea {
    font-size: 0.95rem;
    letter-spacing: 0.1em;
    resize: vertical;
    min-height: 120px;
}

input[type="number"] {
    font-size: 1rem;
    letter-spacing: 0;
}

.input-wrapper input:focus,
input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.char-count {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.input-hints {
    margin-top: 8px;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.hint code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.generator-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* ============================================
   Results
   ============================================ */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: slideUp 0.4s ease;
}

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

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color 0.2s ease;
}

.result-card:hover {
    border-color: color-mix(in srgb, var(--border) 50%, var(--accent) 50%);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.card-title svg {
    color: var(--accent);
    flex-shrink: 0;
}

/* Status Card */
.status-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 24px;
}

.status-card.valid {
    border-color: var(--success);
    background: var(--success-bg);
}

.status-card.invalid {
    border-color: var(--error);
    background: var(--error-bg);
}

.status-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.5rem;
}

.status-card.valid .status-icon {
    background: var(--success);
    color: white;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.status-card.invalid .status-icon {
    background: var(--error);
    color: white;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.status-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.status-card.valid .status-info h3 { color: var(--success); }
.status-card.invalid .status-info h3 { color: var(--error); }

.status-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* IMEI Breakdown */
.imei-breakdown {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px;
}

.imei-breakdown::-webkit-scrollbar {
    display: none;
}

.imei-digit {
    flex: 1 1 0;
    min-width: 16px;
    max-width: 42px;
    height: clamp(34px, 8.5vw, 52px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.75rem, 3.2vw, 1.2rem);
    font-weight: 600;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-sizing: border-box;
    padding: 0;
}

.imei-digit.tac {
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(129, 140, 248, 0.3);
    color: var(--tac-color);
}

.imei-digit.serial {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--serial-color);
}

.imei-digit.check {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    color: var(--check-color);
}

.structure-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.tac { background: var(--tac-color); }
.legend-color.serial { background: var(--serial-color); }
.legend-color.check { background: var(--check-color); }

/* Device Info */
.device-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.info-item {
    padding: 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.info-item-highlight {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
}

.info-item-highlight .info-value {
    color: var(--accent-hover);
    font-size: 1.05rem;
}

.info-item-full {
    grid-column: 1 / -1;
}

.info-item .info-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.info-item .info-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.info-item .info-value code {
    font-family: 'JetBrains Mono', monospace;
    color: var(--tac-color);
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.tag-badge.success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.tag-badge.warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.tag-badge.info {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.spinner-small {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.external-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.external-links .btn {
    text-decoration: none;
    font-size: 0.75rem;
    padding: 6px 12px;
}

.gen-device-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Luhn Steps */
.luhn-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.luhn-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: 1px solid var(--border);
}

.luhn-step .step-num {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.luhn-step .step-text {
    color: var(--text-secondary);
    flex: 1;
}

.luhn-step .step-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   Bulk Results
   ============================================ */
.bulk-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bulk-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.bulk-item:hover {
    border-color: var(--accent);
}

.bulk-item .bulk-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.bulk-item .bulk-status.valid { background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,0.4); }
.bulk-item .bulk-status.invalid { background: var(--error); box-shadow: 0 0 8px rgba(239,68,68,0.4); }

.bulk-item .bulk-imei {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    flex: 1;
}

.bulk-item .bulk-device {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
}

.bulk-item .bulk-label {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bulk-label.valid {
    background: var(--success-bg);
    color: var(--success);
}

.bulk-label.invalid {
    background: var(--error-bg);
    color: var(--error);
}

/* ============================================
   Generated List
   ============================================ */
.generated-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gen-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gen-item:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.gen-item .gen-imei {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.12em;
}

.gen-item .gen-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.gen-item:hover .gen-copy {
    color: var(--accent);
}

/* ============================================
   History
   ============================================ */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.history-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

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

.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.history-item .hist-imei {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    flex: 1;
}

.history-item .hist-device {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-item .hist-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-item .hist-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.history-item .hist-status.valid { background: var(--success); }
.history-item .hist-status.invalid { background: var(--error); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================
   Live GPS Map & Radar Styles
   ============================================ */
.map-card-container {
    padding: 0;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

.map-hud-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.hud-item {
    display: flex;
    flex-direction: column;
}

.hud-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.hud-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hud-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.hud-dot.waiting {
    background: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
    animation: blinkDot 1.4s ease-in-out infinite;
}

.hud-dot.active {
    background: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
    animation: blinkDot 1.8s ease-in-out infinite;
}

.hud-dot.simulated {
    background: var(--tac-color);
    box-shadow: 0 0 8px rgba(129, 140, 248, 0.8);
}

@keyframes blinkDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.hud-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.live-map-element {
    width: 100%;
    height: clamp(340px, 50vh, 520px);
    background: #0f1016;
    z-index: 1;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Radar Pulse Marker in Leaflet */
.radar-marker-wrap {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-ping-ring {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.35);
    border: 2px solid var(--accent);
    animation: radarSweep 1.8s ease-out infinite;
    pointer-events: none;
}

.radar-core-dot {
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2.5px solid #ffffff;
    box-shadow: 0 0 14px var(--accent);
}

@keyframes radarSweep {
    0% { transform: scale(0.3); opacity: 1; }
    100% { transform: scale(2.6); opacity: 0; }
}

/* Custom Leaflet popup dark styles */
.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
}

/* Leaflet Layer Control Dark Styles */
.leaflet-control-layers {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-md) !important;
    font-family: inherit !important;
    font-size: 0.8rem !important;
    padding: 8px 12px !important;
}

.leaflet-control-layers-expanded {
    background: var(--bg-card) !important;
}

.leaflet-control-layers-base label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 4px !important;
    cursor: pointer !important;
    color: var(--text-primary) !important;
}

.leaflet-control-layers-base input[type="radio"] {
    accent-color: var(--accent) !important;
    cursor: pointer !important;
}

/* ============================================
   Lost & Recovery Hub Styles
   ============================================ */
.section-badge-header {
    margin-bottom: 8px;
}

.section-badge-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 10px 0 6px 0;
    color: var(--text-primary);
}

.subtitle-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.blacklist-result-box {
    margin-top: 20px;
    padding: 18px 22px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 1px solid var(--border);
    animation: fadeIn 0.3s ease;
}

.blacklist-result-box.clean {
    border-color: var(--success);
    background: var(--success-bg);
}

.blacklist-result-box.stolen {
    border-color: var(--error);
    background: var(--error-bg);
}

.blacklist-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.blacklist-status-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.blacklist-result-box.clean .blacklist-status-title { color: var(--success); }
.blacklist-result-box.stolen .blacklist-status-title { color: var(--error); }

.blacklist-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Protocol Checklist */
.protocol-checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.protocol-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.protocol-item:hover {
    border-color: var(--accent);
}

.protocol-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 3px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.protocol-content strong {
    display: block;
    font-size: 0.92rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.protocol-content p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.protocol-item.completed {
    opacity: 0.6;
    background: rgba(34, 197, 94, 0.05);
    border-color: rgba(34, 197, 94, 0.3);
}

.protocol-item.completed strong {
    text-decoration: line-through;
    color: var(--success);
}

/* Recovery Portals */
.portal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.portal-card {
    padding: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.portal-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.portal-badge {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.portal-card h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.portal-card p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    flex-grow: 1;
}

.portal-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.portal-links .btn {
    text-decoration: none;
    font-size: 0.8rem;
    padding: 8px 14px;
    justify-content: center;
}

/* FIR Generator */
.complaint-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.complaint-form input[type="text"] {
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    padding: 10px 14px;
}

.complaint-output {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.output-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fir-letter-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    line-height: 1.6;
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    max-height: 400px;
    overflow-y: auto;
}

@media print {
    body * {
        visibility: hidden;
    }
    #firOutputBox, #firOutputBox * {
        visibility: visible;
    }
    #firOutputBox {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white !important;
        color: black !important;
        border: none !important;
    }
    .fir-letter-text {
        color: black !important;
        background: white !important;
        border: none !important;
        font-size: 11pt !important;
    }
    .output-header .action-buttons {
        display: none !important;
    }
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    color: var(--text-primary);
    animation: toastIn 0.3s ease;
    min-width: 200px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--accent); }

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

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

/* ============================================
   Footer
   ============================================ */
.footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   Mobile & Responsive Excellence
   ============================================ */

/* Tablet & Smaller (< 768px) */
@media (max-width: 768px) {
    .app {
        padding: 0 16px;
    }

    .header {
        padding: 16px 0;
        margin-bottom: 20px;
    }

    .portal-grid {
        grid-template-columns: 1fr;
    }

    .generator-options {
        grid-template-columns: 1fr;
    }
}

/* Mobile Screens (< 640px) */
@media (max-width: 640px) {
    .app {
        padding: 0 12px;
    }

    /* Header */
    .header {
        padding: 14px 0;
        margin-bottom: 18px;
    }

    .logo {
        gap: 10px;
    }

    .logo-icon {
        width: 38px;
        height: 38px;
    }

    .logo-icon svg {
        width: 22px;
        height: 22px;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.72rem;
    }

    /* Swipeable Tab Navigation */
    .tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding: 6px;
        margin-bottom: 20px;
        border-radius: var(--radius-sm);
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 0.8rem;
        gap: 6px;
    }

    .tab svg {
        width: 15px;
        height: 15px;
        flex-shrink: 0;
        display: inline-block;
    }

    /* Input & Action Cards */
    .input-section {
        padding: 18px 16px;
        border-radius: var(--radius-md);
        margin-bottom: 18px;
    }

    .input-wrapper input {
        font-size: 1.05rem;
        letter-spacing: 0.1em;
        padding: 12px 14px;
        padding-right: 56px;
    }

    .char-count {
        right: 12px;
        font-size: 0.7rem;
    }

    .input-hints {
        font-size: 0.75rem;
    }

    /* Buttons */
    .action-buttons {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        min-height: 44px;
    }

    /* Result Cards */
    .result-card {
        padding: 18px 16px;
        border-radius: var(--radius-md);
    }

    .card-title {
        font-size: 0.9rem;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    .status-card {
        padding: 16px;
        gap: 14px;
    }

    .status-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .status-info h3 {
        font-size: 1rem;
    }

    .status-info p {
        font-size: 0.8rem;
    }

    /* Device Info */
    .device-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .info-item {
        padding: 12px;
    }

    .external-links {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .external-links .btn {
        width: 100%;
        justify-content: center;
        padding: 8px 10px;
        font-size: 0.72rem;
    }

    /* Luhn Verification Steps */
    .luhn-step {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 12px;
    }

    .luhn-step .step-value {
        font-size: 0.78rem;
        word-break: break-all;
    }

    /* Live GPS Radar & HUD */
    .map-hud-bar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 12px;
    }

    .hud-item {
        background: var(--bg-input);
        padding: 8px 10px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border);
    }

    .hud-label {
        font-size: 0.62rem;
    }

    .hud-value {
        font-size: 0.8rem;
    }

    .hud-actions {
        grid-column: 1 / -1;
        margin-left: 0;
        width: 100%;
        display: flex;
        gap: 8px;
        margin-top: 4px;
    }

    .hud-actions .btn {
        flex: 1;
        justify-content: center;
        min-height: 40px;
    }

    .live-map-element {
        height: 380px;
    }

    /* Recovery Hub */
    .protocol-item {
        padding: 12px 14px;
        gap: 10px;
    }

    .protocol-content strong {
        font-size: 0.85rem;
    }

    .protocol-content p {
        font-size: 0.78rem;
    }

    /* Police FIR Generator */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .complaint-output {
        padding: 14px;
    }

    .output-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .output-header .action-buttons {
        flex-direction: row;
        width: 100%;
    }

    .output-header .action-buttons .btn {
        flex: 1;
    }

    .fir-letter-text {
        font-size: 0.75rem;
        padding: 12px;
        word-break: break-word;
    }

    /* Bulk & History Items */
    .bulk-item {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 14px;
    }

    .bulk-item .bulk-device {
        width: 100%;
        text-align: left;
        order: 3;
    }

    .history-item {
        flex-wrap: wrap;
        gap: 6px 10px;
        padding: 12px 14px;
    }

    .history-item .hist-device {
        width: 100%;
        text-align: left;
        order: 3;
        font-size: 0.75rem;
    }

    .history-item .hist-time {
        margin-left: auto;
        order: 2;
    }

    /* Toast Container */
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .toast {
        min-width: unset;
        width: 100%;
    }
}

/* Ultra Narrow Screens (< 380px) */
@media (max-width: 380px) {
    .app {
        padding: 0 8px;
    }

    .map-hud-bar {
        grid-template-columns: 1fr;
    }

    .external-links {
        grid-template-columns: 1fr;
    }

    .status-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .status-icon {
        margin: 0 auto;
    }

    .output-header .action-buttons {
        flex-direction: column;
    }

    .live-map-element {
        height: 320px;
    }
}
