@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #4361ee;
  --primary-dark: #3a56d4;
  --secondary: #3f37c9;
  --accent: #f72585;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --success: #4cc9f0;
  --warning: #f4a261;
  --danger: #e76f51;
  --card-shadow: 0 10px 30px -15px rgba(2, 12, 27, 0.1);
  --transition: all 0.25s cubic-bezier(0.645, 0.045, 0.355, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #f8f9ff 0%, #eef1ff 100%);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

/* HEADER */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 2.5rem 1.5rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  position: relative;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 300;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

/* OFFLINE INDICATOR */
#offlineIndicator {
  display: none;
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
  animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* GRID */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2.5rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* CARD */
.card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px -15px rgba(2, 12, 27, 0.15);
}

.card h2 {
  margin: 0 0 1.5rem 0;
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* HIGHLIGHT CARD */
.highlight {
  border: none;
  background: linear-gradient(135deg, #fff 0%, #f8f9ff 100%);
  position: relative;
  z-index: 1;
}

.highlight::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.05) 0%, rgba(63, 55, 201, 0.1) 100%);
  z-index: -1;
  border-radius: 16px;
  border: 1px solid rgba(67, 97, 238, 0.1);
}

/* INPUTS & BUTTONS */
input {
  width: 100%;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  transition: var(--transition);
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 1rem;
  transition: var(--transition);
  box-shadow: 0 4px 6px rgba(67, 97, 238, 0.2);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary) 100%);
  opacity: 0;
  transition: var(--transition);
  z-index: -1;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(67, 97, 238, 0.25);
}

button:hover::after {
  opacity: 1;
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(67, 97, 238, 0.3);
}

/* QUOTE STYLING */
.quote-content {
  position: relative;
  padding: 1.5rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 255, 0.9) 100%);
  box-shadow: 0 8px 32px rgba(31, 60, 136, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: all 0.3s ease;
}

.quote-content:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(31, 60, 136, 0.15);
}

.quote-text {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--dark);
  margin-bottom: 1.5rem;
  position: relative;
  padding-left: 1.5rem;
  font-style: italic;
}

.quote-text::before {
  content: '"\201C"';
  position: absolute;
  left: -0.5rem;
  top: -1rem;
  font-size: 4rem;
  color: rgba(67, 97, 238, 0.1);
  font-family: Georgia, serif;
  line-height: 1;
}

.quote-author {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.dash {
  margin-right: 0.5rem;
  color: var(--accent);
  font-weight: bold;
}

.quote-source {
  text-align: right;
  margin-top: 0.5rem;
  opacity: 0.7;
  font-size: 0.85rem;
}

.new-quote-btn {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
}

.new-quote-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(67, 97, 238, 0.3);
}

.new-quote-btn:active {
  transform: translateY(0);
}

/* OUTPUT STYLING */
#pokemonOutput,
#quoteOutput,
#countryOutput {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Country Info Styling */
.country-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.country-header h3 {
  margin: 0;
  color: var(--primary);
  font-size: 1.75rem;
}

.country-flag {
  width: 100%;
  margin: 1rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.flag-image {
  max-width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: contain;
}

.country-details {
  margin-top: 1.5rem;
}

.detail-row {
  display: flex;
  margin-bottom: 0.8rem;
  line-height: 1.5;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-label {
  font-weight: 600;
  color: var(--primary);
  min-width: 120px;
  flex-shrink: 0;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .detail-row {
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
  }
  
  .detail-label {
    font-size: 0.9rem;
  }
  
  .country-header h3 {
    font-size: 1.5rem;
  }
  
  .flag-image {
    max-height: 100px;
  }
}

/* FOOTER */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.9rem;
  color: var(--gray);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  margin-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Cache Statistics */
.cache-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--gray);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-label {
  font-weight: 600;
  color: var(--primary);
}

.clear-cache-btn {
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, var(--danger) 0%, #c0392b 100%);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.clear-cache-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.clear-cache-btn:active {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .cache-stats {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }
  
  .stat-item {
    width: 100%;
    max-width: 280px;
    justify-content: space-between;
  }
}

/* LOADING ANIMATION */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  header p {
    font-size: 1rem;
  }
  
  .card {
    padding: 1.5rem;
  }
}

/* ANIMATIONS */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Add subtle animation to cards on load */
.card {
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 0;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
