/* InvoiceForge.ai Brand Design System */
/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Brand Colors - InvoiceForge.ai */
  --primary-color: #1A2B4A;        /* Deep Navy Blue */
  --accent-color: #0066FF;          /* Electric Blue */
  --secondary-accent: #00D4AA;      /* Teal */
  --bg-color: #F5F7FA;              /* Light Gray Background */
  --text-color: #2D3748;            /* Dark Gray Text */

  /* Semantic Colors */
  --success-color: #00D4AA;         /* Using brand teal for success */
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --info-color: #0066FF;            /* Using brand electric blue */

  /* UI Colors */
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px rgba(26, 43, 74, 0.1);
  --shadow-md: 0 4px 6px rgba(26, 43, 74, 0.1);
  --shadow-lg: 0 10px 15px rgba(26, 43, 74, 0.1);
}

/* Google Fonts Import - Brand Typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Roboto:wght@400;500;700&display=swap');

body {
  font-family: 'Roboto', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Navigation - Brand Design */
.navbar {
  background: var(--primary-color);
  border-bottom: none;
  padding: 1rem 0;
  box-shadow: var(--shadow-md);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.nav-brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

.nav-brand .ai-text {
  color: var(--accent-color);
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-link.active {
  background-color: var(--accent-color);
  color: white;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
}

main.container {
  padding: 2rem;
  min-height: calc(100vh - 200px);
}

/* Typography - Brand System */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', 'Roboto', sans-serif;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.2;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

h4 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* Statistics Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  border-left: 4px solid var(--primary-color);
}

.stat-card.success {
  border-left-color: var(--success-color);
}

.stat-card.warning {
  border-left-color: var(--warning-color);
}

.stat-card.error {
  border-left-color: var(--error-color);
}

.stat-card.info {
  border-left-color: var(--info-color);
}

.stat-icon {
  font-size: 2.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-color);
}

.stat-label {
  color: var(--secondary-color);
  font-size: 0.875rem;
}

/* Cards */
.card {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

/* Tables */
.table-container {
  overflow-x: auto;
  background: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-color);
  font-weight: 600;
  color: var(--text-color);
}

tr:hover {
  background-color: #f9fafb;
}

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

.line-items-table tfoot td {
  border-top: 2px solid var(--border-color);
  padding-top: 1rem;
}

.total-row td {
  font-size: 1.125rem;
  padding-top: 0.5rem;
}

.text-right {
  text-align: right;
}

/* Buttons - Brand Design */
.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  background-color: var(--accent-color);
  color: white;
  text-decoration: none;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 4px rgba(0, 102, 255, 0.2);
}

.btn:hover {
  background-color: #0052cc;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 102, 255, 0.3);
}

.btn-secondary {
  background-color: var(--text-color);
  box-shadow: 0 2px 4px rgba(45, 55, 72, 0.2);
}

.btn-secondary:hover {
  background-color: #1a202c;
  box-shadow: 0 4px 8px rgba(45, 55, 72, 0.3);
}

.btn-success {
  background-color: var(--success-color);
  box-shadow: 0 2px 4px rgba(0, 212, 170, 0.2);
}

.btn-success:hover {
  background-color: #00b894;
  box-shadow: 0 4px 8px rgba(0, 212, 170, 0.3);
}

