/* ===== QR Generator — Premium Dark Theme ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255,255,255,0.8);
    --bg-card-hover: rgba(255,255,255,1);
    --border: rgba(0,0,0,0.08);
    --border-hover: rgba(0,0,0,0.15);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #667eea;
    --accent-2: #764ba2;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-subtle: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.15));
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Background effects */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(102,126,234,0.12) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(118,75,162,0.1) 0%, transparent 50%),
                radial-gradient(circle at 50% 80%, rgba(102,126,234,0.08) 0%, transparent 50%);
    z-index: -1;
    animation: bgShift 20s ease infinite;
}

@keyframes bgShift {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-2%, -1%); }
}

/* ===== Navbar ===== */
.navbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-logo {
    height: 34px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
}

.navbar-nav {
    display: flex;
    gap: 0.5rem;
    list-style: none;
}

.navbar-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.navbar-nav a:hover, .navbar-nav a.active {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* ===== Container ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 4rem 0 2rem;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 550px;
    margin: 0 auto;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: var(--transition);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
}

.form-control::placeholder { color: var(--text-muted); }

.color-row {
    display: flex;
    gap: 1rem;
}

.color-row .form-group { flex: 1; }

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-input-wrap input[type="color"] {
    width: 44px;
    height: 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
    padding: 2px;
}

.color-input-wrap input[type="text"] { flex: 1; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102,126,234,0.4);
}

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

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ===== Generator Layout ===== */
.generator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem 0 4rem;
}

/* ===== QR Preview ===== */
.qr-preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
    padding: 3rem;
}

.qr-placeholder .icon { font-size: 4rem; opacity: 0.3; }
.qr-placeholder p { font-size: 0.9rem; }

#qrImagePreview {
    max-width: 280px;
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    animation: fadeScale 0.4s ease;
}

@keyframes fadeScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.qr-result-info {
    margin-top: 1.5rem;
    width: 100%;
}

.short-url-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
}

.short-url-display input {
    flex: 1;
    background: none;
    border: none;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    outline: none;
}

.short-url-display .btn { padding: 0.4rem 0.75rem; font-size: 0.8rem; }

/* ===== File Upload ===== */
.file-upload {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload:hover { border-color: var(--accent); background: rgba(102,126,234,0.05); }
.file-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-upload .label { color: var(--text-secondary); font-size: 0.85rem; }
.file-upload .label span { color: var(--accent); font-weight: 600; }

/* ===== Dashboard ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card .stat-sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* ===== Tables ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: rgba(0,0,0,0.03);
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0,0,0,0.02); }

.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-mobile { background: rgba(102,126,234,0.15); color: #667eea; }
.badge-desktop { background: rgba(52,211,153,0.15); color: #34d399; }
.badge-tablet { background: rgba(251,191,36,0.15); color: #fbbf24; }
.badge-unknown { background: rgba(0,0,0,0.06); color: var(--text-muted); }
.badge-active { background: rgba(52,211,153,0.15); color: #34d399; }
.badge-inactive { background: rgba(248,113,113,0.15); color: #f87171; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    z-index: 999;
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

/* ===== Spinner ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .generator-grid { grid-template-columns: 1fr; }
    .hero { padding: 2.5rem 0 1rem; }
    .hero h1 { font-size: 1.75rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .navbar .container { flex-wrap: wrap; gap: 0.75rem; }
    .navbar-nav { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .card { padding: 1.25rem; }
    .btn-group { flex-direction: column; }
    .color-row { flex-direction: column; }
}

/* ===== Loading skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(0,0,0,0.03) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Page header ===== */
.page-header {
    padding: 2.5rem 0 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.page-header p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ===== Detail panel ===== */
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state p { font-size: 0.95rem; }

/* ===== Footer ===== */
.site-footer {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.site-footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.site-footer a:hover {
    color: var(--accent-2);
}
