/* Crypto Up/Down Event Page Styles */
/* Prefix: cu- (crypto-updown) */
/* Uses existing theme CSS variables from styles.css */

/* ===== PAGE LAYOUT ===== */
.cu-page {
  display: flex;
  gap: 24px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px;
}

.cu-main {
  flex: 1;
  min-width: 0;
}

.cu-sidebar {
  width: 340px;
  flex-shrink: 0;
}

/* ===== HEADER ===== */
.cu-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cu-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cu-coin-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.cu-coin-icon img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.cu-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cu-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.cu-subtitle {
  font-size: 16px;
  font-weight: 500;
  color: #77808D;
}

[data-theme="dark"] .cu-subtitle { color: var(--text-muted); }

/* ===== PRICE DIGIT WHEEL ===== */
.cu-price-wheel {
  display: inline-flex;
  align-items: baseline;
  line-height: 1.2;
}

.cu-price-wheel-static {
  font-size: 22px;
  font-weight: 600;
  color: #FF9900;
  line-height: 28px;
}

.cu-price-wheel-digit {
  width: 13px;
  height: 28px;
  overflow: hidden;
  position: relative;
  display: inline-block;
}

/* Wider for larger digits like 0, 1 */
.cu-price-wheel-digit[data-wide="1"] { width: 15px; }

.cu-price-wheel-digit-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.cu-price-wheel-digit-char {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: #FF9900;
  font-variant-numeric: tabular-nums;
}

/* Price flash animation on update */
@keyframes cu-flash-up { 0% { color: #30A159; } 100% { color: #FF9900; } }
@keyframes cu-flash-down { 0% { color: #FF3B30; } 100% { color: #FF9900; } }
.cu-price-flash-up { animation: cu-flash-up 0.6s ease-out; }
.cu-price-flash-down { animation: cu-flash-down 0.6s ease-out; }

.cu-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cu-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 0.15s;
}

.cu-action-btn:hover {
  background: var(--bg-secondary);
}

/* ===== PRICE INFO ROW ===== */
.cu-price-row {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cu-price-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cu-price-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cu-price-label {
  font-size: 12px;
  font-weight: 600;
  color: #77808D;
}

[data-theme="dark"] .cu-price-label { color: var(--text-muted); }

.cu-price-label-current {
  color: #FF9900;
}

.cu-price-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.cu-price-current-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cu-price-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
}

.cu-price-delta-down {
  color: #FF3B30;
}

.cu-price-delta-up {
  color: #30A159;
}

.cu-price-delta-icon {
  width: 12px;
  height: 12px;
}

.cu-current-price-animated {
  font-size: 22px;
  font-weight: 600;
  color: #FF9900;
  line-height: 1.2;
}

/* ===== COUNTDOWN ===== */
.cu-countdown-col {
  margin-left: auto;
  cursor: pointer;
}

.cu-countdown {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.cu-countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40px;
}

.cu-countdown-digits {
  display: flex;
  gap: 1px;
  height: 28px;
  overflow: hidden;
}

.cu-countdown-digit {
  width: 18px;
  height: 28px;
  position: relative;
  overflow: hidden;
}

.cu-countdown-digit-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cu-countdown-digit-char {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #FF3B30;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .cu-countdown-digit-char { color: #f85149; }

.cu-countdown-label {
  font-size: 10px;
  font-weight: 600;
  color: #77808D;
  text-transform: uppercase;
  margin-top: 4px;
  text-align: center;
}

[data-theme="dark"] .cu-countdown-label { color: var(--text-muted); }

.cu-countdown-expired {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.cu-countdown-expired > div:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cu-go-live-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #FF3B30;
  padding: 0;
  line-height: 1;
}
.cu-go-live-btn:hover { opacity: 0.75; }

.cu-go-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FF3B30;
  flex-shrink: 0;
  animation: cu-go-live-pulse 1.4s ease-in-out infinite;
}

@keyframes cu-go-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.8); }
}

/* ===== RESULT PANEL (replaces buy panel for resolved events) ===== */
.cu-result-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  animation: cu-result-panel-in 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

@keyframes cu-result-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cu-result-icon-wrap {
  width: 88px;
  height: 88px;
}

.cu-result-svg {
  width: 88px;
  height: 88px;
  overflow: visible;
}

/* Circle background fill */
.cu-result-circle-bg {
  fill: rgba(59, 130, 246, 0.1);
  transform-origin: 40px 40px;
  animation: cu-result-bg-in 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) 0.05s both;
}

