/* ========================================
   Club Wallet - Styles
   ======================================== */

/* CSS Variables */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========================================
   Landing Page
   ======================================== */

.landing-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
}

.landing-header {
  text-align: center;
  padding: 4rem 2rem 2rem;
  color: var(--white);
}

.landing-header .lang-switcher {
  justify-content: center;
  margin-top: 1rem;
  color: var(--gray-300);
}

.landing-header .lang-switcher select {
  background: var(--gray-900);
  color: var(--white);
  border-color: var(--gray-700);
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.logo-icon {
  font-size: 3rem;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--gray-400);
  font-size: 1.1rem;
}

.landing-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 800px;
  width: 100%;
}

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-md);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--gray-800);
}

.card p {
  color: var(--gray-500);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.card-action {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.landing-footer {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* ========================================
   App Container (Admin & Validator)
   ======================================== */

.app-container {
  min-height: 100vh;
  background: var(--gray-50);
}

.app-header {
  background: var(--white);
  padding: 1rem 2rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}

.lang-switcher {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-600);
}

.lang-switcher select {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--gray-700);
}

.back-link {
  color: var(--gray-500);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--primary);
}

.app-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-800);
}

.app-main {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ========================================
   Sections
   ======================================== */

.section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.section-header h2 {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* ========================================
   Forms
   ======================================== */

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

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

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
}

.form-group input,
.form-group select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input::placeholder {
  color: var(--gray-400);
}

.form-actions {
  display: flex;
  align-items: flex-end;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn-text {
  background: transparent;
  color: var(--gray-500);
  padding: 0.5rem;
}

.btn-text:hover {
  color: var(--gray-700);
}

.btn-icon {
  font-size: 1.1rem;
}

.btn-icon-action {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-icon-action:hover {
  opacity: 1;
  transform: scale(1.1);
}

.btn-icon-action.btn-danger:hover {
  color: var(--danger);
}

/* ========================================
   Table
   ======================================== */

.table-container {
  overflow-x: auto;
}

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

.table th,
.table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr:hover {
  background: var(--gray-50);
}

.table code {
  background: var(--gray-100);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.table .loading,
.table .no-data,
.table .error {
  text-align: center;
  color: var(--gray-500);
  padding: 2rem;
}

.table .error {
  color: var(--danger);
}

.table .actions {
  display: flex;
  gap: 0.5rem;
}

/* ========================================
   Status & Badges
   ======================================== */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.status-active {
  background: var(--success-light);
  color: var(--success);
}

.status-inactive {
  background: var(--danger-light);
  color: var(--danger);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-type {
  background: var(--primary-light);
  color: var(--white);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-pending {
  background: var(--gray-100);
  color: var(--gray-500);
}

/* ========================================
   Modal
   ======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 1000;
  padding: 1rem;
}

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

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-400);
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--gray-600);
}

.modal-content h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--gray-800);
}

.wallet-result {
  text-align: center;
}

.success-message {
  color: var(--success);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.demo-warning {
  background: var(--warning-light);
  color: var(--warning);
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.wallet-link-container {
  margin: 1.5rem 0;
  text-align: left;
}

.link-box {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.link-box input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.wallet-actions {
  margin: 1.5rem 0;
}

.qr-container {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.qr-code {
  margin-top: 1rem;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  border-radius: var(--radius);
}

.qr-code img {
  border-radius: var(--radius);
  max-width: 280px;
  width: 100%;
  height: auto;
}

.qr-code canvas {
  border-radius: var(--radius);
  max-width: 280px;
  width: 100%;
  height: auto;
}

.qr-placeholder {
  color: var(--gray-500);
  font-size: 0.9rem;
}

/* ========================================
   Validator App
   ======================================== */

.validator-app .app-main {
  max-width: 600px;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.tab {
  flex: 1;
  padding: 0.875rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--gray-700);
}

.tab.active {
  background: var(--primary);
  color: var(--white);
}

/* Mode Sections */
.mode-section {
  display: none;
}

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

/* Scanner */
.scanner-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

#qr-reader {
  max-width: 400px;
  margin: 0 auto 1rem;
  border-radius: var(--radius);
  overflow: hidden;
}

#qr-reader video {
  border-radius: var(--radius);
}

.scanner-controls {
  margin: 1rem 0;
}

.scanner-hint {
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* Manual Form */
.manual-form {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.manual-form input {
  text-transform: uppercase;
  font-family: monospace;
  font-size: 1.25rem;
  text-align: center;
  letter-spacing: 0.1em;
}

.input-hint {
  text-align: center;
  color: var(--gray-500);
  font-size: 0.85rem;
}

/* Result Modal */
.result-section.result-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1200;
}

.result-modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.result-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-400);
  cursor: pointer;
}

.result-modal-close:hover {
  color: var(--gray-600);
}

.result-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border: 3px solid transparent;
  transition: border-color 0.3s;
}

.result-card.valid {
  border-color: var(--success);
}

.result-card.invalid {
  border-color: var(--danger);
}

.result-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.result-status.valid {
  color: var(--success);
}

.result-status.invalid {
  color: var(--danger);
}

.status-icon {
  font-size: 2rem;
}

.result-message {
  text-align: center;
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}

.member-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: var(--radius);
}

.member-avatar {
  width: 60px;
  height: 60px;
  background: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.member-details h4 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.member-id {
  font-family: monospace;
  color: var(--gray-500);
  font-size: 0.9rem;
}

.member-type {
  margin: 0.5rem 0;
}

.member-expiration {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.result-loading {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

/* History Section */
.history-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 2rem;
  box-shadow: var(--shadow);
}

.history-section h3 {
  font-size: 1rem;
  color: var(--gray-700);
  margin-bottom: 1rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.no-history {
  color: var(--gray-400);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius);
  border-left: 3px solid var(--gray-300);
}

.history-item.valid {
  border-left-color: var(--success);
}

.history-item.invalid {
  border-left-color: var(--danger);
}

.history-status {
  font-size: 1.25rem;
}

.history-item.valid .history-status {
  color: var(--success);
}

.history-item.invalid .history-status {
  color: var(--danger);
}

.history-details {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.history-name {
  font-weight: 500;
  color: var(--gray-800);
}

.history-id {
  font-family: monospace;
  color: var(--gray-500);
}

.history-time {
  color: var(--gray-400);
  font-size: 0.8rem;
}

/* ========================================
   Notifications
   ======================================== */

.notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--gray-800);
  color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  z-index: 2000;
}

.notification.show {
  transform: translateY(0);
  opacity: 1;
}

.notification-success {
  background: var(--success);
}

.notification-error {
  background: var(--danger);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
  .landing-header {
    padding: 2rem 1rem 1rem;
  }

  .logo h1 {
    font-size: 2rem;
  }

  .cards-container {
    grid-template-columns: 1fr;
  }

  .app-header {
    padding: 1rem;
  }

  .app-header h1 {
    font-size: 1.25rem;
  }

  .app-main {
    padding: 1rem;
  }

  .section {
    padding: 1rem;
  }

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

  .table th,
  .table td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  .modal-content {
    padding: 1.5rem;
  }

  .notification {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}

@media (max-width: 480px) {
  .table {
    font-size: 0.75rem;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
  }
}
