/* 
 * Filename: public/stylesheets/main.css
 * Revision: 2025-12-01-04
 * Description: Main stylesheet for SyncMyCart v2 - Consolidated dashboard styles
 */

/* ============================================================================
   CSS Reset & Base
   ============================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #1e293b;
  background: #f8fafc;
}

/* ============================================================================
   Typography
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 1rem;
  font-weight: 600;
  line-height: 1.25;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin: 0 0 1rem;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================================
   Dashboard Layout - see sidebar.css for sidebar styles
   ============================================================================ */

/* Account Bar - top-most navbar for account icon and future icons */
.account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.account-bar .header-user {
  position: relative;
}

/* Top Bar - secondary navbar below account bar */
.top-bar {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
}

.top-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0d9488 0%, #14b8a6 50%, #2dd4bf 100%);
}

.top-bar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #1e293b;
}

.top-bar .header-badge {
  flex: 1;
  margin-left: 12px;
}

.top-bar .header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.content-header h1 {
  margin: 0;
  font-size: 28px;
  color: #1e293b;
}

.header-badge {
  flex: 1;
}

.header-user {
  position: relative;
}

.account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.account-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.avatar-letter {
  color: white;
  font-weight: 600;
  font-size: 16px;
  text-transform: uppercase;
}

/* Account Modal */
.account-modal {
  position: absolute;
  top: 48px;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  padding: 24px;
  min-width: 280px;
  z-index: 1000;
  text-align: center;
}

.account-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.account-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.avatar-letter-large {
  color: white;
  font-weight: 600;
  font-size: 28px;
  text-transform: uppercase;
}

.account-name {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
}

.account-email {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 12px;
}

.account-link {
  display: block;
  padding: 10px 20px;
  border: 1px solid #2563eb;
  border-radius: 6px;
  color: #2563eb;
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 12px;
  transition: background 0.2s;
}

.account-link:hover {
  background: #eff6ff;
}

.btn-signout {
  width: 100%;
  padding: 10px 20px;
  background: #f1f5f9;
  border: none;
  border-radius: 6px;
  color: #475569;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-signout:hover {
  background: #e2e8f0;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* ============================================================================
   Platform Badges
   ============================================================================ */

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
}

.platform-badge.wix {
  background: #fef3c7;
  color: #92400e;
}

.platform-badge.shopify {
  background: #d1fae5;
  color: #059669;
}

.platform-badge.woocommerce {
  background: #f0e6ff;
  color: #7c3aed;
}

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

section {
  margin-bottom: 32px;
}

section h2 {
  font-size: 18px;
  color: #1e293b;
  margin: 0 0 16px 0;
}

/* ============================================================================
   Alerts
   ============================================================================ */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #d97706;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
}

/* ============================================================================
   Connection Cards
   ============================================================================ */

.connection-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.connection-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 2px solid #e2e8f0;
  transition: all 0.2s ease;
  align-items: flex-start;
}

.connection-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Platform-specific left borders */
.connection-card#wix-card {
  border-left: 4px solid #f59e0b;
}

.connection-card#shopify-card {
  border-left: 4px solid #10b981;
}

.connection-card#woo-card {
  border-left: 4px solid #7c3aed;
}

.connection-card#qbo-card {
  border-left: 4px solid #2ca01c;
}

.card-icon {
  font-size: 32px;
  line-height: 1;
}

.card-content {
  flex: 1;
  min-height: 80px;
}

.card-content h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.card-label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card-actions {
  margin-top: 12px;
}

/* Connection Status */
.status-connected {
  color: #059669;
  font-size: 14px;
}

.status-loading {
  color: #64748b;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status.disconnected {
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 12px;
}

.company-name {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0 0 0;
  font-weight: 500;
}

.connected-date {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0 0 0;
}

.store-url {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0 0 0;
}

.store-info {
  margin-bottom: 16px;
}

.store-name {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
}

.store-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #64748b;
}

.store-details span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.env-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
}

.env-badge.production {
  background: #fef3c7;
  color: #92400e;
}

.env-badge.sandbox {
  background: #dbeafe;
  color: #1e40af;
}

.connection-error {
  color: #dc2626;
  font-size: 13px;
}

/* ============================================================================
   Action Cards
   ============================================================================ */

.action-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 1200px) {
  .action-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.action-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 2px solid transparent;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: #e2e8f0;
}

.action-card:active {
  transform: translateY(0);
}

.action-card.primary-action {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: white;
  border-color: transparent;
}

.action-card.primary-action:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
}

.action-card.primary-action h3,
.action-card.primary-action p {
  color: white;
}

.action-card.primary-action p {
  opacity: 0.9;
}

.action-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.action-card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #1e293b;
}

