/* ============================================
   QR Studio - Premium Design System
   ============================================ */

/* --- Root Variables --- */
:root {
    --bg-primary: #060611;
    --bg-secondary: #0d0d1a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-input: rgba(255, 255, 255, 0.06);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(108, 92, 231, 0.4);

    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a80;

    --accent-primary: #6c5ce7;
    --accent-secondary: #a855f7;
    --accent-gradient: linear-gradient(135deg, #6c5ce7, #a855f7);
    --accent-gradient-hover: linear-gradient(135deg, #7c6cf7, #b865ff);
    --accent-glow: 0 0 30px rgba(108, 92, 231, 0.3);

    --success: #00d2a0;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.5);

    --transition-fast: 0.15s ease;
    --transition-default: 0.25s ease;
    --transition-slow: 0.4s ease;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(168, 85, 247, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover { color: var(--accent-secondary); }

img { max-width: 100%; height: auto; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(6, 6, 17, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 1000;
    transition: all var(--transition-default);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.nav-logo i {
    font-size: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary) !important;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary) !important;
    background: var(--bg-glass);
}

.nav-link.active {
    color: var(--accent-primary) !important;
    background: rgba(108, 92, 231, 0.1);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.logout-link {
    margin-left: 4px;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
}

/* --- Main Content --- */
.main-content {
    position: relative;
    z-index: 1;
    padding-top: 64px;
    min-height: 100vh;
}

/* --- Auth Pages --- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-page .main-content {
    padding-top: 0;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo i {
    font-size: 3rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    display: block;
}

.auth-logo h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 40px;
    backdrop-filter: blur(10px);
}

.auth-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.auth-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-footer a {
    font-weight: 600;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

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

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* --- Color Input --- */
.color-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.color-input-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-input-group .color-hex {
    flex: 1;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-default);
    white-space: nowrap;
    line-height: 1.4;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 6px 24px rgba(108, 92, 231, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

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

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

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
}

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

/* --- Dashboard --- */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* --- Stats Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-default);
}

.stat-card:hover {
    border-color: var(--border-default);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.stat-card .stat-icon.purple {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-primary);
}

.stat-card .stat-icon.green {
    background: rgba(0, 210, 160, 0.15);
    color: var(--success);
}

.stat-card .stat-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- QR Cards Grid --- */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.qr-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-default);
    position: relative;
}

.qr-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--accent-glow);
    transform: translateY(-4px);
}

.qr-card-header {
    padding: 20px 20px 0;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.qr-card-preview {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background: #fff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    overflow: hidden;
}

.qr-card-preview canvas,
.qr-card-preview svg {
    width: 100% !important;
    height: 100% !important;
}

.qr-card-info {
    flex: 1;
    min-width: 0;
}

.qr-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qr-card-url {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
    display: block;
}

.qr-card-stats {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.qr-card-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.qr-card-body {
    padding: 16px 20px;
}

.qr-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.qr-card-actions {
    padding: 12px 20px 16px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-subtle);
}

.qr-card-actions .btn {
    flex: 1;
    font-size: 0.8rem;
    padding: 8px 12px;
}

.qr-status {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.qr-status.active { background: var(--success); box-shadow: 0 0 8px rgba(0,210,160,0.5); }
.qr-status.inactive { background: var(--text-muted); }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    grid-column: 1 / -1;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* --- Create / Edit Page --- */
.form-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
}

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 40px;
    backdrop-filter: blur(10px);
}

.form-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.form-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
}

.form-section {
    margin-bottom: 32px;
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* --- QR Preview Panel --- */
.create-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
}

.qr-preview-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 32px;
    position: sticky;
    top: 96px;
    text-align: center;
}

.qr-preview-panel h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.qr-preview-container {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.qr-preview-container canvas,
.qr-preview-container svg {
    max-width: 100% !important;
    height: auto !important;
}

.download-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* --- Thumbnail Upload --- */
.thumbnail-upload {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-default);
    position: relative;
    overflow: hidden;
}

.thumbnail-upload:hover {
    border-color: var(--accent-primary);
    background: rgba(108, 92, 231, 0.05);
}

.thumbnail-upload.has-image {
    padding: 0;
    border: none;
}

.thumbnail-upload.has-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.thumbnail-upload-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.thumbnail-upload i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}

