:root {
    --bg-color: #0d1117;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --surface: #1e293b;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(239, 68, 68, 0.1), transparent 25%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.app-container {
    width: 100%;
    max-width: 500px;
    margin-top: 5vh;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header.glass-panel {
    padding: 1.5rem;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #a8c0ff 0%, #3f2b96 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    font-size: 0.9rem;
    color: #94a3b8;
}

/* Scanner Area */
.scanner-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#reader-container {
    position: relative;
    overflow: hidden;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#reader {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10;
    transition: opacity 0.3s;
    font-size: 1.1rem;
    font-weight: 500;
}

.scanner-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

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

.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.btn:active {
    transform: scale(0.95);
}

.btn.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn.primary:hover {
    background: var(--primary-hover);
}

.btn.secondary {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39);
}

.btn.secondary:hover {
    background: var(--danger-hover);
}

.helper-text {
    text-align: center;
    color: #cbd5e1;
    font-size: 0.85rem;
    line-height: 1.4;
    padding: 0 1rem;
}

/* Modal for Media */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.btn-icon-close {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-icon-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body img, .modal-body video {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* HTML5 QR Overrides */
#reader__dashboard_section_csr span {
    color: white !important;
}
#reader__dashboard_section_swaplink {
    color: var(--primary) !important;
}
#reader button {
    background: var(--surface);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

/* ===== PWA Install Banner ===== */
.install-banner {
    padding: 0.9rem 1.2rem;
    animation: slideDown 0.5s ease-out;
}

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

.install-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.install-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.install-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.install-text strong {
    font-size: 0.95rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.install-text span {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 2px;
}

.install-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.install-btn:active {
    transform: scale(0.95);
}

.install-btn:hover {
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.6);
}

.install-btn svg {
    flex-shrink: 0;
}

