/* --- 1. THE LOGICAL FRAMEWORK (Variables) --- */
:root {
  --primary-blue: #007bff;
  /* Logic & Precision */
  --bayern-red: #dc3545;
  --white: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --text-dark: #1a1a1b;
  --text-muted: #6c757d;
  --transition-smooth: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  --shadow-premium: 0 15px 35px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* --- 2. GLOBAL RESET & BASE --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
  background-attachment: fixed;
  color: var(--text-dark);
  overflow-x: hidden; /* Critical for mobile to prevent horizontal scroll */
  -webkit-font-smoothing: antialiased;
}

/* --- 3. DYNAMIC NAVIGATION (Glass Header) --- */
nav {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem; /* Reduced for better mobile fit */
  justify-content: center;
  flex-wrap: wrap; /* Allows menu to wrap on very small devices */
}

nav a {
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem; /* Slightly smaller for mobile-first */
  letter-spacing: 0.5px;
  position: relative;
  transition: var(--transition-smooth);
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--primary-blue);
  transition: var(--transition-smooth);
}

nav a:hover::after {
  width: 100%;
}

nav a:hover {
  color: var(--primary-blue);
}

/* --- 4. MAIN CONTENT & GRID SYMMETRY --- */
main {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1.2rem;
  animation: slideUp 0.8s ease-out;
}

/* --- 5. THE FLOATING CHAT WIDGET (Mobile-First Logic) --- */
#chat-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: var(--primary-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-premium);
  z-index: 2000;
  border: 3px solid white;
  transition: var(--transition-smooth);
}

#chat-launcher:hover {
  transform: scale(1.1) rotate(5deg);
  background: var(--bayern-red);
}

#chat-launcher i {
  color: white;
  font-size: 1.5rem;
}

#chat-container {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 350px; /* Base width */
  max-width: calc(100vw - 40px); /* Ensures it never overflows the screen */
  height: 500px;
  max-height: 70vh; /* Prevents it from taking over the whole screen height on mobile */
  background: white;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-premium);
  z-index: 1999;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

#chat-container.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-header {
  background: var(--primary-blue);
  color: white;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.chat-header h3 {
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  margin: 0;
}

.chat-header-link {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.7rem;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  transition: var(--transition-smooth);
}

.chat-header-link:hover {
  background: white;
  color: var(--primary-blue);
  border-color: white;
}

#chat-window {
  display: flex;
  flex-direction: column;
  /* Ensures bubbles stack vertically */
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
  background: #fcfcfc;
  gap: 8px;
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.9) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Optimized Chat Bubbles --- */
#chat-window .message {
  padding: 10px 16px;
  margin: 4px 0;
  max-width: 85%;
  /* Limits width so it doesn't span the whole window */
  display: inline-block;
  /* Allows the bubble to wrap tightly around text */
  word-wrap: break-word;
  border-radius: 18px;
  /* The "curved vertices" */
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  line-height: 1.4;
  transition: var(--transition-smooth);
  font-size: 0.95rem;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

#chat-window b {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  opacity: 0.8;
}

.user-msg {
  background: var(--primary-blue);
  color: white;
  align-self: flex-end;
  /* Pushes bubble to the right */
  border-bottom-right-radius: 4px !important;
  /* Creates a slight 'tail' effect */
  text-align: left;
}

.bot-msg {
  background: #ffffff;
  color: var(--text-dark);
  align-self: flex-start;
  /* Pushes bubble to the left */
  border-bottom-left-radius: 4px !important;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

#chat-form {
  padding: 15px;
  display: flex;
  gap: 10px;
  background: white;
  border-top: 1px solid #eee;
}

#user-input {
  flex-grow: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 25px;
  outline: none;
  transition: var(--transition-smooth);
}

#user-input:focus {
  border-color: var(--primary-blue);
}

#chat-send-btn {
  background: var(--primary-blue);
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

#chat-send-btn:hover {
  background: var(--bayern-red);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(220, 53, 69, 0.4);
}

