/* ============================================================
   PORTFOLIO.CSS - Shared Styles
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2236;
  --border: #2a3550;
  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #06b6d4;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --gradient-hero: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 100px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-3);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-2);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

/* --- Utility --- */
.section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.gradient-text {
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-hero);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent-1);
  color: var(--accent-1);
  transform: translateY(-2px);
}

.btn-large {
  padding: 16px 36px;
  font-size: 1.05rem;
}

/* --- Navigation --- */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: background 0.3s, box-shadow 0.3s;
}

#main-nav.scrolled {
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo:hover {
  color: var(--text-primary);
}

.nav-logo .accent {
  color: var(--accent-1);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-1);
  border-radius: 1px;
}

.nav-social {
  display: flex;
  gap: 1rem;
  margin-left: 1rem;
}

.nav-social a {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: color 0.2s;
}

.nav-social a:hover {
  color: var(--accent-3);
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}

/* Mobile nav */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(10, 14, 26, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.5rem 2rem;
    gap: 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-links li {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  #main-nav.nav-open .nav-links {
    display: flex;
  }

  .nav-hamburger {
    display: block;
  }

  .nav-social {
    display: none;
  }
}

/* --- Footer --- */
#contact-footer {
  text-align: center;
  padding: 6rem 2rem 3rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.footer-container {
  max-width: 600px;
  margin: 0 auto;
}

#contact-footer h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  margin-bottom: 1rem;
}

#contact-footer .footer-desc {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.footer-social a {
  color: var(--text-muted);
  font-size: 1.3rem;
  transition: var(--transition);
}

.footer-social a:hover {
  color: var(--accent-3);
  transform: translateY(-2px);
}

.footer-copy {
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Section Headers --- */
.section-label {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent-1);
  margin-bottom: 0.75rem;
}

.section-header {
  margin-bottom: 3rem;
}

.section-header h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

/* --- Chatbot --- */
#chat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: white;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

#chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.6);
}

#chat-container {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 370px;
  max-height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: opacity 0.25s, transform 0.25s;
}

#chat-container.chat-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
}

#chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  flex-shrink: 0;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
}

.chat-header-text {
  flex: 1;
}

.chat-name {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.chat-status {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.75rem;
}

#chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.8;
  line-height: 1;
  padding: 4px;
  flex-shrink: 0;
}

#chat-close:hover {
  opacity: 1;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
  max-height: 340px;
}

.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.bot-message {
  background: #242d42;
  color: #cbd5e1;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.bot-message a {
  color: var(--accent-3);
  text-decoration: underline;
}

.user-message {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

#chat-input-row {
  display: flex;
  padding: 12px;
  gap: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: #242d42;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

#chat-input:focus {
  border-color: var(--accent-1);
}

#chat-input::placeholder {
  color: var(--text-muted);
}

#chat-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-1);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

#chat-send:hover {
  background: var(--accent-2);
}

@media (max-width: 480px) {
  #chat-container {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 88px;
    max-height: 70vh;
  }

  #chat-toggle {
    bottom: 20px;
    right: 20px;
  }
}

/* --- Scrollbar --- */
#chat-messages::-webkit-scrollbar {
  width: 4px;
}

#chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
