/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #fff;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #f39c12, #e74c3c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: #888;
  margin-bottom: 30px;
}

/* Search box */
.search-box {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 15px;
}

#ticker-input {
  padding: 12px 20px;
  font-size: 1.1rem;
  border: 2px solid #333;
  border-radius: 8px;
  background: #222;
  color: #fff;
  width: 200px;
  text-transform: uppercase;
}

#ticker-input:focus {
  outline: none;
  border-color: #f39c12;
}

#search-btn {
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #f39c12, #e74c3c);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

/* Ticker chips */
.available-tickers {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
  color: #666;
  font-size: 0.9rem;
}

.ticker-chip {
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #444;
  border-radius: 20px;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.ticker-chip:hover {
  border-color: #f39c12;
  color: #f39c12;
}

/* Card container and flip effect */
.card-container {
  perspective: 1000px;
  margin: 30px auto;
}

.card-container.hidden {
  display: none;
}

.card {
  width: 320px;
  height: 460px;
  margin: 0 auto;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}

.card.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  overflow: hidden;
}

.card-front {
  background: linear-gradient(145deg, #2c2c54 0%, #1a1a2e 100%);
}

.card-back {
  background: linear-gradient(145deg, #1a1a2e 0%, #2c2c54 100%);
  transform: rotateY(180deg);
}

.card-border {
  height: 100%;
  padding: 15px;
  border: 3px solid;
  border-image: linear-gradient(145deg, #f39c12, #e74c3c) 1;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
}

/* Front of card */
.card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 10px;
}

.card-year {
  font-weight: 700;
  color: #f39c12;
}

.card-series {
  letter-spacing: 2px;
}

.logo-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 4px solid rgba(255, 255, 255, 0.1);
}

.company-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticker-badge {
  display: inline-block;
  padding: 4px 16px;
  background: linear-gradient(90deg, #f39c12, #e74c3c);
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 700;
  margin: 0 auto 15px;
}

.price-section {
  margin-bottom: 15px;
}

.current-price {
  font-size: 2rem;
  font-weight: 700;
}

.price-change {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 5px;
}

.price-change.positive {
  color: #2ecc71;
}

.price-change.negative {
  color: #e74c3c;
}

.card-footer {
  margin-top: auto;
}

.sector {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Back of card */
.back-header {
  text-align: left;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #333;
}

.back-ticker {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f39c12;
}

.back-name {
  display: block;
  font-size: 0.9rem;
  color: #888;
  margin-top: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  text-align: left;
}

.stat-label {
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
}

.rookie-section {
  background: linear-gradient(90deg, rgba(243, 156, 18, 0.2), rgba(231, 76, 60, 0.2));
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
}

.rookie-label {
  font-size: 0.75rem;
  color: #f39c12;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.rookie-year {
  font-size: 1.8rem;
  font-weight: 700;
}

.limerick-section {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  border-radius: 8px;
  text-align: left;
}

.limerick-label {
  font-size: 0.7rem;
  color: #f39c12;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.limerick-text {
  font-size: 0.75rem;
  color: #ccc;
  font-style: italic;
  line-height: 1.4;
  white-space: pre-line;
}

.limerick-text.loading {
  color: #666;
}

.limerick-text.error {
  color: #e74c3c;
}

/* Hints and errors */
.hint {
  color: #666;
  font-size: 0.9rem;
  margin-top: 15px;
}

.hint.hidden {
  display: none;
}

.error {
  color: #e74c3c;
  font-size: 0.9rem;
  margin-top: 15px;
}

.error.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 400px) {
  .card {
    width: 290px;
    height: 420px;
  }

  h1 {
    font-size: 2rem;
  }

  .logo {
    width: 100px;
    height: 100px;
    font-size: 2rem;
  }

  .company-name {
    font-size: 1.2rem;
  }

  .current-price {
    font-size: 1.6rem;
  }
}