@keyframes cu-result-bg-in {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Circle stroke ring */
.cu-result-circle-ring {
  stroke: #3b82f6;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 40px 40px;
  animation: cu-result-ring 0.55s ease-out 0.15s both;
}

@keyframes cu-result-ring {
  from { stroke-dashoffset: 214; }
  to   { stroke-dashoffset: 0; }
}

/* Checkmark */
.cu-result-check {
  stroke: #3b82f6;
  stroke-width: 3.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: cu-result-check 0.35s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both;
}

@keyframes cu-result-check {
  from { stroke-dashoffset: 60; }
  to   { stroke-dashoffset: 0; }
}

.cu-result-outcome {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  animation: cu-result-text-in 0.3s ease 0.75s both;
}

.cu-result-outcome-label {
  color: var(--text-muted);
  font-weight: 500;
}

.cu-result-outcome-value {
  font-size: 20px;
  font-weight: 700;
}

.cu-result-up   { color: #30A159; }
.cu-result-down { color: #3b82f6; }

.cu-result-title {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 260px;
  animation: cu-result-text-in 0.3s ease 0.85s both;
}

@keyframes cu-result-text-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== WINNER BANNER ===== */
.cu-winner-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}
.cu-winner-up {
  background: rgba(48, 161, 89, 0.12);
  color: #30A159;
  border: 1px solid rgba(48, 161, 89, 0.3);
}
.cu-winner-down {
  background: rgba(255, 59, 48, 0.1);
  color: #FF3B30;
  border: 1px solid rgba(255, 59, 48, 0.25);
}

/* ===== CHART AREA ===== */
.cu-chart-section {
  position: relative;
  margin-bottom: 12px;
}

.cu-chart-wrap {
  width: 100%;
  height: 288px;
  position: relative;
}

.cu-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ===== TIME WINDOW TABS ===== */
.cu-time-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.cu-time-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cu-time-tabs::-webkit-scrollbar { display: none; }

.cu-time-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  border: none;
  transition: background 0.15s;
}

.cu-time-tab:hover {
  background: var(--bg-secondary);
}

.cu-time-tab.active {
  background: #0E0F11;
  color: #fff;
}

[data-theme="dark"] .cu-time-tab.active {
  background: #fff;
  color: #000;
}

.cu-time-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FF3B30;
  margin-right: 6px;
  flex-shrink: 0;
}

[data-theme="dark"] .cu-time-tab-dot { background: #f85149; }

.cu-time-tab-past {
  background: #F4F5F6;
  gap: 6px;
  position: relative;
}

[data-theme="dark"] .cu-time-tab-past {
  background: var(--bg-secondary);
}

.cu-time-tab-past-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 100;
  display: none;
  padding: 4px;
}

.cu-time-tab-past-dropdown.open { display: block; }

.cu-time-tab-past-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
}

.cu-time-tab-past-item:hover {
  background: var(--bg-secondary);
}

.cu-past-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 4px;
}

.cu-chart-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cu-chart-toggle-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}

.cu-chart-toggle-btn.active {
  background: var(--bg-secondary);
  color: var(--text);
}

/* ===== ORDER BOOK ===== */
.cu-orderbook {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.cu-orderbook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.cu-orderbook-header:hover {
  background: var(--bg-secondary);
}

.cu-orderbook-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cu-orderbook-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.cu-orderbook-info-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.cu-orderbook-chevron {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.cu-orderbook.open .cu-orderbook-chevron {
  transform: rotate(180deg);
}

.cu-orderbook-content {
  display: none;
  padding: 0 16px 16px;
}

.cu-orderbook.open .cu-orderbook-content {
  display: block;
}

/* ===== RULES SECTION ===== */
.cu-rules {
  margin-bottom: 16px;
}

.cu-rules-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.cu-rules-tab {
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.cu-rules-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.cu-rules-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.cu-rules-content a {
  color: var(--blue);
}

.cu-rules-meta {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.cu-rules-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.cu-rules-meta-row:last-child { margin-bottom: 0; }

.cu-rules-meta-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* ===== BUY PANEL (uses shared .buy-panel from styles.css) ===== */
.cu-sidebar .buy-panel-wrapper {
  margin-bottom: 16px;
  position: static !important; /* override sticky so related markets show below */
}

/* ===== RELATED MARKETS ===== */
.cu-related {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.cu-related-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.cu-related-item:last-child { border-bottom: none; }
.cu-related-item:hover { opacity: 0.8; }

.cu-related-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.cu-related-icon img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.cu-related-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.cu-related-pct-wrap {
  text-align: right;
}

.cu-related-pct {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.cu-related-direction {
  font-size: 12px;
  color: #77808D;
}

[data-theme="dark"] .cu-related-direction { color: var(--text-muted); }

/* ===== COMMENTS SECTION (reused from main) ===== */
.cu-sections-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.cu-section-tab {
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.cu-section-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.cu-section-tab .cu-tab-count {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .cu-page {
    flex-direction: column;
  }
  .cu-sidebar {
    width: 100%;
    position: static;
  }
}

@media (max-width: 640px) {
  .cu-title { font-size: 20px; }
  .cu-price-row { gap: 16px; }
  .cu-price-value { font-size: 18px; }
  .cu-current-price-animated { font-size: 18px; }
  .cu-countdown-digit-char { font-size: 20px; }
  .cu-chart-wrap { height: 220px; }
}
