/* ===================================
   CSS VARIABLES & DESIGN TOKENS
   =================================== */
:root {
  /* Colors */
  --bg-start: #FFF8E7;
  --bg-end: #FFE8CC;
  --brown: #8B7355;
  --title-brown: #5C4033;
  --accent: #FF9966;
  --text-color: #2C2416;

  /* Spacing */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Border Radius */
  --radius-sm: 16px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-full: 50px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(139, 115, 85, 0.15);
  --shadow-md: 0 4px 8px rgba(139, 115, 85, 0.2);
  --shadow-lg: 0 8px 16px rgba(139, 115, 85, 0.25);

  /* Transitions */
  --transition-fast: 180ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;

  /* Typography */
  --font-caveat: 'Caveat', cursive;
  --font-poppins: 'Poppins', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-poppins);
  color: var(--text-color);
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===================================
   LOADING SCREEN
   =================================== */
.loading-screen {
  position: fixed;
  inset: 0;
  background-color: var(--bg-start);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-screen .spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--brown);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--spacing-lg);
}

.loading-screen h1 {
  font-family: var(--font-caveat);
  font-size: 28px;
  color: var(--title-brown);
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
}

.loading-screen p {
  color: var(--brown);
  font-size: 14px;
}

/* ===================================
   MAIN APP CONTAINER
   =================================== */
.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  transition: opacity var(--transition-slow);
}

.app.loaded {
  opacity: 1 !important;
}

/* ===================================
   DECORATIONS
   =================================== */
.decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.deco {
  position: absolute;
  font-size: 32px;
  opacity: 0.12;
}

.deco-1 {
  top: 10%;
  left: 5%;
}

.deco-2 {
  top: 20%;
  right: 10%;
}

.deco-3 {
  bottom: 15%;
  left: 8%;
}

.deco-4 {
  bottom: 25%;
  right: 5%;
}

/* ===================================
   HEADER
   =================================== */
.header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
  position: relative;
  z-index: 1;
}

.avatar {
  margin: 0 auto var(--spacing-sm);
}

.avatar-circle {
  width: 120px;
  height: 120px;
  margin: 0 auto;
  background-color: #FFD9B3;
  border-radius: 50%;
  border: 4px solid var(--brown);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: var(--shadow-md);
}

.title {
  font-family: var(--font-caveat);
  font-size: clamp(32px, 5vw, 48px);
  color: var(--title-brown);
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
}

.subtitle {
  font-size: 16px;
  color: var(--brown);
  font-style: italic;
  font-weight: 300;
}

/* ===================================
   NAVIGATION
   =================================== */
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  justify-content: center;
  margin-bottom: var(--spacing-lg);
  position: relative;
  z-index: 1;
}

.nav-btn {
  padding: 10px 20px;
  background: white;
  border: 3px solid var(--brown);
  border-radius: var(--radius-full);
  font-family: var(--font-caveat);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 0 var(--brown);
  position: relative;
}

.nav-btn:hover {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.nav-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: none;
  transform: translate(2px, 2px);
}

/* ===================================
   SECTIONS
   =================================== */
.sections-container {
  position: relative;
  z-index: 1;
}

.section {
  display: none;
  animation: fadeSlideIn var(--transition-normal);
}

.section.active {
  display: block;
}

.section-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 3px solid var(--brown);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  margin: 0 var(--spacing-md) var(--spacing-xl);
}

.section-title {
  font-family: var(--font-caveat);
  font-size: 28px;
  color: var(--title-brown);
  font-weight: 700;
  margin-bottom: var(--spacing-md);
}

.section-content p {
  line-height: 1.8;
  font-size: 16px;
  color: rgba(0, 0, 0, 0.9);
  margin-bottom: var(--spacing-md);
}

.section-content p:last-child {
  margin-bottom: 0;
}

