/* ========================================
   ScanFlow - Premium QR/Barcode Scanner
   Modern Glassmorphism Design
   ======================================== */

/* CSS Variables */
:root {
    /* Colors - Light Mode with Neutral/Grey primary, Purple accent */
    --background: 0 0% 98%;
    --background-secondary: 0 0% 96%;
    --foreground: 0 0% 9%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 9%;

    /* Primary - Dark grey/black with purple accent */
    --primary: 0 0% 12%;
    --primary-hover: 0 0% 18%;
    --primary-foreground: 0 0% 100%;
    --primary-glow: 262 83% 65%;

    /* Accent - Purple for highlights */
    --accent-primary: 262 83% 58%;
    --accent-primary-foreground: 0 0% 100%;

    --secondary: 0 0% 94%;
    --secondary-foreground: 0 0% 20%;

    --accent-cyan: 185 96% 50%;
    --accent-pink: 330 85% 60%;
    --accent-purple: 262 83% 58%;

    --muted: 0 0% 94%;
    --muted-foreground: 0 0% 45%;

    --border: 0 0% 89%;
    --border-hover: 0 0% 75%;
    --input: 0 0% 92%;
    --ring: 262 83% 58%;

    --success: 152 76% 40%;
    --success-bg: 152 76% 95%;
    --destructive: 0 72% 51%;
    --destructive-bg: 0 72% 95%;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, hsl(0 0% 12%), hsl(0 0% 20%));
    --gradient-accent: linear-gradient(135deg, hsl(262 83% 58%), hsl(280 80% 55%));
    --gradient-surface: linear-gradient(145deg, hsl(0 0% 100%), hsl(0 0% 97%));
    --gradient-mesh: radial-gradient(at 40% 20%, hsl(262 30% 96%) 0px, transparent 50%),
                     radial-gradient(at 80% 0%, hsl(200 30% 96%) 0px, transparent 50%),
                     radial-gradient(at 0% 50%, hsl(0 0% 95%) 0px, transparent 50%);

    /* Radius */
    --radius-sm: 0.5rem;
    --radius: 0.875rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.75rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px hsl(250 50% 10% / 0.04);
    --shadow-sm: 0 2px 8px hsl(250 50% 10% / 0.06), 0 1px 2px hsl(250 50% 10% / 0.04);
    --shadow: 0 4px 16px hsl(250 50% 10% / 0.08), 0 2px 4px hsl(250 50% 10% / 0.04);
    --shadow-md: 0 8px 24px hsl(250 50% 10% / 0.1), 0 4px 8px hsl(250 50% 10% / 0.06);
    --shadow-lg: 0 16px 48px hsl(250 50% 10% / 0.12), 0 8px 16px hsl(250 50% 10% / 0.08);
    --shadow-xl: 0 24px 64px hsl(250 50% 10% / 0.16), 0 12px 24px hsl(250 50% 10% / 0.1);
    --shadow-glow: 0 0 40px hsl(262 83% 58% / 0.25);
    --shadow-inner: inset 0 2px 4px hsl(250 50% 10% / 0.06);

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out-expo: cubic-bezier(0.87, 0, 0.13, 1);
    --transition-fast: 150ms var(--ease-out-expo);
    --transition-base: 250ms var(--ease-out-expo);
    --transition-slow: 400ms var(--ease-out-expo);
    --transition-slower: 600ms var(--ease-out-expo);

    /* Safe area insets */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --safe-left: env(safe-area-inset-left);
    --safe-right: env(safe-area-inset-right);
}