.thumbnail-upload span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.thumbnail-upload .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* --- Landing Page (Public QR Page) --- */
.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary);
}

.landing-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

.landing-thumbnail {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}

.landing-content {
    padding: 32px;
}

.landing-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.landing-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 24px;
    white-space: pre-wrap;
}

.landing-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background: var(--accent-gradient);
    color: #fff !important;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    transition: all var(--transition-default);
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

.landing-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(108, 92, 231, 0.5);
    color: #fff !important;
}

.landing-footer {
    text-align: center;
    padding: 16px 32px 24px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.landing-footer a {
    color: var(--text-muted);
}

.landing-not-found {
    text-align: center;
    padding: 60px 32px;
}

.landing-not-found i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    opacity: 0.4;
}

.landing-not-found h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.landing-not-found p {
    color: var(--text-muted);
}

/* --- Alerts / Messages --- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeInDown 0.3s ease;
}

.alert-success {
    background: rgba(0, 210, 160, 0.1);
    border: 1px solid rgba(0, 210, 160, 0.2);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-default);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 420px;
    width: 90%;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-default);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.pagination a {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.pagination a:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination .active {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

.fade-in {
    animation: fadeInUp 0.4s ease forwards;
}

.fade-in-delay-1 { animation-delay: 0.05s; opacity: 0; }
.fade-in-delay-2 { animation-delay: 0.1s; opacity: 0; }
.fade-in-delay-3 { animation-delay: 0.15s; opacity: 0; }

/* --- Loading --- */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 0.6s linear infinite;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-links,
    .nav-user .user-name {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .navbar.nav-open .nav-links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(6, 6, 17, 0.95);
        backdrop-filter: blur(20px);
        padding: 12px;
        border-bottom: 1px solid var(--border-subtle);
    }

    .page-container {
        padding: 20px 16px;
    }

    .qr-grid {
        grid-template-columns: 1fr;
    }

    .create-layout {
        grid-template-columns: 1fr;
    }

    .qr-preview-panel {
        position: static;
        order: -1;
    }

    .form-card {
        padding: 24px;
    }

    .auth-card {
        padding: 28px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .download-buttons {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* --- Toast Notification --- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeInDown 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 280px;
    box-shadow: var(--shadow-md);
}

.toast-success {
    background: rgba(0, 210, 160, 0.15);
    border: 1px solid rgba(0, 210, 160, 0.3);
    color: var(--success);
}

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* --- Toggle Switch --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    transition: var(--transition-default);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition-default);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: #fff;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   Role Badges
   ============================================ */
.user-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-admin {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-creator {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.badge-default {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

/* ============================================
   Admin Data Table
   ============================================ */
.data-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-default);
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.table-user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.table-user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   Search Bar
   ============================================ */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-bar .form-input {
    flex: 1;
    max-width: 400px;
}

/* ============================================
   Category Filter Tabs
   ============================================ */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.filter-tab:hover {
    color: var(--text-primary);
    border-color: var(--border-default);
    background: var(--bg-card-hover);
}

.filter-tab.active {
    color: #fff;
    background: var(--accent-gradient);
    border-color: transparent;
}

.filter-tab .count {
    background: rgba(255, 255, 255, 0.15);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

.filter-tab.active .count {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   Category List (Management)
   ============================================ */
.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.category-item:hover {
    border-color: var(--border-default);
}

.category-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(108, 92, 231, 0.1);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.category-item-info {
    flex: 1;
    min-width: 0;
}

.category-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.category-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.category-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================
   Role Select
   ============================================ */
.role-select {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
}

.role-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

/* ============================================
   Admin Page Adjustments
   ============================================ */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.admin-stat-mini {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.admin-stat-mini .val {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.admin-stat-mini .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   Inline Category Form
   ============================================ */
.inline-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.inline-form .form-group {
    margin-bottom: 0;
    flex: 1;
}

.inline-form .btn {
    flex-shrink: 0;
    height: 44px;
}

/* ============================================
   Responsive additions
   ============================================ */
@media (max-width: 768px) {
    .data-table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
    }

    .user-role-badge {
        display: none;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar .form-input {
        max-width: none;
    }

    .inline-form {
        flex-direction: column;
    }

    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}