/* --- 6. HERO SECTION (Dynamic Scaling) --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  background: radial-gradient(circle at top right, rgba(0, 123, 255, 0.05), transparent),
    radial-gradient(circle at bottom left, rgba(220, 53, 69, 0.05), transparent);
}

.hero-content h1 {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.hero-content h2 {
  font-size: clamp(2.2rem, 10vw, 4rem);
  font-weight: 900;
  margin: 10px 0;
  letter-spacing: -2px;
  line-height: 1.1;
}

.highlight {
  color: var(--primary-blue);
  position: relative;
  display: inline-block;
}

.typewriter-container {
  font-size: clamp(1.2rem, 4vw, 2.2rem);
  font-weight: 600;
  color: var(--text-dark);
  height: 3.5rem;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#typewriter {
  color: var(--primary-blue);
  border-right: 3px solid var(--primary-blue);
  padding-right: 8px;
  animation: blinkCursor 0.8s infinite;
}

.hero-content p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 650px;
  margin: 1.5rem auto 2.5rem;
  font-weight: 400;
}

/* --- 7. ACTION BUTTONS --- */
.hero-btns {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.btn {
  text-decoration: none;
  padding: 16px 40px;
  border-radius: 50px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
  display: inline-block;
}

.btn.primary {
  background: var(--primary-blue);
  color: white;
  box-shadow: 0 10px 25px rgba(0, 123, 255, 0.25);
  border: none;
}

.btn.primary:hover {
  background: var(--bayern-red);
  /* Bayern Red on hover for flare */
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(220, 53, 69, 0.35);
}

.btn.secondary {
  background: white;
  color: var(--text-dark);
  border: 2px solid #eee;
}

.btn.secondary:hover {
  background: #f8f9fa;
  transform: translateY(-5px);
  border-color: var(--text-dark);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

/* --- 8. ABOUT & SKILLS (Responsive Grids) --- */
.bio-container {
  padding: 1.5rem; /* Reduced for mobile */
  margin-bottom: 1.5rem;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.tagline {
  color: var(--primary-blue);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.separator {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, var(--primary-blue), transparent);
  margin: 1.5rem 0;
}

.extra-info-grid {
  display: grid;
  grid-template-columns: 1fr; /* Stack by default */
  gap: 1rem;
  margin-bottom: 2rem;
}

.info-card {
  background: white;
  padding: 1.5rem;
  border-radius: 15px;
  border: 1px solid rgba(0,0,0,0.05);
}

.info-card h3 {
  color: var(--primary-blue);
  margin-bottom: 10px;
}

.status-pill {
  display: inline-block;
  background: var(--primary-blue);
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin-top: 10px;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Adaptive tiles */
  gap: 0.8rem;
}

.skill-card {
  background: white;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
  transition: var(--transition-smooth);
}

.skill-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-premium);
}

.skill-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stars {
  color: #ffc107;
}

/* --- 8. ACADEMIC ROADMAP --- */
.roadmap-section {
  margin-top: 4rem;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.roadmap-card {
  background: white;
  padding: 1.5rem;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  transition: var(--transition-smooth);
}

.roadmap-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-premium);
}

.roadmap-card h3 {
  color: var(--primary-blue);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.roadmap-card ul {
  list-style: none;
}

.roadmap-card li {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 8px 0;
  border-bottom: 1px solid #f8f9fa;
  display: flex;
  justify-content: space-between;
}

.roadmap-card li:last-child {
  border-bottom: none;
}

.roadmap-card .unit-code {
  font-weight: 700;
  color: var(--text-dark);
}

.section-title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2.5rem;
}
.contact-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.contact-card {
  text-align: center;
  max-width: 600px;
  padding: 3rem;
  background: white;
  border-radius: 20px;
}

.contact-card h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-top: 3rem;
}

.social-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: white;
  border-radius: 15px;
  text-decoration: none;
  color: var(--text-dark);
  transition: var(--transition-smooth);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.social-tile i {
  font-size: 2.5rem;
  margin-bottom: 10px;
  transition: var(--transition-smooth);
}

.social-tile span {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.social-tile:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-premium);
  color: white;
}

.github:hover { background: #333; }
.instagram:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.facebook:hover { background: #1877f2; }
.email:hover { background: var(--primary-blue); }

.social-tile:hover i {
  transform: scale(1.2);
  color: white;
}

/* --- Hero Cat Image Mode --- */
.cat-wrapper.image-mode {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 1rem;
    justify-content: center;
}

.cat-hero-img {
    width: 120px;
    height: auto;
    border-radius: 20px;
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Speech Bubble Symmetry */
.cat-bubble {
    position: relative;
    padding: 15px 25px;
    border-radius: 20px 20px 20px 0;
    font-weight: 700;
    color: var(--primary-blue);
    font-size: 1.1rem;
}

/* --- 9. MEDIA QUERIES (The Fine-Tuning) --- */
@media (min-width: 768px) {
  nav a { font-size: 0.85rem; }
  nav ul { gap: 3rem; }
  
  main { margin: 4rem auto; padding: 0 2rem; }
  
  .extra-info-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
  
  .bio-container { padding: 3rem; }
  
  .skills-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
  
  #chat-launcher { width: 65px; height: 65px; bottom: 30px; right: 30px; }
  #chat-launcher i { font-size: 1.8rem; }
  
  #chat-container { width: 380px; height: 550px; bottom: 110px; right: 30px; }
  
  .contact-card { padding: 3rem; }
  .social-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}

@media (max-width: 480px) {
  .hero-content p { font-size: 1rem; }
  .btn { width: 100%; padding: 14px 20px; }
  
  .contact-card { padding: 1.5rem; }
  .contact-card h2 { font-size: 1.8rem; }
}

/* --- 10. ANIMATIONS --- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes blinkCursor {
  from, to { border-color: transparent }
  50% { border-color: var(--primary-blue) }
}

#typing {
  display: inline-block;
  color: var(--primary-blue);
  font-weight: 700;
  border-right: 2px solid var(--primary-blue);
  padding-right: 5px;
  animation: cursorBlink 0.8s infinite;
}

@keyframes cursorBlink {
  0%, 100% { border-color: transparent; }
  50% { border-color: var(--primary-blue); }
}

.typing {
  align-self: flex-start;
  background: #f1f3f5;
  color: var(--text-muted);
  padding: 12px 16px;
  border-radius: 15px;
  display: none;
  gap: 5px;
  align-items: center;
  margin-bottom: 10px;
  width: fit-content;
}

.typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  display: inline-block;
  animation: bounceDot 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing span:nth-child(2) {
  animation-delay: -0.16s;
}

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

footer {
  padding: 3rem;
  text-align: center;
  background: white;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid #eee;
}