.action-card p {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

/* ============================================================================
   Activity Log
   ============================================================================ */

.activity-log {
  background: white;
  border-radius: 12px;
  padding: 20px;
  min-height: 120px;
}

.activity-empty {
  text-align: center;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-illustration {
  font-size: 48px;
  opacity: 0.4;
  margin-bottom: 8px;
}

.empty-text {
  color: #64748b;
  font-size: 15px;
  font-weight: 500;
}

.empty-hint {
  color: #94a3b8;
  font-size: 13px;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  font-size: 20px;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 500;
  color: #1e293b;
}

.activity-time {
  font-size: 12px;
  color: #94a3b8;
}

/* ============================================================================
   Wizard Promo (Shopify)
   ============================================================================ */

.wizard-promo {
  background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
  border-radius: 16px;
  padding: 32px;
}

.promo-content {
  display: flex;
  align-items: center;
  gap: 24px;
}

.promo-icon {
  font-size: 48px;
}

.promo-text {
  flex: 1;
}

.promo-text h3 {
  margin: 0 0 8px 0;
  color: white;
  font-size: 20px;
}

.promo-text p {
  margin: 0;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
}

.promo-content .btn {
  background: white;
  color: #1e40af;
}

.promo-content .btn:hover {
  background: #f0f9ff;
  transform: translateY(-1px);
}

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

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #64748b;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #475569;
}

.btn-outline {
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #374151;
}

.btn-outline:hover:not(:disabled) {
  background: #f9fafb;
}

.btn-danger {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

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

.btn-disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.btn-disabled:hover {
  transform: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  display: flex;
  width: 100%;
}

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

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #1e293b;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: #2563eb;
}

.form-control::placeholder {
  color: #9ca3af;
}

.form-hint {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: #64748b;
}

.form-error {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: #dc2626;
}

/* ============================================================================
   Cards (Generic)
   ============================================================================ */

.card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}

/* ============================================================================
   Tables
   ============================================================================ */

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

.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.table th {
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
}

.table tbody tr:hover {
  background: #f8fafc;
}

/* ============================================================================
   Loading & Spinners
   ============================================================================ */

.loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============================================================================
   Tooltips
   ============================================================================ */

.tooltip-wrapper {
  position: relative;
  display: inline-block;
}

.info-icon {
  font-style: normal;
  color: #64748b;
  cursor: help;
}

.tooltip-wrapper:hover .info-icon {
  color: #3b82f6;
}

.info-text {
  display: none;
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 400;
  white-space: normal;
  width: 200px;
  text-align: left;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  margin-left: 8px;
  pointer-events: none;
}

.tooltip-wrapper:hover .info-text {
  display: block;
}

/* ============================================================================
   Utilities
   ============================================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #64748b; }
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }
.text-warning { color: #d97706; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.hidden { display: none !important; }

/* ============================================================================
   Sync Summary
   ============================================================================ */

.sync-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.sync-stat {
  display: flex;
  gap: 4px;
  font-size: 13px;
}

.stat-label {
  color: #64748b;
}

.stat-value {
  font-weight: 600;
  color: #1e293b;
}

.stat-success {
  color: #16a34a;
}

.stat-skipped {
  color: #d97706;
}

.stat-failed {
  color: #dc2626;
}

.details-link {
  font-size: 12px;
  color: #2563eb;
  text-decoration: none;
}

.details-link:hover {
  text-decoration: underline;
}

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

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #1e293b;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #1e293b;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(80vh - 60px);
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #374151;
}

.modal-section ul {
  margin: 0;
  padding-left: 20px;
  color: #64748b;
  font-size: 14px;
}

.modal-section li {
  margin-bottom: 4px;
}

.modal-section .error-list li {
  color: #dc2626;
}

.modal-nav {
  margin-bottom: 16px;
}

.modal-nav a {
  color: #2563eb;
  font-size: 14px;
  text-decoration: none;
}

.modal-nav a:hover {
  text-decoration: underline;
}

/* ============================================================================
   Analysis Summary
   ============================================================================ */

.analysis-summary {
  background: #f8fafc;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #e5e7eb;
}

.summary-row:last-child {
  border-bottom: none;
}

.analysis-filters,
.analysis-exports {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.analysis-filters p,
.analysis-exports p {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 8px;
}

.analysis-filters a,
.analysis-exports a {
  display: inline-block;
  margin-right: 12px;
  margin-bottom: 8px;
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
}

.analysis-filters a:hover,
.analysis-exports a:hover {
  background: #e2e8f0;
}

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

.items-table-wrapper {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 12px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.items-table th,
.items-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.items-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #64748b;
  position: sticky;
  top: 0;
}

.items-table tr:hover {
  background: #f8fafc;
}

.pagination-info,
.pagination-note {
  font-size: 12px;
  color: #64748b;
  margin-top: 12px;
  text-align: center;
}