/* Shipment Analytics CSS
 * - Supports both light and dark themes
 * - Uses CSS variables to match your site's existing colors
 * - Just add to your root directory
 */

/* Base container */
.shipment-analytics {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header styles */
.analytics-header {
  text-align: center;
  margin-bottom: 30px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.analytics-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.analytics-subtitle {
  font-size: 0.875rem;
  opacity: 0.7;
  margin: 0;
}

.clear-button {
  position: absolute;
  right: 0;
  background-color: transparent;
  border: 1px solid;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Upload card */
.upload-card {
  background-color: var(--card-bg, #ffffff);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 24px;
  max-width: 600px;
  margin: 0 auto;
}

.upload-header {
  margin-bottom: 20px;
}

.upload-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
}

.upload-subtitle {
  font-size: 0.875rem;
  opacity: 0.7;
  margin: 0;
}

.dropzone {
  border: 2px dashed var(--border-color, #cbd5e1);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.dropzone-active {
  border-color: var(--primary-color, #3b82f6);
  background-color: var(--primary-bg-subtle, #eff6ff);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.file-icon {
  font-size: 48px;
  opacity: 0.5;
}

.drop-text {
  font-size: 1.125rem;
  font-weight: 500;
  margin: 0 0 8px 0;
}

.browse-text {
  font-size: 0.875rem;
  opacity: 0.7;
  margin: 0 0 16px 0;
}

.file-input {
  display: none;
}

.button {
  background-color: var(--primary-color, #3b82f6);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
}

.support-text {
  font-size: 0.75rem;
  opacity: 0.5;
  margin: 16px 0 0 0;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--primary-color, #3b82f6);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 1rem;
  opacity: 0.7;
}

/* Metrics cards */
.metrics-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.metric-card {
  background-color: var(--card-bg, #ffffff);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 20px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.metric-title {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.7;
}

.metric-icon {
  font-size: 1rem;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.revenue-value {
  color: var(--success-color, #10b981);
}

.cost-value {
  color: var(--danger-color, #ef4444);
}

.profit-value {
  color: var(--primary-color, #3b82f6);
}

.weight-value {
  color: var(--info-color, #8b5cf6);
}

.metric-subtext {
  font-size: 0.75rem;
  opacity: 0.5;
  margin: 0;
}

/* Tabs */
.tabs-container {
  background-color: var(--card-bg, #ffffff);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.tabs-list {
  display: flex;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.tab-button {
  flex: 1;
  padding: 12px;
  border: none;
  background: none;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.7;
  cursor: pointer;
  transition: all 0.2s ease;
}

.active-tab {
  color: var(--primary-color, #3b82f6);
  border-bottom: 2px solid var(--primary-color, #3b82f6);
  opacity: 1;
}

.tab-content {
  padding: 24px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 20px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.summary-card {
  background-color: var(--card-bg-subtle, #f8fafc);
  border-radius: 8px;
  padding: 20px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 16px;
}

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

.table-label {
  font-size: 0.875rem;
  opacity: 0.7;
  padding: 8px 0;
  text-align: left;
}

.table-value {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 0;
  text-align: right;
}

.table-container {
  margin-bottom: 30px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-header {
  background-color: var(--table-header-bg, #f1f5f9);
  opacity: 0.7;
  font-weight: 500;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.table-row-even {
  background-color: var(--card-bg, #ffffff);
}

.table-row-odd {
  background-color: var(--card-bg-subtle, #f8fafc);
}

.table-cell {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.bar-chart-container {
  background-color: var(--card-bg-subtle, #f8fafc);
  border-radius: 8px;
  padding: 20px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar-chart-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-label {
  width: 120px;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-wrapper {
  flex: 1;
  height: 20px;
  background-color: var(--bar-bg, #e2e8f0);
  border-radius: 4px;
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: 4px;
}

.bar-value {
  width: 60px;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: right;
}

.geography-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.geography-card {
  background-color: var(--card-bg, #ffffff);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 20px;
}

/* CSS Variables for theming - these will inherit from your site's theme */
:root {
  /* Light theme colors (default) */
  --primary-color: #3b82f6;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --info-color: #8b5cf6;
  --warning-color: #f59e0b;
  
  --card-bg: #ffffff;
  --card-bg-subtle: #f8fafc;
  --border-color: #e2e8f0;
  --table-header-bg: #f1f5f9;
  --bar-bg: #e2e8f0;
  
  --color-0: #3b82f6;
  --color-1: #10b981;
  --color-2: #f59e0b;
  --color-3: #ef4444;
  --color-4: #8b5cf6;
}

/* Dark theme - will automatically apply when your site is in dark mode */
.dark-theme .shipment-analytics,
[data-theme="dark"] .shipment-analytics,
.dark .shipment-analytics {
  --card-bg: #1e293b;
  --card-bg-subtle: #0f172a;
  --border-color: #334155;
  --table-header-bg: #1e293b;
  --bar-bg: #334155;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .metrics-container {
    grid-template-columns: 1fr;
  }
  
  .summary-grid,
  .geography-grid {
    grid-template-columns: 1fr;
  }
  
  .bar-label {
    width: 80px;
  }
}

/* Animation for smoother transitions */
.shipment-analytics * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

