:root {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: rgba(148, 163, 184, 0.2);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 16px;
    --transition: 0.3s ease;
    --danger-color: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 20%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.app-header { text-align: center; }
.app-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}
.app-header p { color: var(--text-secondary); font-size: 0.95rem; }

/* Main Card */
.main-card {
    width: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    min-height: 500px;
    display: flex; flex-direction: column;
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(241, 245, 249, 0.8);
    padding: 4px;
    border-radius: 12px;
}

.nav-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    border-radius: 10px;
    transition: var(--transition);
}

.nav-tab:hover { color: var(--text-primary); }
.nav-tab.active {
    color: var(--accent-color);
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Modules */
.module { display: none; animation: fadeIn 0.3s ease; }
.module.active { display: block; }

/* Scanner Controls */
.scanner-controls { margin-bottom: 1.5rem; }

.mode-switch {
    display: flex;
    background: rgba(241, 245, 249, 0.8);
    padding: 4px;
    border-radius: 12px;
}
.mode-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.9rem;
}
.mode-btn.active {
    background: white;
    color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Scanner Sections */
.scanner-input-section { display: none; }
.scanner-input-section.active { display: block; }

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.5);
}
.drop-zone:hover { border-color: var(--accent-color); background: rgba(59, 130, 246, 0.05); }
.drop-zone-content { text-align: center; }
.icon-wrapper { margin-bottom: 1rem; color: var(--accent-color); }
.hidden-input { display: none; }

/* Camera */
.camera-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#reader { width: 100%; }
.camera-overlay { 
    position: absolute; inset: 0; 
    background: rgba(0,0,0,0.4); 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    pointer-events: none; 
}
.scan-frame {
    width: 200px; height: 200px;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 12px;
    position: relative;
}
.scan-frame::after {
    content: ''; position: absolute; top: 10%; left: 5%; right: 5%; height: 2px;
    background: var(--danger-color); box-shadow: 0 0 4px var(--danger-color);
    animation: scan 2s linear infinite;
}
@keyframes scan { 0% { top: 10%; opacity: 0; } 50% { opacity: 1; } 100% { top: 90%; opacity: 0; } }

.camera-controls-bottom { margin-top: 1rem; text-align: center; }
.hidden { display: none !important; }

/* Generator Grid */
.generator-types {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}

.gen-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.gen-type-btn svg { width: 24px; height: 24px; }
.gen-type-btn span { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }

.gen-type-btn:hover { border-color: var(--accent-color); color: var(--accent-color); background: rgba(59, 130, 246, 0.05); }
.gen-type-btn.active {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
}

/* Generator Form */
.gen-form-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--text-secondary); }
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-primary);
    background: #f8fafc;
    outline: none;
    transition: var(--transition);
}
.form-control:focus { border-color: var(--accent-color); background: white; }
textarea.form-control { resize: none; min-height: 80px; }

/* Generator Result */
.gen-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.5s ease;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}
#qrcode-container {
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}
#qrcode-container img { display: block; }

/* Results Overlay */
.result-overlay {
    position: absolute; inset: 0;
    background: white;
    z-index: 20;
    padding: 1.5rem;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.result-header { 
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; 
}
.result-header h2 { font-size: 1.2rem; color: #22c55e; }
.close-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; }

.result-list { display: flex; flex-direction: column; gap: 1rem; }

.result-item {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}
.result-content {
    background: white;
    padding: 0.75rem;
    border-radius: 8px;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
}
.result-item-actions { display: flex; gap: 8px; }

/* Buttons */
.action-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    transition: var(--transition);
    text-decoration: none;
    font-size: 0.95rem;
}
.action-btn.full-width { width: 100%; }
.action-btn.small { padding: 8px 16px; font-size: 0.85rem; }

.action-btn.primary { background: var(--accent-color); color: white; }
.action-btn.primary:hover { background: var(--accent-hover); }

.action-btn.secondary { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }
.action-btn.secondary:hover { background: rgba(239, 68, 68, 0.2); }

.action-btn.outline { border: 1px solid var(--border-color); color: var(--text-primary); background: white; }
.action-btn.outline:hover { background: #f1f5f9; border-color: var(--text-secondary); }

/* Toast */
.toast {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: #1e293b; color: white; padding: 10px 20px; border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 100;
    animation: fadeIn 0.3s;
}