/* Dark Mode */
[data-theme="dark"] {
    --background: 0 0% 6%;
    --background-secondary: 0 0% 9%;
    --foreground: 0 0% 95%;
    --card: 0 0% 10%;
    --card-foreground: 0 0% 95%;

    --primary: 0 0% 95%;
    --primary-hover: 0 0% 85%;
    --primary-foreground: 0 0% 6%;
    --primary-glow: 262 83% 65%;

    --accent-primary: 262 83% 65%;

    --secondary: 0 0% 15%;
    --secondary-foreground: 0 0% 90%;

    --muted: 0 0% 14%;
    --muted-foreground: 0 0% 55%;

    --border: 0 0% 18%;
    --border-hover: 0 0% 30%;
    --input: 0 0% 12%;

    --success-bg: 152 76% 15%;
    --destructive-bg: 0 72% 15%;

    --gradient-primary: linear-gradient(135deg, hsl(0 0% 95%), hsl(0 0% 85%));
    --gradient-surface: linear-gradient(145deg, hsl(0 0% 11%), hsl(0 0% 7%));
    --gradient-mesh: radial-gradient(at 40% 20%, hsl(262 30% 15%) 0px, transparent 50%),
                     radial-gradient(at 80% 0%, hsl(200 20% 12%) 0px, transparent 50%),
                     radial-gradient(at 0% 50%, hsl(0 0% 10%) 0px, transparent 50%);

    --shadow-xs: 0 1px 2px hsl(0 0% 0% / 0.3);
    --shadow-sm: 0 2px 8px hsl(0 0% 0% / 0.4), 0 1px 2px hsl(0 0% 0% / 0.3);
    --shadow: 0 4px 16px hsl(0 0% 0% / 0.45), 0 2px 4px hsl(0 0% 0% / 0.3);
    --shadow-md: 0 8px 24px hsl(0 0% 0% / 0.5), 0 4px 8px hsl(0 0% 0% / 0.35);
    --shadow-lg: 0 16px 48px hsl(0 0% 0% / 0.55), 0 8px 16px hsl(0 0% 0% / 0.4);
    --shadow-xl: 0 24px 64px hsl(0 0% 0% / 0.6), 0 12px 24px hsl(0 0% 0% / 0.45);
    --shadow-glow: 0 0 60px hsl(262 83% 65% / 0.3);
    --shadow-inner: inset 0 2px 4px hsl(0 0% 0% / 0.3);
}

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

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: hsl(var(--background));
    background-image: var(--gradient-mesh);
    background-attachment: fixed;
    color: hsl(var(--foreground));
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 100%;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: hsl(var(--background) / 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    max-width: 800px;
    margin: 0 auto;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    padding: 6px;
    background: hsl(var(--foreground));
    border-radius: var(--radius-sm);
    color: hsl(var(--background));
    box-shadow: var(--shadow-sm);
}

h1.logo-text,
.logo-text {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: hsl(var(--foreground));
    margin: 0;
    line-height: 1;
}

.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.theme-toggle:hover {
    border-color: hsl(var(--border-hover));
    transform: scale(1.05);
}

