/* Base styles */
:root {
  --primary-color: #2196F3;
  --success-color: #4CAF50;
  --danger-color: #ff6b6b;
  --background-color: #f5f7fa;
  --card-background: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #606f7b;
  --border-radius: 12px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --transition: all 0.3s ease;
}

/* Global styles */
body {
  background-color: var(--background-color);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header styles */
.header {
  background: linear-gradient(135deg, var(--primary-color), #64B5F6);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
}

.title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-top: 0.5rem;
}

/* Container */
.container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
}

/* Card styles */
.card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: var(--transition);
}

.input-card {
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.card h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin: 0 0 1.5rem 0;
}

/* Form styles */
.input-group {
  margin-bottom: 1.5rem;
}

/* Form styles continued */
.input-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.ticker-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.input-help {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.ticker-validation {
  width: 20px;
  height: 20px;
  margin-left: -30px;
  position: relative;
}

.ticker-validation.valid::after {
  content: '✓';
  color: var(--success-color);
  position: absolute;
  right: 0;
}

.ticker-validation.invalid::after {
  content: '×';
  color: var(--danger-color);
  position: absolute;
  right: 0;
}

/* Button styles */
.btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  min-height: 48px;
}

.btn:hover {
  background: #1976D2;
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Spinner styles */
.sk-chase {
  width: 24px;
  height: 24px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.sk-chase-dot {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  animation: sk-chase 2.0s infinite ease-in-out both;
}

.sk-chase-dot:before {
  content: '';
  display: block;
  width: 25%;
  height: 25%;
  background-color: #fff;
  border-radius: 100%;
  animation: sk-chase-dot 2.0s infinite ease-in-out both;
}

/* Error message styles */
.error-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  animation: slideDown 0.3s ease-out;
}

.error-content {
  background: #fff;
  border-left: 4px solid var(--danger-color);
  box-shadow: var(--shadow-lg);
  padding: 1rem 2rem;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.error-icon {
  font-size: 1.5rem;
}

.error-text {
  margin: 0;
  color: var(--text-primary);
}

.error-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0;
  margin-left: 1rem;
}

/* Results section styles */
.result-container {
  opacity: 0;
  transform: translateY(20px);
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.timestamp {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.prediction-banner {
  background: #f8f9fa;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.prediction-banner.rise {
  background: rgba(76, 175, 80, 0.1);
  border-left: 4px solid var(--success-color);
}

.prediction-banner.fall {
  background: rgba(255, 107, 107, 0.1);
  border-left: 4px solid var(--danger-color);
}

.chart-container {
  height: 300px;
  margin: 2rem 0;
}

/* Metrics grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.metric-card {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: var(--border-radius);
  text-align: center;
  position: relative;
}

.metric-card h3 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.metric-value.positive {
  color: var(--success-color);
}

.metric-value.negative {
  color: var(--danger-color);
}

.update-animation {
  animation: pulse 0.5s ease-out;
}

/* Footer styles */
.footer {
  background: #2c3e50;
  color: white;
  text-align: center;
  padding: 1rem;
  margin-top: auto;
}

.footer-link {
  color: #fff;
  text-decoration: none;
  margin: 0 0.5rem;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -100%);
  }
  to {
    transform: translate(-50%, 0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes sk-chase {
  100% { transform: rotate(360deg); } 
}

@keyframes sk-chase-dot {
  80%, 100% { transform: rotate(360deg); } 
}

/* Responsive styles */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .card {
    padding: 1.5rem;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .title {
    font-size: 1.5rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  .chart-container {
    height: 250px;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .error-content {
    padding: 0.75rem 1rem;
  }
  
  .prediction-banner {
    padding: 1rem;
  }
}