.btn-danger {
  background-color: var(--error-color);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.btn-primary {
  background-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(26, 43, 74, 0.2);
}

.btn-primary:hover {
  background-color: #0f1a2e;
  box-shadow: 0 4px 8px rgba(26, 43, 74, 0.3);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

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

.action-buttons-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.large {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.status-badge.pending {
  background-color: #fef3c7;
  color: #92400e;
}

.status-badge.approved {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.uploaded {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-badge.rejected {
  background-color: #fee2e2;
  color: #991b1b;
}

.status-badge.error {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Confidence Score */
.confidence {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.confidence.large {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.confidence.high {
  background-color: #d1fae5;
  color: #065f46;
}

.confidence.low {
  background-color: #fed7aa;
  color: #92400e;
}

/* Filters */
.filters {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.filter-form {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--secondary-color);
}

.filter-group input,
.filter-group select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

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

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

/* Detail List */
.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
}

.detail-list dt {
  font-weight: 600;
  color: var(--secondary-color);
}

.detail-list dd {
  color: var(--text-color);
}

/* Status Section */
.status-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.xero-info,
.error-message {
  padding: 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.xero-info {
  background-color: #dbeafe;
  color: #1e40af;
}

.error-message {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Log Container */
.log-container {
  max-height: 400px;
  overflow-y: auto;
}

.log-entry {
  display: flex;
  gap: 1rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-time {
  color: var(--secondary-color);
  white-space: nowrap;
}

.log-action {
  font-weight: 600;
  color: var(--primary-color);
}

.log-details {
  color: var(--secondary-color);
}

/* Footer */
.footer {
  background: white;
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--secondary-color);
  font-size: 0.875rem;
}

/* Responsive */
/* Hamburger Menu Button */
.hamburger-menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger-menu span {
  width: 24px;
  height: 3px;
  background-color: white;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.hamburger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  /* Navigation - Hamburger Menu */
  .hamburger-menu {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 70px;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: calc(100vh - 70px);
    background: var(--primary-color);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
    z-index: 999;
  }

  .nav-links.active {
    right: 0;
  }

  .nav-link {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
  }

  .nav-link:last-child {
    border-bottom: none;
  }

  .nav-brand h1 {
    font-size: 1.25rem;
  }

  /* Container */
  .container {
    padding: 0 1rem;
  }

  /* Stats Grid */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Tables - Horizontal Scroll */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  /* Filter Form */
  .filter-form {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .filter-form input,
  .filter-form select {
    width: 100%;
  }

  /* Page Header */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .header-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
    min-width: 120px;
  }

  /* Detail Grid */
  .detail-grid {
    grid-template-columns: 1fr;
  }

  /* Cards */
  .card {
    padding: 1rem;
  }

  /* Status Cards */
  .status-cards {
    grid-template-columns: 1fr;
  }

  .status-card {
    flex-direction: column;
    text-align: center;
  }

  /* Buttons */
  .btn {
    width: 100%;
    justify-content: center;
  }

  /* Modal */
  .modal-content {
    padding: 1.5rem;
    width: 95%;
  }

  .modal-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .modal-actions .btn {
    width: 100%;
  }

  /* Forms */
  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Invoice Detail */
  .invoice-header {
    flex-direction: column;
    gap: 1rem;
  }

  .invoice-actions {
    flex-direction: column;
    width: 100%;
  }

  .invoice-actions .btn {
    width: 100%;
  }

  /* Line Items Table */
  .line-items-table {
    font-size: 0.875rem;
  }

  .line-items-table th,
  .line-items-table td {
    padding: 0.5rem;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
}

.modal-content h2 {
  color: var(--warning-color);
  margin-bottom: 1rem;
}

.modal-content p {
  margin-bottom: 1rem;
  color: var(--text-color);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

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

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

/* Integration Status Section */
.integration-status {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.integration-status h3 {
  margin-bottom: 1rem;
  color: var(--text-color);
  font-size: 1.25rem;
}

.status-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: #fafafa;
  transition: all 0.3s ease;
}

.status-card.connected {
  background: #f0fdf4;
  border-color: var(--success-color);
}

.status-card.disconnected {
  background: #fef2f2;
  border-color: var(--error-color);
}

.status-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.status-info {
  flex: 1;
}

.status-info h4 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
  color: var(--text-color);
}

.status-message {
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin: 0;
}

.status-card.connected .status-message {
  color: var(--success-color);
  font-weight: 500;
}

.status-card.disconnected .status-message {
  color: var(--error-color);
  font-weight: 500;
}

.status-button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
}

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

.status-button.connect:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.status-button.reconnect {
  background-color: var(--primary-color);
  color: white;
}

.status-button.reconnect:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

/* Tooltip Styles */
.tooltip-container {
  position: relative;
  display: inline-block;
}

.tooltip-container .tooltip-text {
  visibility: hidden;
  opacity: 0;
  background-color: #1f2937;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.tooltip-container .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}