.theme-toggle:hover::before {
    opacity: 0.1;
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle svg {
    position: relative;
    z-index: 1;
    width: 20px;
    height: 20px;
    color: hsl(var(--foreground));
    transition: transform var(--transition-base);
}

.sun-icon { display: block; }
.moon-icon { display: none; }

[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }

/* Main Navigation */
.main-nav {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1rem 1.25rem;
    background: transparent;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.nav-btn {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    background: hsl(var(--card));
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.nav-btn svg {
    width: 22px;
    height: 22px;
    transition: transform var(--transition-base);
}

.nav-btn:hover {
    background: hsl(var(--secondary));
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-btn:hover svg {
    transform: scale(1.1);
}

.nav-btn.active {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    border-color: transparent;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: hsl(var(--accent-purple));
    border-radius: 2px;
}

.nav-btn.active svg {
    transform: scale(1.1);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 0.5rem 1rem 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.tab-content {
    display: none;
    animation: fadeSlideIn var(--transition-slow);
}

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

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Scanner Styles */
.scan-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.scanner-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    aspect-ratio: 1;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: linear-gradient(145deg, hsl(var(--muted)), hsl(var(--background-secondary)));
    box-shadow: var(--shadow-lg), var(--shadow-inner);
}

.scanner-wrapper::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--gradient-accent);
    border-radius: calc(var(--radius-xl) + 2px);
    z-index: -1;
    opacity: 0.4;
}

.scanner {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.scanner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1.25rem;
    color: hsl(var(--muted-foreground));
    padding: 2rem;
    text-align: center;
}

.scanner-placeholder svg {
    width: 72px;
    height: 72px;
    opacity: 0.35;
    animation: pulse-gentle 3s ease-in-out infinite;
}

@keyframes pulse-gentle {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

.scanner-placeholder p {
    font-size: 0.9375rem;
    font-weight: 500;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-frame {
    width: 65%;
    height: 65%;
    position: relative;
    border-radius: var(--radius);
}

.scanner-frame::before,
.scanner-frame::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid hsl(var(--accent-purple));
}

.scanner-frame::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: var(--radius-sm);
    animation: corner-pulse 2s ease-in-out infinite;
}

.scanner-frame::after {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: var(--radius-sm);
    animation: corner-pulse 2s ease-in-out infinite 0.5s;
}

.scanner-frame .corner-bl,
.scanner-frame .corner-br {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid hsl(var(--accent-purple));
}

@keyframes corner-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.scanner-frame {
    box-shadow: 0 0 0 9999px hsl(var(--background) / 0.6);
}

/* Animated scan line */
.scanner-frame::before {
    animation: corner-pulse 2s ease-in-out infinite;
}

.scan-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.camera-select-wrapper {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

/* Buttons */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.btn:hover svg {
    transform: scale(1.1);
}

.btn-primary {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow-md);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover::before {
    opacity: 1;
}

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

/* Accent button variation */
.btn-accent {
    background: var(--gradient-accent);
    color: hsl(0 0% 100%);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 50px hsl(262 83% 58% / 0.4);
}

.btn-secondary {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--border));
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: hsl(var(--secondary));
    border-color: hsl(var(--border-hover));
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-ghost {
    background: transparent;
    color: hsl(var(--foreground));
    border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: hsl(var(--secondary));
    border-color: hsl(var(--border));
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-lg svg {
    width: 22px;
    height: 22px;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-full {
    width: 100%;
}

/* Result Card */
.result-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    animation: slideUpSpring var(--transition-slower);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
}

@keyframes slideUpSpring {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    70% {
        transform: translateY(-4px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.result-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.result-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-icon.success {
    background: linear-gradient(135deg, hsl(var(--success-bg)), hsl(var(--success) / 0.15));
    color: hsl(var(--success));
    box-shadow: var(--shadow-sm);
}

.result-icon svg {
    width: 26px;
    height: 26px;
    stroke-width: 2.5;
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.result-label {
    font-size: 1rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.result-type {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    font-weight: 500;
}

.result-content {
    padding: 1.125rem 1.25rem;
    background: hsl(var(--muted));
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    border: 1px solid hsl(var(--border) / 0.5);
}

.result-text {
    font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
    font-size: 0.9375rem;
    word-break: break-all;
    color: hsl(var(--foreground));
    line-height: 1.5;
}

.result-actions {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
}

/* Generate Tab */
.generate-container {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    max-width: 500px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.input-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    letter-spacing: 0.01em;
}

.type-selector {
    display: flex;
    gap: 0.5rem;
    padding: 0.375rem;
    background: hsl(var(--muted));
    border-radius: var(--radius-lg);
    border: 1px solid hsl(var(--border) / 0.5);
}

.type-btn {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: calc(var(--radius-lg) - 4px);
    background: transparent;
    color: hsl(var(--muted-foreground));
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.type-btn:hover {
    color: hsl(var(--foreground));
    background: hsl(var(--background) / 0.5);
}

.type-btn.active {
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    box-shadow: var(--shadow-md);
}

.select-wrapper {
    position: relative;
}

.select {
    width: 100%;
    padding: 0.875rem 2.75rem 0.875rem 1.125rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.select:hover {
    border-color: hsl(var(--border-hover));
}

.select:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: var(--shadow-xs), 0 0 0 3px hsl(var(--primary) / 0.15);
}

.select-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: hsl(var(--muted-foreground));
    pointer-events: none;
}

.select-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.625rem;
    display: block;
}

.textarea {
    width: 100%;
    padding: 1rem 1.125rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
    line-height: 1.5;
}

.textarea:hover {
    border-color: hsl(var(--border-hover));
}

.textarea:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: var(--shadow-xs), 0 0 0 3px hsl(var(--primary) / 0.15);
}

.textarea::placeholder {
    color: hsl(var(--muted-foreground));
}

.input-hint {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

/* Generated Card */
.generated-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    animation: slideUpSpring var(--transition-slower);
}

.generated-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(145deg, #ffffff, #f8f9fc);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    border: 1px solid hsl(250 20% 92%);
    min-height: 200px;
}

[data-theme="dark"] .generated-preview {
    background: linear-gradient(145deg, #ffffff, #f5f5f5);
    border-color: hsl(250 20% 88%);
}

.qr-output canvas {
    max-width: 100%;
    height: auto !important;
    border-radius: var(--radius);
}

.barcode-output {
    max-width: 100%;
    height: auto;
}

.generated-actions {
    display: flex;
    gap: 0.875rem;
    justify-content: center;
}

/* History Tab */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.25rem;
}

.history-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.history-item:hover {
    border-color: hsl(var(--primary) / 0.4);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.history-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, hsl(var(--accent-purple) / 0.12), hsl(var(--accent-purple) / 0.05));
    color: hsl(var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.history-details {
    flex: 1;
    min-width: 0;
}

.history-text {
    font-size: 0.9375rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.history-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.history-type {
    font-size: 0.75rem;
    color: hsl(var(--accent-purple));
    background: hsl(var(--accent-purple) / 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.history-time {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.history-actions {
    display: flex;
    gap: 0.375rem;
}

.history-action-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.history-action-btn:hover {
    background: hsl(var(--secondary));
    color: hsl(var(--foreground));
}

.history-action-btn.delete:hover {
    background: hsl(var(--destructive-bg));
    color: hsl(var(--destructive));
}

.history-action-btn svg {
    width: 18px;
    height: 18px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: hsl(var(--muted-foreground));
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    opacity: 0.25;
    color: hsl(var(--primary));
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9375rem;
    max-width: 250px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: calc(2rem + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 1.75rem;
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    border-radius: var(--radius-full);
    font-size: 0.9375rem;
    font-weight: 600;
    box-shadow: var(--shadow-xl);
    z-index: 100;
    animation: toastIn var(--transition-base);
}

.toast.hidden {
    display: none;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(16px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Install Banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 1.5rem;
    padding-bottom: calc(1.25rem + var(--safe-bottom));
    background: hsl(var(--card) / 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 90;
    animation: slideUpBanner var(--transition-slow);
    box-shadow: 0 -8px 32px hsl(var(--foreground) / 0.1);
}

@keyframes slideUpBanner {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.install-banner.hidden {
    display: none;
}

.install-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.install-content svg {
    width: 28px;
    height: 28px;
    color: hsl(var(--primary));
    flex-shrink: 0;
}

.install-content span {
    font-size: 0.9375rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.install-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

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

/* Visually hidden but accessible to screen readers and SEO */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.2);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.35);
}

/* Media Queries */
@media (min-width: 640px) {
    .main-content {
        padding: 1rem 1.5rem 2.5rem;
    }

    .header-content {
        padding: 1.25rem 1.5rem;
    }

    .main-nav {
        padding: 1.25rem 1.5rem 1.5rem;
        gap: 0.75rem;
    }

    .nav-btn {
        flex-direction: row;
        gap: 0.625rem;
        padding: 1rem 1.5rem;
    }

    .result-actions {
        justify-content: flex-start;
    }

    .install-banner {
        padding: 1.5rem 2rem;
        padding-bottom: calc(1.5rem + var(--safe-bottom));
    }
}

@media (min-width: 768px) {
    .scanner-wrapper {
        max-width: 420px;
    }

    .generate-container {
        max-width: 520px;
    }
}

/* Focus Visible */
:focus-visible {
    outline: 2px solid hsl(var(--primary));
    outline-offset: 2px;
}

/* Selection */
::selection {
    background-color: hsl(var(--primary) / 0.2);
    color: hsl(var(--foreground));
}

/* Print Styles */
@media print {
    .header,
    .main-nav,
    .scan-controls,
    .result-actions,
    .generated-actions,
    .history-actions,
    .install-banner,
    .toast {
        display: none !important;
    }

    .generated-preview {
        padding: 0;
        background: none;
        border: none;
    }

    body {
        background: white !important;
    }
}
