/* Custom styles for the Shopify dashboard */

:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #6c757d;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --light-color: #f9fafb;
  --dark-color: #111827;
  --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;
  --border-color: #e5e7eb;
  --border-radius: 0.5rem;
  --box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --transition: all 0.2s ease;
}

/* Base styles */
body {
  font-family: "Inter", sans-serif;
  background-color: #f9fafb;
  color: var(--gray-900);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar styles */
.sidebar {
  width: 250px;
  background-color: white;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 1000;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  height: 60px;
  display: flex;
  align-items: center;
}

.sidebar-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--gray-700);
  text-decoration: none;
  transition: var(--transition);
  border-radius: 0.25rem;
  margin: 0 0.5rem;
}

.sidebar-nav-link:hover {
  background-color: var(--gray-100);
  color: var(--gray-900);
}

.sidebar-nav-link.active {
  background-color: var(--gray-100);
  color: var(--gray-900);
  font-weight: 500;
}

.sidebar-nav-link i {
  margin-right: 0.75rem;
  width: 1rem;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Main content styles */
.main-content {
  flex: 1;
  margin-left: 250px;
  overflow-x: hidden;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Card styles */
.card {
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  background-color: white;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-header {
  background-color: white;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem;
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.summary-card .card-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.comparison {
  font-size: 0.875rem;
}

.comparison .positive {
  color: var(--success-color);
}

.comparison .negative {
  color: var(--danger-color);
}

/* Table styles */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  white-space: nowrap;
}

.cursor-pointer {
  cursor: pointer;
}

/* Chart container */
.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
  margin-bottom: 1.5rem;
}

/* Country cards */
.country-card {
  position: relative;
  transition: transform 0.2s ease-in-out;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  background: #fff;
}

.country-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.country-card .card-body {
  padding: 1.25rem;
}

.country-card .trend-chart-container {
  position: relative;
  width: 100%;
  height: 60px;
  margin-bottom: 1rem;
  background-color: rgba(0, 128, 96, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.country-card .trend-chart {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.country-card .card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.country-card .stats {
  margin-bottom: 2.5rem;
}

.country-card .stat-item {
  margin-bottom: 0.5rem;
}

.country-card .stat-label {
  font-size: 0.875rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.country-card .stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
}

.country-card .change-indicator {
  font-size: 0.875rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  margin-left: 0.5rem;
}

.country-card .change-positive {
  color: #198754;
  background-color: rgba(25, 135, 84, 0.1);
}

.country-card .change-negative {
  color: #dc3545;
  background-color: rgba(220, 53, 69, 0.1);
}

.country-card .local-time {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.875rem;
  color: #6c757d;
}

/* Add gradient background for trend area */
.country-card .trend-area {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background: linear-gradient(180deg, rgba(13, 110, 253, 0.1) 0%, rgba(13, 110, 253, 0) 100%);
  border-bottom-left-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  pointer-events: none;
}

.country-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.country-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.country-stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 0.25rem;
}

.country-stat-value {
  font-size: 1.25rem;
  font-weight: 600;
}

.country-stat-change {
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.weekly-trend {
  margin-top: 1rem;
}

.weekly-trend-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}

.weekly-trend-bars {
  display: flex;
  height: 60px;
  align-items: flex-end;
  gap: 2px;
}

.trend-bar {
  flex: 1;
  background-color: var(--primary-color);
  border-radius: 2px 2px 0 0;
  position: relative;
}

.trend-bar-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--gray-800);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  white-space: nowrap;
  display: none;
  z-index: 10;
}

.trend-bar:hover .trend-bar-tooltip {
  display: block;
}

.weekly-trend-dates {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* Debug panel */
.debug-panel {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 400px;
  max-width: 100%;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius) 0 0 0;
  box-shadow: var(--box-shadow);
  z-index: 1050;
  transform: translateY(calc(100% - 40px));
  transition: transform 0.3s ease;
}

.debug-panel.open {
  transform: translateY(0);
}

.debug-header {
  padding: 0.5rem 1rem;
  background-color: var(--gray-100);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.debug-header h4 {
  margin: 0;
  font-size: 1rem;
}

.debug-content {
  padding: 1rem;
  max-height: 300px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.875rem;
  white-space: pre-wrap;
}

.debug-toggle {
  position: absolute;
  top: -30px;
  right: 10px;
  background-color: white;
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

/* Responsive styles */
@media (max-width: 992px) {
  .sidebar {
    width: 200px;
  }

  .main-content {
    margin-left: 200px;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .sidebar-content {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar.expanded .sidebar-content,
  .sidebar.expanded .sidebar-footer {
    display: block;
  }

  .sidebar-header {
    cursor: pointer;
  }
}

/* Dark mode */
body.dark-mode {
  background-color: var(--gray-900);
  color: var(--light-color);
}

body.dark-mode .sidebar {
  background-color: var(--gray-800);
  border-color: var(--gray-700);
}

body.dark-mode .sidebar-header {
  border-color: var(--gray-700);
}

body.dark-mode .sidebar-nav-link {
  color: var(--gray-300);
}

body.dark-mode .sidebar-nav-link:hover {
  background-color: var(--gray-700);
  color: white;
}

body.dark-mode .sidebar-nav-link.active {
  background-color: var(--gray-700);
  color: white;
}

body.dark-mode .sidebar-footer {
  border-color: var(--gray-700);
}

body.dark-mode .card {
  background-color: var(--gray-800);
  border-color: var(--gray-700);
}

body.dark-mode .card-header {
  background-color: var(--gray-800);
  border-color: var(--gray-700);
}

body.dark-mode .table {
  color: var(--light-color);
}

body.dark-mode .table-light {
  background-color: var(--gray-700);
  color: var(--light-color);
}

body.dark-mode .table-hover tbody tr:hover {
  background-color: var(--gray-700);
}

body.dark-mode .text-muted {
  color: var(--gray-400) !important;
}

body.dark-mode .debug-panel {
  background-color: var(--gray-800);
  border-color: var(--gray-700);
}

body.dark-mode .debug-header {
  background-color: var(--gray-700);
  border-color: var(--gray-700);
}

body.dark-mode .debug-toggle {
  background-color: var(--gray-800);
  border-color: var(--gray-700);
}

/* Fix for text color in dark mode */
body.dark-mode .text-dark {
  color: var(--light-color) !important;
}

/* Loading spinner */
.spinner-border {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  vertical-align: text-bottom;
  border: 0.25em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
  to {
    transform: rotate(360deg);
  }
}

/* Clickable rows */
tr.store-row {
  cursor: pointer;
}

/* Toggle icons */
.toggle-details,
.toggle-products,
.toggle-country-details {
  cursor: pointer;
}

/* Fix for collapsible elements */
.details-row,
.products-row {
  background-color: #f8f9fa;
}

body.dark-mode .details-row,
body.dark-mode .products-row {
  background-color: #374151;
}

/* Chart tooltip styles */
.chartjs-tooltip {
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  border-radius: 3px;
  padding: 10px;
  pointer-events: none;
  z-index: 1000;
}

/* Make sure charts are visible */
canvas {
  max-width: 100%;
  height: auto !important;
}

/* Styles for country details */
.country-details {
  display: none;
  background-color: #f9fafb;
  padding: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.country-details.show {
  display: block;
  padding: 1rem;
  max-height: 1000px; /* Arbitrary large value */
  transition: max-height 0.5s ease-in, padding 0.3s ease-in;
}

/* Variants grid */
.variants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.variant-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 1rem;
  background-color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.variant-card h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.variant-card p {
  margin: 0.25rem 0;
  color: #4b5563;
}

/* Dark mode styles */
.dark .country-details {
  background-color: #1f2937;
}

.dark .variant-card {
  background-color: #374151;
  border-color: #4b5563;
}

.dark .variant-card p {
  color: #d1d5db;
}

/* Expanded row styling */
.country-row.expanded {
  background-color: #f3f4f6;
}

.dark .country-row.expanded {
  background-color: #2d3748;
}

/* Summary Card Styles */
.summary-card {
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.comparison-container {
    padding: 8px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.comparison-container .small {
    font-size: 0.875rem;
    color: #6b7177;
}

.comparison-container .text-success {
    color: #008060 !important;
}

.comparison-container .text-danger {
    color: #d82c0d !important;
}

.dark-mode .country-card {
    background-color: #2d3748;
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .country-card .trend-chart-container {
    background-color: rgba(0, 128, 96, 0.1);
}

.dark-mode .country-card .stat-label {
    color: #a0aec0;
}

.dark-mode .country-card .stat-value {
    color: #e2e8f0;
}
