/* VTC Invoice App - Mobile-first CSS */
/* Dark navy/charcoal theme with gold accent */

:root {
  /* Colors */
  --color-bg: #0A0E17;
  --color-surface: #151A25;
  --color-surface-light: #1E2532;
  --color-text-primary: #F5F5F5;
  --color-text-secondary: #A0A0A0;
  --color-text-muted: #606060;
  --color-border: #2A3245;
  --color-gold: #C9A84C;
  --color-success: #22C55E;
  --color-error: #EF4444;
  --color-warning: #F59E0B;

  /* Typography */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing */
  --spacing-unit: 8px;
  --spacing-sm: calc(var(--spacing-unit) * 2);
  --spacing-md: calc(var(--spacing-unit) * 3);

  /* Border radius */
  --radius-card: 12px;
  --radius-button: 8px;
  --radius-input: 4px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
}

/* NoScript fallback */
.noscript {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--spacing-md);
  text-align: center;
}

.noscript h1 {
  color: var(--color-error);
  margin-bottom: var(--spacing-sm);
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 80px; /* Space for bottom nav */
}

/* Screens */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  animation: fadeIn var(--transition-slow);
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Screen Header */
.screen-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--color-surface);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
}

.screen-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* Screen Content */
.screen-content {
  flex: 1;
  padding: var(--spacing-md);
  overflow-y: auto;
}

/* Placeholder */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--color-text-muted);
  text-align: center;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--spacing-sm) 0;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--spacing-sm);
  color: var(--color-text-secondary);
  transition: color var(--transition-normal);
  min-height: 44px;
}

.nav-item:hover {
  color: var(--color-text-primary);
}

.nav-item.active {
  color: var(--color-gold);
}

.nav-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Responsive */
@media (min-width: 768px) {
  #app {
    max-width: 768px;
    margin: 0 auto;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
  }

  .bottom-nav {
    max-width: 768px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus states for keyboard navigation */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-normal);
}

.modal-content {
  background-color: var(--color-surface);
  border-radius: var(--radius-card);
  padding: var(--spacing-md);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--color-border);
}

.modal-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-md);
}

.modal-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  flex-wrap: wrap;
}

.modal-actions button {
  flex: 1;
  min-width: 120px;
}

.invoice-detail p {
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-secondary);
}

.invoice-detail strong {
  color: var(--color-text-primary);
}

/* Client suggestions */
.client-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--color-surface-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
}

.suggestion-item {
  padding: var(--spacing-sm);
  cursor: pointer;
  transition: background-color var(--transition-normal);
}

.suggestion-item:hover {
  background-color: var(--color-border);
}

.suggestion-name {
  font-weight: 500;
  color: var(--color-text-primary);
}

.suggestion-address {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Onboarding/Install banners */
.onboarding-banner,
.install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--color-gold);
  color: var(--color-bg);
  padding: var(--spacing-sm);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.banner-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1;
}

.banner-close {
  background: none;
  border: none;
  color: var(--color-bg);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 8px;
}

.install-button {
  background-color: var(--color-bg);
  color: var(--color-gold);
  padding: 8px 16px;
  border-radius: var(--radius-button);
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition-normal);
}

.install-button:hover {
  opacity: 0.9;
}

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

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

/* Base button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-button);
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  min-height: 44px;
  width: 100%;
}

/* Primary button (gold accent) */
.btn-primary {
  background-color: var(--color-gold);
  color: var(--color-bg);
  font-weight: 600;
}

.btn-primary:hover {
  background-color: #b8943d;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(201, 168, 76, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Secondary button (surface color) */
.btn-secondary {
  background-color: var(--color-surface-light);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: var(--color-border);
  border-color: var(--color-gold);
}

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

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

/* Small button */
.btn-sm {
  padding: 8px 12px;
  font-size: 0.875rem;
}

/* Card row */
.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-row:last-child {
  margin-bottom: 0;
}

/* Status badge */
.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending {
  background-color: var(--color-warning);
  color: var(--color-bg);
}

.status-confirmed {
  background-color: var(--color-success);
  color: white;
}

.status-cancelled {
  background-color: var(--color-error);
  color: white;
}

.status-converted_to_invoice {
  background-color: var(--color-gold);
  color: var(--color-bg);
}

/* Filter buttons */
.filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface-light);
  color: var(--color-text-secondary);
  border-radius: var(--radius-button);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.filter-btn:hover {
  background-color: var(--color-border);
  color: var(--color-text-primary);
}

.filter-btn.active {
  background-color: var(--color-gold);
  color: var(--color-bg);
  border-color: var(--color-gold);
}