/* ===================================
   SKILLS GRID
   =================================== */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.skill-chip {
  padding: 12px 16px;
  background: #FFE8CC;
  border: 2px solid var(--brown);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.skill-chip:hover {
  background: rgba(255, 153, 102, 0.2);
  border-color: var(--accent);
}

/* ===================================
   PROJECTS
   =================================== */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.project-card {
  padding: 18px;
  background: linear-gradient(135deg, white, #FFE8CC);
  border: 3px solid var(--brown);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.project-card h3 {
  font-family: var(--font-caveat);
  font-size: 22px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
}

.project-card p {
  font-size: 14px;
  color: var(--title-brown);
  line-height: 1.5;
  margin-bottom: var(--spacing-sm);
}

.project-btn {
  padding: 8px 16px;
  background: var(--accent);
  border: none;
  border-radius: 24px;
  font-family: var(--font-caveat);
  font-size: 16px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255, 153, 102, 0.3);
  transition: transform var(--transition-fast);
  float: right;
}

.project-btn:hover {
  transform: translateY(-2px);
}

/* ===================================
   CONTACT FORM
   =================================== */
.contact-intro {
  text-align: center;
  color: var(--title-brown);
  font-size: 15px;
  margin-bottom: var(--spacing-md) !important;
}

.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: var(--spacing-sm);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-start);
  border: 2.5px solid var(--brown);
  border-radius: 18px;
  font-family: var(--font-poppins);
  font-size: 14px;
  color: var(--text-color);
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(255, 153, 102, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  font-family: var(--font-caveat);
  color: rgba(92, 64, 51, 0.6);
  font-size: 16px;
}

.submit-btn {
  width: 100%;
  padding: 14px 32px;
  background: var(--accent);
  border: 3px solid var(--brown);
  border-radius: var(--radius-full);
  font-family: var(--font-caveat);
  font-size: 20px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(139, 115, 85, 0.3);
  transition: all var(--transition-fast);
  margin-top: var(--spacing-md);
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(139, 115, 85, 0.3);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(139, 115, 85, 0.3);
}

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

/* ===================================
   BROWSE PROJECTS GRID
   =================================== */
.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-md);
}

.browse-card {
  background: linear-gradient(135deg, white, #FFE8CC);
  border: 3px solid var(--brown);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 250ms ease;
  box-shadow: var(--shadow-sm);
}

.browse-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.browse-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-start);
}

.browse-card-content {
  padding: 14px;
}

.browse-card h3 {
  font-family: var(--font-caveat);
  font-size: 20px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
}

.browse-card p {
  font-size: 13px;
  color: var(--title-brown);
  line-height: 1.3;
  margin-bottom: var(--spacing-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.browse-card-btn {
  padding: 6px 14px;
  background: var(--accent);
  border: none;
  border-radius: 20px;
  font-family: var(--font-caveat);
  font-size: 15px;
  font-weight: 600;
  color: white;
  float: right;
}

/* ===================================
   FLOATING ACTION BUTTONS
   =================================== */
.fab-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: var(--spacing-sm);
  z-index: 100;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition-fast);
}

.fab:hover {
  transform: scale(1.1);
}

.fab-whatsapp {
  background: #25D366;
  color: white;
}

.fab-ai {
  background: var(--accent);
  color: white;
  animation: pulseFab 2s ease-in-out infinite;
}

.ai-cta-bubble {
  animation: float 3s ease-in-out infinite, fadeIn 0.5s ease;
}

/* ===================================
   AI PANEL
   =================================== */
.ai-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  left: 20px;
  max-width: 500px;
  max-height: 450px;
  margin-left: auto;
  background: white;
  border: 3px solid var(--brown);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  z-index: 101;
  animation: slideUp var(--transition-normal);
}

.ai-panel.active {
  display: flex;
}

.ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px;
  border-bottom: 2px solid var(--brown);
}

.ai-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-family: var(--font-caveat);
  font-size: 20px;
  color: var(--title-brown);
  font-weight: 600;
}

.ai-title svg {
  stroke: var(--accent);
}

.ai-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 28px;
  color: var(--brown);
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.ai-close:hover {
  color: var(--accent);
}

.ai-messages {
  flex: 1;
  padding: var(--spacing-md);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.ai-message {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 75%;
  font-size: 14px;
  line-height: 1.4;
}

.ai-message.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border: 1.5px solid rgba(255, 153, 102, 0.5);
}

