/* ===================================
   1. RESET & BASE STYLES
   =================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  line-height: 1.6;
}

/* ===================================
   2. TYPOGRAPHY & TEXT ELEMENTS
   =================================== */
a {
  color: #FFD700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Roboto Mono', monospace;
}

/* ===================================
   3. LAYOUT CONTAINERS
   =================================== */
.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  gap: 30px;
}

/* Add entrance animations */
.main-content > * {
  animation: fadeInUp 0.6s ease-out backwards;
}

.main-content > *:nth-child(1) { animation-delay: 0.1s; }
.main-content > *:nth-child(2) { animation-delay: 0.2s; }
.main-content > *:nth-child(3) { animation-delay: 0.3s; }
.main-content > *:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section {
  margin-bottom: 50px;
}

/* ===================================
   4. LOGO STYLES
   =================================== */
.logo {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 32px;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.1em;
}

.logo .ay {
  position: relative;
}

.logo .y {
  position: relative;
  top: 8px;
  transform: scaleY(1.5);
  display: inline-block;
}

.logo .ai {
  color: #FFD700;
  font-style: italic;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===================================
   5. AVATAR COMPONENTS
   =================================== */
.avatar-container {
  width: 300px;
  height: 300px;
  border-radius: 15%;
  border: 8px solid white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.avatar-container:hover {
  transform: translateY(-2px);
  box-shadow:
      0 15px 40px rgba(0, 0, 0, 0.4),
      0 0 80px rgba(255, 255, 255, 0.2);
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: inherit;
  transition: opacity 0.3s ease;
}

.avatar-placeholder svg {
  width: 80px;
  height: 80px;
  opacity: 0.3;
  animation: pulse 2s ease-in-out infinite;
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  position: absolute;
  top: 0;
  left: 0;
}

.avatar-image.loaded {
  opacity: 1;
}

.avatar-name {
  font-size: 32px;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  transition: background-color 0.3s ease;
}

.avatar-name.skeleton {
  width: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  margin: 0 auto;
}

.avatar-name.skeleton::after {
  content: '';
}

/* ===================================
   6. BUTTONS & CONTROLS
   =================================== */
.generate-button {
  background: linear-gradient(45deg, #FF6B6B, #FF8E53);
  color: white;
  font-size: 24px;
  font-weight: bold;
  padding: 20px 60px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.generate-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
  background: linear-gradient(45deg, #FF8E53, #FF6B6B);
}

.generate-button:active {
  transform: translateY(-1px);
}

.generate-button:focus-visible,
.login-button:focus-visible,
.logout-button:focus-visible {
  outline: 2px solid #FFD700;
  outline-offset: 2px;
}

/* ===================================
   7. RADIUS CONTROLS
   =================================== */
.radius-controls {
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.2);
  padding: 15px;
  border-radius: 25px;
}

.radius-controls input[type="range"] {
  width: 200px;
  cursor: pointer;
}

.radius-controls input[type="range"]:hover {
  opacity: 0.8;
}

.radius-label {
  color: white;
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===================================
   8. AUTHENTICATION UI
   =================================== */
#auth-ui {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}

#user-display {
  color: white;
  font-size: 16px;
  font-weight: 500;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.login-button,
.logout-button {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.login-button {
  position: absolute;
  top: 20px;
  right: 20px;
}

.login-button:hover,
.logout-button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

.login-button:active,
.logout-button:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.2);
}

/* ===================================
   9. MODAL STYLES
   =================================== */
.auth-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.auth-modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  position: relative;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover,
.close:focus {
  color: #000;
}

/* ===================================
   10. ANIMATIONS
   =================================== */
.skeleton {
  animation: skeleton-loading 1s linear infinite alternate;
}

@keyframes skeleton-loading {
  0% {
    background-color: rgba(255, 255, 255, 0.1);
  }
  100% {
    background-color: rgba(255, 255, 255, 0.2);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* ===================================
   11. MEDIA QUERIES (MOBILE)
   =================================== */
@media (max-width: 768px) {
  /* Layout adjustments */
  body {
    padding: 15px;
  }

  /* Logo */
  .logo {
    font-size: 28px;
    top: 15px;
    left: 15px;
  }

  /* Avatar components */
  .avatar-container {
    width: 250px;
    height: 250px;
    border-width: 6px;
  }

  .avatar-placeholder svg {
    width: 60px;
    height: 60px;
  }

  .avatar-name {
    font-size: 24px;
    height: 29px;
  }

  .avatar-name.skeleton {
    height: 29px;
    width: 150px;
  }

  /* Buttons */
  .generate-button {
    font-size: 20px;
    padding: 15px 40px;
  }

  /* Authentication */
  #auth-ui,
  .login-button {
    top: 15px;
    right: 15px;
  }

  .login-button,
  .logout-button {
    font-size: 14px;
    padding: 6px 12px;
  }

  /* Controls */
  .radius-controls {
    padding: 12px;
    gap: 8px;
  }

  .radius-controls input[type="range"] {
    width: 150px;
  }

  .radius-label {
    font-size: 12px;
  }

  /* Modal */
  .auth-modal-content {
    margin: 20% auto;
    padding: 15px;
  }
}

/* ===================================
   12. API DOCUMENTATION STYLES
   (Used on other pages - DO NOT DELETE)
   =================================== */
.api-page-wrapper {
  display: flex;
  min-height: calc(100vh - 140px);
  max-width: 1400px;
  margin: 0 auto;
}

.api-sidebar {
  width: 260px;
  background: rgba(0, 0, 0, 0.2);
  padding: 30px 20px;
  position: sticky;
  top: 20px;
  height: fit-content;
  border-radius: 8px;
  margin-right: 40px;
}

.api-sidebar h3 {
  color: white;
  font-size: 20px;
  margin-bottom: 20px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.api-sidebar ul {
  list-style: none;
}

.api-sidebar li {
  margin-bottom: 10px;
}

.api-sidebar a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  display: block;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.2s;
}

.api-sidebar a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.api-sidebar a.active {
  background: rgba(255, 215, 0, 0.2);
  color: #FFD700;
  font-weight: 500;
}

.api-sidebar .section-header {
  margin-top: 20px;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-left: 12px;
}

.api-content {
  flex: 1;
  font-size: 18px;
  max-width: 900px;
  padding: 40px 20px;
  color: white;
}

.api-content h1 {
  font-size: 48px;
  margin-bottom: 30px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.api-content h2 {
  font-size: 28px;
  margin-top: 40px;
  margin-bottom: 20px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.api-content h3 {
  font-size: 20px;
  margin-top: 30px;
  margin-bottom: 15px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.1);
  padding: 15px 20px;
  border-radius: 8px;
}

.method {
  font-weight: bold;
  padding: 5px 15px;
  border-radius: 4px;
  font-size: 14px;
}

.method.post {
  background: #10B981;
  color: white;
}

.method.get {
  background: #3B82F6;
  color: white;
}

.endpoint-url {
  font-family: 'Roboto Mono', monospace;
  font-size: 18px;
  color: #FFD700;
}

.description {
  font-size: 20px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.note {
  background: rgba(255, 215, 0, 0.1);
  border-left: 4px solid #FFD700;
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 4px;
}

pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 15px 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
}

.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

th {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 15px;
  text-align: left;
  font-weight: bold;
}

td {
  padding: 12px 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* API page mobile styles */
@media (max-width: 768px) {
  .api-page-wrapper {
    flex-direction: column;
  }

  .api-sidebar {
    width: 100%;
    margin-right: 0;
    margin-bottom: 20px;
    position: static;
  }

  .api-content {
    padding: 20px 15px;
  }

  .api-content h1 {
    font-size: 36px;
  }

  .endpoint-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .endpoint-url {
    font-size: 14px;
    word-break: break-all;
  }

  pre {
    padding: 15px;
    font-size: 12px;
  }
}

/* ===================================
   13. UNUSED STYLES (Currently not used on homepage)
   =================================== */
/*
   These styles are not currently used on the homepage
   but may be used elsewhere or for future features:
*/

/* Loading spinner - replaced by skeleton loader */
.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top: 5px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
