/* POC-02 Supabase Sync Styles */
/* Enhanced from POC-01 with sync status indicators */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
header {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

header h1 {
  color: var(--primary);
  margin-bottom: 0.25rem;
  font-size: 1.875rem;
}

.subtitle {
  color: var(--gray-600);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.status-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-label {
  font-size: 0.75rem;
  color: var(--gray-600);
  text-transform: uppercase;
}

.status {
  padding: 0.25rem 0.75rem;
  background: var(--gray-100);
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.status.online {
  background: #d1fae5;
  color: var(--success);
}

.status.offline {
  background: #fee2e2;
  color: var(--danger);
}

.status.disconnected {
  background: #fef3c7;
  color: #d97706;
}

/* Sync info bar */
.sync-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1rem;
}

.sync-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.sync-label {
  color: var(--gray-600);
}

.device-id {
  font-family: monospace;
  background: var(--gray-100);
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
}

.sync-status {
  color: var(--info);
  font-weight: 500;
}

/* Main content */
main {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
  }
}

/* Form section */
.transaction-form {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  height: fit-content;
}

.transaction-form h2 {
  margin-bottom: 1.5rem;
  color: var(--gray-800);
  font-size: 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

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

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--gray-700);
  font-size: 0.875rem;
}

input,
select {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

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

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

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

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

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

.btn-info:hover {
  background: #2563eb;
}

/* Transactions list */
.transactions-list {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.section-header h2 {
  color: var(--gray-800);
  font-size: 1.25rem;
}

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

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.stat-card {
  background: var(--gray-50);
  border-radius: 0.375rem;
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Transaction cards */
#transactions-container {
  max-height: 500px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-600);
}

.transaction-card {
  border: 1px solid var(--gray-200);
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
}

.transaction-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.transaction-card.pending {
  border-left: 4px solid var(--warning);
  background: #fffbeb;
}

.transaction-card.synced {
  border-left: 4px solid var(--success);
}

.transaction-card.remote {
  border-left-color: var(--info);
  background: #eff6ff;
}

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

.transaction-item {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 1.125rem;
}

.transaction-total {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.25rem;
}

.transaction-details {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-600);
}

.transaction-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-200);
}

.transaction-time {
  font-size: 0.75rem;
  color: var(--gray-600);
}

.sync-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
}

.sync-badge.synced {
  background: #d1fae5;
  color: var(--success);
}

.sync-badge.pending {
  background: #fef3c7;
  color: #d97706;
}

/* Footer */
footer {
  margin-top: 2rem;
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.instructions h3,
.setup-info h3 {
  color: var(--gray-800);
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.instructions ol,
.setup-info ol {
  margin-left: 1.5rem;
  color: var(--gray-700);
}

.instructions li,
.setup-info li {
  margin-bottom: 0.5rem;
}

.test-scenario {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 0.375rem;
}

.test-scenario h4 {
  color: var(--gray-800);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.test-scenario ol {
  font-size: 0.875rem;
}

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

.setup-info code {
  background: var(--gray-100);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.setup-info a {
  color: var(--primary);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--gray-900);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
  transform: translateY(150%);
  transition: transform 0.3s ease-in-out;
  z-index: 1000;
  max-width: 400px;
}

.toast.show {
  transform: translateY(0);
}

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

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

.toast.warning {
  background: var(--warning);
}

.toast.info {
  background: var(--info);
}

/* Scrollbar styling */
#transactions-container::-webkit-scrollbar {
  width: 8px;
}

#transactions-container::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 4px;
}

#transactions-container::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

#transactions-container::-webkit-scrollbar-thumb:hover {
  background: var(--gray-600);
}
