/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    line-height: 1.6;
    min-height: 100vh;
}

/* === Navbar === */
.navbar {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; color: #38bdf8; text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { color: #94a3b8; font-size: 0.9rem; }

/* === Container === */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }

/* === Buttons === */
.btn {
    display: inline-block; padding: 0.5rem 1rem; border-radius: 8px;
    font-size: 0.875rem; font-weight: 500; cursor: pointer;
    text-decoration: none; border: 1px solid transparent;
    transition: all 0.15s; background: #334155; color: #e2e8f0;
}
.btn:hover { background: #475569; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: transparent; border: 1px solid #475569; color: #94a3b8; }
.btn-outline:hover { border-color: #64748b; color: #e2e8f0; }
.btn-danger { background: transparent; border: 1px solid #dc2626; color: #f87171; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-full { width: 100%; text-align: center; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 0.25rem; }
.btn-icon:hover { opacity: 0.7; }

/* === Auth === */
.auth-box {
    max-width: 400px; margin: 4rem auto;
    background: #1e293b; padding: 2rem; border-radius: 12px;
    border: 1px solid #334155;
}
.auth-box h1 { text-align: center; margin-bottom: 1.5rem; }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.875rem; font-weight: 500; color: #94a3b8; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.6rem 0.75rem; border-radius: 8px;
    border: 1px solid #334155; background: #0f172a; color: #e2e8f0;
    font-size: 0.95rem;
}
.form-group input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.3); }
.form-group small { display: block; margin-top: 0.25rem; color: #64748b; font-size: 0.8rem; }
.form-page { max-width: 600px; margin: 2rem auto; background: #1e293b; padding: 2rem; border-radius: 12px; border: 1px solid #334155; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; justify-content: flex-end; }

/* === Dashboard === */
.dashboard-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem;
}

/* === QR Grid === */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.qr-card {
    background: #1e293b; border: 1px solid #334155; border-radius: 12px;
    padding: 1.25rem; transition: border-color 0.15s;
}
.qr-card:hover { border-color: #475569; }
.qr-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.qr-card-header h3 { font-size: 1rem; word-break: break-word; }
.qr-card-top { display: flex; gap: 1rem; }
.qr-thumb { flex: 0 0 84px; }
.qr-thumb img {
    width: 84px; height: 84px; background: #fff; border-radius: 8px;
    border: 1px solid #334155; padding: 3px;
}
.qr-card-info { flex: 1; min-width: 0; }
.qr-card-body { margin-bottom: 1rem; }
.qr-slug { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.qr-slug code { background: #0f172a; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.85rem; color: #38bdf8; }
.qr-dest { margin-bottom: 0.3rem; }
.qr-dest a { color: #64748b; text-decoration: none; }
.qr-dest a:hover { color: #94a3b8; }
.qr-date { color: #475569; }
.qr-card-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; border-top: 1px solid #334155; padding-top: 0.75rem; }

/* === Badges === */
.badge { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-weight: 600; }
.badge-active { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-inactive { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-trial { background: rgba(250,204,21,0.15); color: #eab308; }

/* === Alerts === */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.plan-alert {
    background: rgba(234,179,8,0.12); border: 1px solid rgba(234,179,8,0.4);
    color: #fde047; font-weight: 500;
}

/* === Empty State === */
.empty-state { text-align: center; padding: 4rem 1rem; color: #64748b; }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { color: #94a3b8; margin-bottom: 0.5rem; }
.empty-state p { margin-bottom: 1.5rem; }

/* === Analytics === */
.analytics-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
    background: #1e293b; border: 1px solid #334155; border-radius: 10px;
    padding: 1.25rem; text-align: center;
}
.stat-number { font-size: 2.5rem; font-weight: 700; color: #38bdf8; }
.stat-label { font-size: 0.85rem; color: #64748b; margin-bottom: 0.25rem; }
.stat-url a { color: #38bdf8; font-size: 0.8rem; text-decoration: none; }
.stat-date { color: #94a3b8; font-size: 0.85rem; }
.stat-slug code { color: #38bdf8; font-size: 0.85rem; }

/* === Bar Chart === */
.chart-section { background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 1.5rem; margin-bottom: 2rem; }
.chart-section h3 { margin-bottom: 1rem; color: #94a3b8; font-size: 0.95rem; }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; overflow-x: auto; padding-top: 1.5rem; }
.bar-item { display: flex; flex-direction: column; align-items: center; min-width: 32px; }
.bar-value { font-size: 0.7rem; color: #64748b; margin-bottom: 2px; }
.bar { width: 24px; background: #2563eb; border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.3s; }
.bar-label { font-size: 0.6rem; color: #475569; margin-top: 4px; white-space: nowrap; }

/* === Scans Table === */
.scans-section { background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 1.5rem; }
.scans-section h3 { margin-bottom: 1rem; color: #94a3b8; font-size: 0.95rem; }
.scans-table { width: 100%; border-collapse: collapse; }
.scans-table th, .scans-table td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid #1e293b; }
.scans-table th { background: #0f172a; color: #64748b; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.scans-table td { font-size: 0.85rem; }
.ua-cell { font-size: 0.75rem; color: #64748b; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === QR Info === */
.qr-info { background: #0f172a; padding: 1rem; border-radius: 8px; margin-bottom: 1rem; }
.qr-info p { margin-bottom: 0.35rem; font-size: 0.85rem; color: #94a3b8; }
.qr-info code { color: #38bdf8; }

/* === Responsive === */
@media (max-width: 640px) {
    .qr-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .nav-links { gap: 0.4rem; }
}
