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

:root {
  --bg-dark: #0a0a0f;
  --bg-secondary: #1a1a26;
  --accent: #00e5a0;
  --success: #00e5a0;
  --error: #ff6b6b;
  --warning: #ffd93d;
  --text-primary: #ffffff;
  --text-secondary: #aaa;
  --border: #2a2a3a;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  body {
    font-size: 16px;
  }
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  margin-bottom: 16px;
}

h1 {
  font-size: 24px;
}

@media (min-width: 768px) {
  h1 {
    font-size: 32px;
  }
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 18px;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.app-header {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--accent);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-logo {
  font-size: 28px;
}

.app-title {
  flex: 1;
  text-align: center;
}

.app-title h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 2px;
}

.app-title p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
}

@media (min-width: 768px) {
  .app-title h1 {
    font-size: 28px;
  }
  .app-title p {
    font-size: 13px;
  }
}

.logout-btn {
  padding: 8px 12px;
  background: var(--error);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: opacity 0.2s;
}

.logout-btn:hover {
  opacity: 0.9;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .tabs {
    padding: 16px 0;
    justify-content: center;
    gap: 4px;
  }
}

.tab-btn {
  padding: 10px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 229, 160, 0.1);
}

/* Buttons */
button, .btn {
  padding: 12px 20px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

button:hover, .btn:hover {
  background: #00d490;
  transform: translateY(-2px);
}

button:active, .btn:active {
  transform: translateY(0);
}

button:disabled, .btn:disabled {
  background: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent);
  color: #000;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  background: #ff5757;
}

.btn-warning {
  background: var(--warning);
  color: #000;
}

.btn-warning:hover {
  background: #ffcf1f;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-group button,
.btn-group .btn {
  flex: 1;
  min-width: 120px;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  margin: 0;
}

.card-body {
  margin-bottom: 16px;
}

.card-footer {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: rgba(0, 229, 160, 0.2);
  color: var(--success);
}

.badge-error {
  background: rgba(255, 107, 107, 0.2);
  color: var(--error);
}

.badge-warning {
  background: rgba(255, 217, 61, 0.2);
  color: var(--warning);
}

/* Alert messages */
.alert {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 4px solid;
}

.alert-success {
  background: rgba(0, 229, 160, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.alert-error {
  background: rgba(255, 107, 107, 0.1);
  border-color: var(--error);
  color: var(--error);
}

.alert-warning {
  background: rgba(255, 217, 61, 0.1);
  border-color: var(--warning);
  color: var(--warning);
}

.alert-info {
  background: rgba(0, 229, 160, 0.1);
  border-color: var(--accent);
  color: var(--text-secondary);
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading {
  text-align: center;
  padding: 40px 20px;
}

.loading-spinner {
  display: inline-block;
  margin-bottom: 16px;
}

/* Tab content */
.tab-content {
  display: none;
  animation: fadeIn 0.3s;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Main content */
.main-content {
  padding: 20px 16px;
  min-height: calc(100vh - 200px);
}

@media (min-width: 768px) {
  .main-content {
    padding: 40px 0;
  }
}

/* Video container (for camera) */
.video-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 20px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--accent);
  aspect-ratio: 1;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-hint {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 12px;
}

/* Results */
.result-card {
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  animation: slideIn 0.3s;
}

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

.result-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.result-icon {
  font-size: 32px;
}

.result-info h3 {
  margin: 0 0 4px 0;
  font-size: 20px;
}

.result-info p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Search results */
.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.search-result-item:hover {
  border-color: var(--accent);
  background: rgba(0, 229, 160, 0.05);
}

.search-result-name {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.search-result-detail {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.search-result-tickets {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.ticket-item {
  background: rgba(0, 229, 160, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 12px;
}

.ticket-code {
  font-weight: 600;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

/* Admin specific */
.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
}

.data-table th {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--accent);
}

.data-table td {
  border: 1px solid var(--border);
  padding: 12px;
  color: var(--text-secondary);
}

.data-table tr:hover {
  background: rgba(0, 229, 160, 0.03);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Utility classes */
.text-center {
  text-align: center;
}

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}

.text-secondary {
  color: var(--text-secondary);
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-20 {
  margin-bottom: 20px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .btn-group {
    flex-direction: column;
  }

  .btn-group button,
  .btn-group .btn {
    width: 100%;
    min-width: auto;
  }

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

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px;
  }
}
