/* Stock Table Component V2 - React-Inspired Design */
/* Based on the React subscription-v2-ui implementation */

.stock-table-container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  background: #ffffff;
  border-radius: 16px;
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.stock-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: 'Inter', sans-serif;
  min-width: 1200px;
}

/* Table Header - Tan/Brown Theme from React */
.stock-table thead {
  background-color: #E8E3DC;
  height: 60px;
}

.stock-table th {
  padding: 16px 20px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6b6661;
  font-family: 'Inter', sans-serif;
  background-color: #E8E3DC;
  border-right: 1.25px solid rgba(224, 218, 209, 0.8);
  position: relative;
}

.stock-table th:first-child {
  padding-left: 24px;
  min-width: 350px;
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 20;
  border-top-left-radius: 16px;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
}

.stock-table th:last-child {
  border-right: none;
  border-top-right-radius: 16px;
}

.stock-table th:not(:first-child) {
  min-width: 200px;
}

.table-header-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #6b6661;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.stock-table th:first-child .table-header-container {
  justify-content: flex-start;
}

/* Table Body */
.stock-table tbody tr {
  transition: background-color 0.2s ease;
  border-bottom: 1.25px solid rgba(224, 218, 209, 0.5);
}

.stock-table tbody tr:hover {
  background-color: rgba(232, 227, 220, 0.2);
}

.stock-table tbody tr:last-child {
  border-bottom: none;
}

.stock-table td {
  padding: 20px;
  vertical-align: middle;
  font-size: 14px;
  color: #1e1e1e;
  background-color: #ffffff;
  border-right: 1.25px solid rgba(224, 218, 209, 0.5);
  font-family: 'Inter', sans-serif;
}

.stock-table td:first-child {
  padding-left: 24px;
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: #ffffff;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.stock-table td:last-child {
  border-right: none;
}

.stock-table td:not(:first-child) {
  text-align: center;
}

/* Company Info */
.company-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.company-rank {
  font-size: 14px;
  font-weight: 700;
  color: #6b3305;
  min-width: 24px;
  font-family: 'Inter', sans-serif;
}

.company-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.company-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.company-name-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-flag {
  width: 24px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.company-name {
  font-weight: 600;
  font-size: 14px;
  color: #0f0f0f;
  text-decoration: none;
  transition: color 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.company-name:hover {
  color: #6b3305;
  text-decoration: underline;
}

.company-industry {
  font-size: 12px;
  color: #6b6661;
  font-family: 'Inter', sans-serif;
}

/* Score Container */
.score-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
}

.score-number {
  font-weight: 600;
  font-size: 14px;
  color: #0f0f0f;
  min-width: 30px;
  text-align: right;
  font-family: 'SF Mono', monospace;
}

/* Progress Bar - React Style */
.progress-bar {
  width: 100px;
  height: 8px;
  background-color: #DDDDDD;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
}

/* Progress Bar Colors - Matching React */
.progress-fill.light_green {
  background-color: #79B758;
}

.progress-fill.dark_green {
  background-color: #339933;
}

.progress-fill.yellow {
  background-color: #F7D000;
}

.progress-fill.red {
  background-color: #E71313;
}

/* Blurred Columns */
.blurred-column {
  position: relative;
  opacity: 0.3;
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}

/* Blurred Rows */
.blurred-row {
  position: relative;
  opacity: 0.3;
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}

/* Subscription Overlay */
.subscription-overlay {
  position: absolute;
  top: 50%;
  right: 15%;
  transform: translateY(-50%);
  background: white;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid #e5e7eb;
  z-index: 30;
  max-width: 320px;
}

.right-overlay {
  right: 15%;
}

/* Mobile Card Styles - React Inspired */
.stock-cards-mobile {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.stock-card {
  background: white;
  border-radius: 12px;
  border: 1.25px solid rgba(224, 218, 209, 0.8);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-top {
  display: flex;
  align-items: flex-start;
  padding: 16px;
  gap: 12px;
  background-color: #fafafa;
  border-bottom: 1.25px solid rgba(224, 218, 209, 0.5);
}

.card-rank {
  font-size: 16px;
  font-weight: 700;
  color: #6b3305;
  min-width: 28px;
  font-family: 'Inter', sans-serif;
}

.card-company-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.card-company-details {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-flag {
  width: 20px;
  height: 15px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-company-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f0f0f;
  font-family: 'Inter', sans-serif;
}

.card-company-industry {
  font-size: 12px;
  color: #6b6661;
  font-family: 'Inter', sans-serif;
}

.card-bottom {
  position: relative;
  padding: 16px;
}

.card-score-section {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.card-score-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.card-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.card-score span {
  font-size: 16px;
  font-weight: 600;
  color: #0f0f0f;
  font-family: 'SF Mono', monospace;
}

/* Bar Score Visualization - 4 bars like React */
.card-score-bars {
  display: flex;
  gap: 2px;
  height: 20px;
  align-items: flex-end;
}

.score-bar {
  width: 4px;
  height: 20px;
  background-color: #DDDDDD;
  border-radius: 2px;
  transition: background-color 0.3s ease;
}

/* Score bar colors based on rank thresholds */
.score-bar.dark_green {
  background-color: #339933;
}

.score-bar.light_green {
  background-color: #79B758;
}

.score-bar.yellow {
  background-color: #F7D000;
}

.score-bar.red {
  background-color: #E71313;
}

.card-score-label {
  font-size: 11px;
  color: #6b6661;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-align: center;
}

/* Overlay for mobile cards */
.overlay-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0) 100%);
  z-index: 5;
}

.card-subscribe-btn {
  background: #D13D14;
  color: white;
  border: none;
  border-radius: 25px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
}

.card-subscribe-btn:hover {
  background: #b33412;
}

.card-subscribe-btn svg,
.card-subscribe-btn i {
  width: 16px;
  height: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .stock-table-container {
    display: none;
  }

  .stock-cards-mobile {
    display: flex;
  }
}

@media (min-width: 769px) {
  .stock-cards-mobile {
    display: none;
  }

  .stock-table-container {
    display: block;
  }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
  .stock-table {
    min-width: 900px;
  }

  .stock-table th:not(:first-child) {
    min-width: 150px;
  }

  .stock-table th:first-child {
    min-width: 300px;
  }
}