.ai-message.bot {
  align-self: flex-start;
  background: #FFE8CC;
  color: var(--text-color);
  border: 1.5px solid var(--brown);
}

.ai-input-container {
  display: flex;
  gap: var(--spacing-xs);
  padding: var(--spacing-md);
  border-top: 2px solid var(--brown);
}

.ai-input-container input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--brown);
  border-radius: 24px;
  font-family: var(--font-poppins);
  font-size: 14px;
  color: var(--text-color);
}

.ai-input-container input:focus {
  outline: none;
  border-color: var(--accent);
}

.ai-input-container button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.ai-input-container button:hover {
  transform: scale(1.1);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
  .title {
    font-size: 32px;
  }

  .section-card {
    margin: 0 0 var(--spacing-lg);
  }

  .browse-grid {
    grid-template-columns: 1fr;
  }

  .fab-container {
    bottom: 15px;
    right: 15px;
  }

  .ai-panel {
    left: 15px;
    right: 15px;
    bottom: 80px;
  }

  .perf-badge {
    top: 10px;
    left: 10px;
    font-size: 10px;
  }

  .modal-content {
    max-width: 95%;
    max-height: 85%;
    padding: 16px;
  }
}

/* ===================================
   PROJECT MODAL
   =================================== */
.project-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.project-modal.active {
  display: flex;
}

.modal-content {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border: 3px solid var(--brown);
  border-radius: 24px;
  max-width: 800px;
  max-height: 80vh;
  padding: 32px;
  position: relative;
  animation: slideUp 0.3s ease;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  transform: rotate(90deg) scale(1.1);
  background: var(--title-brown);
}

/* ===================================
   PERFORMANCE BADGE
   =================================== */
.perf-badge {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.9);
  color: #0f0;
  padding: 8px 12px;
  border-radius: 12px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  z-index: 1000;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #0f0;
  min-width: 80px;
  max-width: 280px;
}

.perf-badge:hover {
  background: rgba(0, 0, 0, 0.95);
  box-shadow: 0 4px 12px rgba(0, 255, 0, 0.3);
}

.perf-header {
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #0f0;
  color: #0ff;
}

.perf-section {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 255, 0, 0.2);
}

.perf-section:last-of-type {
  border-bottom: none;
  margin-bottom: 8px;
}

.perf-section-title {
  font-size: 11px;
  color: #ff0;
  font-weight: bold;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.perf-metric {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
  gap: 12px;
  font-size: 11px;
}

.perf-label {
  opacity: 0.7;
  color: #0f0;
}

.perf-value {
  font-weight: bold;
  color: #0ff;
}

.perf-toggle {
  margin-top: 8px;
  width: 100%;
  padding: 8px;
  background: #0f0;
  color: #000;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  transition: all 0.2s ease;
}

.perf-toggle:hover {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Performance mode disables animations */
body.performance-mode * {
  animation: none !important;
  transition: none !important;
}

/* ===================================
   HONORS SECTION
   =================================== */
.honors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-md);
}

.honor-card {
  background: linear-gradient(135deg, white, #FFF8E7);
  border: 3px solid var(--brown);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.honor-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.honor-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.honor-card h3 {
  font-family: var(--font-caveat);
  font-size: 22px;
  color: var(--title-brown);
  margin-bottom: 4px;
  line-height: 1.2;
}

.honor-card p {
  font-size: 15px;
  color: var(--brown);
  margin-bottom: 8px;
  flex-grow: 1;
}

.honor-link {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  transition: gap 0.2s ease;
}

.honor-link:hover {
  gap: 8px;
  text-decoration: underline;
}

/* ===================================
   ENHANCED MICRO-INTERACTIONS
   =================================== */
.nav-btn,
.project-btn,
.submit-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.nav-btn:hover:not(.active),
.project-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(139, 115, 85, 0.3);
}

.nav-btn:active,
.project-btn:active {
  transform: translateY(0);
}

.project-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(139, 115, 85, 0.25);
}

.skill-chip {
  transition: all 0.3s ease;
}

.skill-chip:hover {
  transform: translateY(-2px);
}