/* Earnings Calendar - Professional Institutional Styling */

:root {
  --earnings-card-bg: rgba(0, 20, 30, 0.6);
  --earnings-glass-border: rgba(0, 128, 148, 0.2);
  --sentiment-bullish: #10b981;
  --sentiment-bearish: #ef4444;
  --sentiment-neutral: #64748b;
  --urgency-urgent: #ef4444;
  --urgency-soon: #f59e0b;
  --urgency-upcoming: #10b981;
}

/* Page Header Refinement */
.page-header {
  margin-bottom: var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--earnings-glass-border);
  padding-bottom: var(--spacing-lg);
}

.header-main h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-main p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Institutional Badge Mini */
.institutional-badge-mini {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  padding: 6px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffd700;
  margin-bottom: var(--spacing-sm);
}

/* Control Bar */
.earnings-controls {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 24px;
  margin-bottom: var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--card-shadow);
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-primary);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--earnings-glass-border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  background: rgba(0, 128, 148, 0.1);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 0 15px rgba(0, 128, 148, 0.4);
}

/* Earnings Grid */
.earnings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
  margin-bottom: var(--spacing-2xl);
}

/* Professional Earnings Card */
.earnings-card {
  background: var(--earnings-card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--earnings-glass-border);
  border-radius: 16px;
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  animation: card-entry 0.6s ease-out backwards;
}

@keyframes card-entry {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.earnings-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--accent-primary);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 128, 148, 0.2);
}

/* Urgency Glow */
.earnings-card.urgent::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle at top right, rgba(239, 68, 68, 0.1), transparent 70%);
  pointer-events: none;
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ticker-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ticker-badge {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-primary);
  letter-spacing: 0.5px;
}

.company-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.urgency-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.urgency-badge.urgent {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.urgency-badge.soon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.urgency-badge.upcoming {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Impact Visualization */
.impact-section {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px;
}

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

.impact-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.impact-value {
  font-size: 0.85rem;
  font-weight: 700;
}

.sentiment-gauge {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease-out;
}

.gauge-fill.bullish {
  background: linear-gradient(to right, #10b981, #34d399);
}

.gauge-fill.neutral {
  background: linear-gradient(to right, #64748b, #94a3b8);
}

.gauge-fill.bearish {
  background: linear-gradient(to right, #ef4444, #f87171);
}

/* Metadata List */
.metadata-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.meta-value.accent {
  color: var(--accent-primary);
}

/* Action Footers */
.card-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--earnings-glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-view-analysis {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-view-analysis:hover {
  background: var(--accent-primary);
  color: white;
}

.time-stamp {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.05) 25%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-pulse {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  height: 250px;
  border-radius: 16px;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  padding: 80px;
  text-align: center;
  background: var(--earnings-card-bg);
  border: 2px dashed var(--earnings-glass-border);
  border-radius: 16px;
}

.empty-icon {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .earnings-controls {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* Progress Overlay */
.sync-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 11, 30, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.4s ease-out;
}

.sync-modal {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 40px;
  width: 90%;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

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

.sync-icon {
  font-size: 3rem;
  display: inline-block;
  animation: rotate 2s linear infinite;
}

.sync-modal h3 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(to right, #fff, #a0aec0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.progress-container {
  margin: 32px 0;
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #008094, #00e5c8);
  box-shadow: 0 0 15px rgba(0, 128, 148, 0.5);
  transition: width 0.4s cubic-bezier(0.1, 0, 0.2, 1);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.sync-note {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.btn-dismiss-sync {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-dismiss-sync:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Earnings Enhanced Controls & Calendar */
.control-groups {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.filter-select {
  background: rgba(15, 23, 42, 0.8);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 15px;
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-chevron-down'%3E%3Cpolyline points='3 4 6 7 9 4'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 35px;
}

.filter-select:hover {
  background: #0f172a;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 128, 148, 0.1);
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 128, 148, 0.15);
}

.filter-select option {
  background: #0f172a;
  color: #fff;
  padding: 12px;
}

/* Visual Catalyst Matrix (Calendar) */
.calendar-panel-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--card-shadow);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.calendar-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  color: #fff;
}

.calendar-legend {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot.urgent {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

.dot.soon {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.dot.upcoming {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.calendar-day {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.calendar-day:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.calendar-day.selected {
  background: rgba(0, 128, 148, 0.2);
  border-color: var(--accent-primary);
  box-shadow: inset 0 0 10px rgba(0, 128, 148, 0.3);
}

.day-num {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.day-name {
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
}

.calendar-day.empty {
  opacity: 0.4;
  cursor: default;
}

.calendar-day.empty:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.03);
}

.calendar-day.upcoming {
  border-bottom: 3px solid #10b981;
}

.calendar-day.soon {
  border-bottom: 3px solid #f59e0b;
}

.calendar-day.urgent {
  border-bottom: 3px solid #ef4444;
}

.event-count {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 4px;
  border-radius: 4px;
  color: #fff;
}

/* Card Improvements */
.sector-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent-primary);
  opacity: 0.8;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .calendar-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
}