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

:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #121214;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --accent-primary: #00d4ff;
  --accent-secondary: #7c3aed;
  --accent-tertiary: #f59e0b;
  --mood-color: #00ffd5;
  --success-color: #10b981;
  --error-color: #ef4444;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-mood: linear-gradient(135deg, #ff9a8b 0%, #a8edea 100%);
  --gradient-tweet: linear-gradient(135deg, #1da1f2 0%, #0d8bd9 100%);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100vh;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated Background */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.bg-animation::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 25% 75%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 75% 25%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
  animation: float 25s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(25px, -35px) rotate(120deg); }
  66% { transform: translate(-30px, 25px) rotate(240deg); }
}

/* Grid Background */
.grid-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: 0.3;
}

.grid-static {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 255, 213, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 213, 0.1) 1px, transparent 1px);
  background-size: 45px 45px;
  animation: gridPulse 5s ease-in-out infinite;
}

.grid-moving {
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background-image: 
    linear-gradient(rgba(124, 58, 237, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.12) 1px, transparent 1px);
  background-size: 70px 70px;
  animation: gridMove 30s linear infinite;
}

.grid-diagonal {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image: 
    linear-gradient(45deg, rgba(245, 158, 11, 0.06) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(245, 158, 11, 0.06) 1px, transparent 1px);
  background-size: 55px 55px;
  animation: gridDiagonal 35s linear infinite;
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-70px, -70px); }
}

@keyframes gridDiagonal {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-55px, -55px) rotate(360deg); }
}

/* Floating Drink Elements */
.floating-elements {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.drink-bubble {
  position: absolute;
  font-size: 2rem;
  opacity: 0.4;
  animation: drinkFloat 20s ease-in-out infinite;
}

.bubble-1 {
  top: 20%;
  left: 15%;
  animation-delay: 0s;
}

.bubble-2 {
  top: 60%;
  left: 80%;
  animation-delay: -7s;
}

.bubble-3 {
  top: 80%;
  left: 20%;
  animation-delay: -14s;
}

.bubble-4 {
  top: 40%;
  left: 70%;
  animation-delay: -3s;
}

@keyframes drinkFloat {
  0%, 100% { 
    transform: translate(0, 0) rotate(0deg) scale(1); 
  }
  25% { 
    transform: translate(50px, -30px) rotate(90deg) scale(1.1); 
  }
  50% { 
    transform: translate(100px, 20px) rotate(180deg) scale(0.9); 
  }
  75% { 
    transform: translate(30px, 40px) rotate(270deg) scale(1.05); 
  }
}

/* Floating Particles */
.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--mood-color);
  border-radius: 50%;
  opacity: 0.4;
  animation: floatUp 8s linear infinite;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.4;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInUp 0.8s ease;
}

.header h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--mood-color), var(--accent-secondary), var(--accent-tertiary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  animation: scaleIn 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.header .subtitle {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--text-secondary);
  font-weight: 400;
  animation: fadeInUp 0.8s ease 0.2s both;
}

@keyframes scaleIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

/* Main Content */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  flex: 1;
  align-items: start;
}

@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Upload Section */
.upload-section {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2.5rem;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: fadeInUp 0.6s ease 0.3s both;
  position: relative;
  overflow: hidden;
}

.upload-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-mood);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 24px;
}

.upload-section:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 255, 213, 0.2);
}

.upload-section:hover::before {
  opacity: 0.05;
}

.upload-section h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  position: relative;
  z-index: 2;
}

.upload-section p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  position: relative;
  z-index: 2;
}

/* File Upload */
.file-upload {
  position: relative;
  display: inline-block;
  margin-bottom: 2rem;
  z-index: 2;
}

.file-upload input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 300px;
  height: 180px;
  border: 2px dashed var(--card-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.file-upload-label:hover {
  border-color: var(--mood-color);
  background: rgba(0, 255, 213, 0.05);
  transform: scale(1.02);
}

.file-upload-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  transition: transform 0.3s ease;
}

.file-upload-label:hover .file-upload-icon {
  transform: scale(1.1) rotate(5deg);
}

.file-upload-text {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 2;
}

.mood-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-height: 50px;
}

.mood-button.primary {
  background: linear-gradient(135deg, var(--mood-color), var(--accent-primary));
  color: var(--bg-primary);
}

.mood-button.secondary {
  background: linear-gradient(135deg, var(--accent-secondary), #8b5cf6);
  color: white;
}

.mood-button.tertiary {
  background: var(--gradient-tweet);
  color: white;
}

.mood-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.mood-button:active {
  transform: translateY(0);
}

.mood-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.button-icon {
  font-size: 1.2rem;
}

/* Loading Animation */
.loading {
  display: none;
  margin-top: 1rem;
}

.loading-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mood-color);
  animation: bounce 1.4s ease-in-out infinite both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Results Section */
.results-section {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2.5rem;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: fadeInUp 0.6s ease 0.4s both;
  position: relative;
  overflow: hidden;
}

.results-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-3);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 24px;
}

.results-section:hover {
  transform: translateY(-5px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.results-section:hover::before {
  opacity: 0.05;
}

.results-section h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  position: relative;
  z-index: 2;
}

/* Image Preview */
.image-preview {
  width: 100%;
  max-width: 350px;
  height: 250px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.preview-placeholder {
  color: var(--text-secondary);
  text-align: center;
  font-size: 1.1rem;
}

/* Mood Display */
.mood-display {
  text-align: center;
  position: relative;
  z-index: 2;
}

.emoji-container {
  margin-bottom: 1.5rem;
}

.emoji {
  font-size: 4rem;
  display: inline-block;
  transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  animation: emojiPulse 2s ease-in-out infinite;
}

.emoji:hover {
  transform: scale(1.2) rotate(10deg);
}

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

.mood-info {
  margin-bottom: 2rem;
}

.mood-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--mood-color);
  margin-bottom: 0.5rem;
  transition: all 0.5s ease;
}

.mood-message {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-style: italic;
  transition: all 0.5s ease;
}

/* Tweet Box */
.tweet-box {
  background: rgba(29, 161, 242, 0.1);
  border: 1px solid rgba(29, 161, 242, 0.3);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 2rem;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.tweet-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
  color: #1da1f2;
}

.twitter-icon {
  font-size: 1.2rem;
}

.tweet-content {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #89caff;
  margin-bottom: 1rem;
  font-style: italic;
}

.tweet-button {
  background: var(--gradient-tweet);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.tweet-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(29, 161, 242, 0.3);
}

/* Back Button */
.back-button {
  position: fixed;
  top: 2rem;
  left: 2rem;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  z-index: 100;
}

.back-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

/* Status Messages */
.status-message {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 12px;
  font-weight: 500;
  position: relative;
  z-index: 2;
}

.status-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error-color);
}

.status-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success-color);
}

/* Dynamic Background Colors */
body.mood-active {
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .upload-section,
  .results-section {
    padding: 2rem;
  }
  
  .file-upload-label {
    width: 100%;
    max-width: 280px;
  }
  
  .action-buttons {
    gap: 0.8rem;
  }
  
  .mood-button {
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
  }
  
  .back-button {
    top: 1rem;
    left: 1rem;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
  
  .emoji {
    font-size: 3rem;
  }
}