:root {
  --bg-dark: #0a0b10;
  --bg-card: rgba(20, 21, 33, 0.55);
  --border-glass: rgba(255, 255, 255, 0.07);
  --border-active: rgba(99, 102, 241, 0.4);
  
  /* Palette */
  --primary: #6366f1;       /* Indigo */
  --primary-hover: #4f46e5;
  --accent: #10b981;        /* Emerald */
  --accent-hover: #059669;
  --danger: #ef4444;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #1f2937;
  
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
  
  --font-family: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background animated glow */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
}

.bg-glow-1 {
  background: radial-gradient(circle, var(--primary) 0%, rgba(99, 102, 241, 0) 70%);
  top: -10%;
  left: -10%;
  animation: float 20s infinite alternate;
}

.bg-glow-2 {
  background: radial-gradient(circle, var(--accent) 0%, rgba(16, 185, 129, 0) 70%);
  bottom: -10%;
  right: -10%;
  animation: float-reverse 25s infinite alternate;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(100px, 50px) scale(1.2); }
}

@keyframes float-reverse {
  0% { transform: translate(0, 0) scale(1.2); }
  100% { transform: translate(-100px, -50px) scale(0.9); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

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

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo .highlight {
  color: var(--primary);
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.icon-logo {
  font-size: 1.75rem;
  animation: pulse-slow 3s infinite;
}

@keyframes pulse-slow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* Role Selector Toggle */
.role-selector {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 0.25rem;
  border-radius: 12px;
  display: flex;
  backdrop-filter: blur(5px);
}

.role-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Glassmorphism Card base style */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.glass-card:hover {
  border-color: var(--border-active);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* Grid systems */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.75rem;
}

.owner-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 1.75rem;
}

@media (max-width: 900px) {
  .owner-grid {
    grid-template-columns: 1fr;
  }
}

.full-width {
  grid-column: 1 / -1;
}

/* Auth / Login View Card */
.auth-card {
  max-width: 480px;
  margin: 4rem auto;
  text-align: center;
}

.auth-card h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  margin-bottom: 1.5rem;
}

.form-group-inline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  font-family: var(--font-family);
  font-size: 1rem;
  transition: all 0.25s;
}

input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.helper-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Buttons */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.9rem 1.8rem;
  border-radius: 12px;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #6366f1 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #34d399 100%);
  color: white;
}

.btn-accent:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, #059669 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

/* Loyalty Card Widget styling */
.loyalty-card-widget {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 230px;
  overflow: hidden;
  justify-content: space-between;
}

.loyalty-card-widget::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(0,0,0,0) 70%);
  z-index: 0;
  pointer-events: none;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

.card-brand {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.6);
}

.card-chip {
  width: 40px;
  height: 30px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border-radius: 6px;
  position: relative;
}

.card-chip::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 25px;
  height: 18px;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 3px;
}

.card-holder-info, .card-token-info {
  z-index: 1;
}

.holder-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-holder-info h3 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-top: 2px;
}

.card-token-info h4 {
  font-family: monospace;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  color: #a5b4fc;
}

.card-stats {
  display: flex;
  gap: 2rem;
  z-index: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.75rem;
}

.stat-box {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Progress Widget */
.progress-widget {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.progress-container {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.progress-bar-bg {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  height: 12px;
  width: 100%;
  overflow: hidden;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(255,255,255,0.03);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 10px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(99,102,241,0.5);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.bonus-tag {
  color: var(--accent);
}

/* Stamps Grid */
.stamps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: auto;
}

.stamp {
  aspect-ratio: 1;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.25);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stamp.filled {
  background: radial-gradient(circle, var(--primary) 0%, var(--primary-hover) 100%);
  border: 2px solid var(--primary);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.stamp.filled-reward {
  background: radial-gradient(circle, var(--accent) 0%, var(--accent-hover) 100%);
  border: 2px solid var(--accent);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

/* QR / Barcode Widget */
.qr-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
}

.qr-container {
  background: white;
  padding: 1.5rem;
  border-radius: 16px;
  width: 100%;
  max-width: 260px;
  margin: 1.25rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.barcode-display {
  width: 100%;
  height: 70px;
}

.barcode-simulation {
  width: 100%;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 2px;
  background: white;
}

.barcode-bar {
  background-color: black;
  flex-grow: 1;
}

.barcode-text {
  color: var(--bg-dark);
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 4px;
  margin-top: 0.5rem;
}

/* Tables styling */
.table-wrapper {
  overflow-x: auto;
  margin-top: 1rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.history-table td {
  padding: 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-add {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
}

.badge-sub {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.badge-token {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  font-family: monospace;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state .large-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* OWNER DASHBOARD */
.owner-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.search-box {
  margin-bottom: 1rem;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
}

/* Client List inside Owner View */
.client-list-container {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.client-list-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.client-list-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.client-list-item.selected {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--border-active);
}

.client-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
}

.client-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

.client-item-stats {
  display: flex;
  gap: 0.75rem;
}

.client-item-stats .stat-badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: var(--text-muted);
}

.client-item-stats .stat-badge strong {
  color: white;
}

/* Client Details Panel */
.client-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1.5rem;
}

.client-detail-header h3 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.client-detail-stats {
  display: flex;
  gap: 1.5rem;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.mini-stat .num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.mini-stat .lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.actions-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.actions-section h4, .detail-history-section h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
  color: #fff;
}

.action-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.25rem;
}

.action-card h5 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.3s;
}

.modal-content {
  width: 100%;
  max-width: 480px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: white;
}

.btn-group-row {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.btn-group-row button {
  flex: 1;
}

.input-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* View Helpers */
.hidden {
  display: none !important;
}

/* Toast System styling */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 200;
  max-width: 320px;
}

.toast {
  background: rgba(20, 21, 33, 0.9);
  border-left: 4px solid var(--primary);
  border-top: 1px solid var(--border-glass);
  border-right: 1px solid var(--border-glass);
  border-bottom: 1px solid var(--border-glass);
  color: white;
  padding: 1rem 1.25rem;
  border-radius: 0 10px 10px 0;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slide-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.success {
  border-left-color: var(--accent);
}

.toast.error {
  border-left-color: var(--danger);
}

@keyframes slide-in {
  from { transform: translateX(120%); }
  to { transform: translateX(0); }
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  margin-left: 1rem;
}

.toast-close:hover {
  color: white;
}

/* Spinner do widoku oczekiwania */
.loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.05);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Sekcja próśb o rejestrację w panelu właściciela */
.owner-requests-section {
  background: rgba(99, 102, 241, 0.04);
  border: 1px dashed rgba(99, 102, 241, 0.25);
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.requests-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 0.5rem;
}

.request-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.request-info h5 {
  font-size: 0.9rem;
  font-weight: 600;
}

.request-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.request-info strong {
  font-family: monospace;
  color: #a5b4fc;
}

.request-actions {
  display: flex;
  gap: 0.5rem;
}

.request-actions .btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 8px;
  flex: 1;
}

