:root {
  --primary: #1e3a5f;
  --primary-light: #2c5282;
  --accent: #3182ce;
  --accent-gradient: linear-gradient(135deg, #3182ce 0%, #63b3ed 100%);
  --background: #fafbfc;
  --card-bg: #ffffff;
  --foreground: #1a202c;
  --muted: #edf2f7;
  --muted-foreground: #718096;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Navigation */
.header {
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  min-height: 70px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--primary);
  letter-spacing: -0.02em;
  transition: var(--transition);
}

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

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--foreground);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--accent);
  background: var(--muted);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 101;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--foreground);
  transition: var(--transition);
  border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Hero Section */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--muted-foreground);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Projects Grid */
.projects {
  padding-bottom: 4rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 2rem 0;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .projects-grid {
    gap: 2.5rem;
  }
}

/* Project Card */
.project-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

.project-image-container {
  aspect-ratio: 4/3;
  width: 100%;
  background-color: var(--muted);
  overflow: hidden;
  position: relative;
}

.project-image-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
  opacity: 0;
  transition: var(--transition);
}

.project-card:hover .project-image-container::after {
  opacity: 1;
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover .project-image {
  transform: scale(1.05);
}

.project-content {
  padding: 1.75rem;
}

.project-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--foreground);
  letter-spacing: -0.01em;
}

.project-description {
  color: var(--muted-foreground);
  font-size: 0.95rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.view-project-btn {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 0.875rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(49, 130, 206, 0.3);
}

.view-project-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(49, 130, 206, 0.4);
}

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

/* Project Details Page */
.project-details {
  background: var(--card-bg);
  padding: 2rem;
  margin-top: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

@media (min-width: 768px) {
  .project-details {
    padding: 2.5rem;
  }
}

.project-details .project-title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  margin-bottom: 1rem;
  color: var(--primary);
}

.project-details .project-description {
  font-size: 1.05rem;
  line-height: 1.8;
  white-space: pre-wrap;
  -webkit-line-clamp: unset;
  display: block;
}

/* Back Button */
.button-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(49, 130, 206, 0.3);
}

.button-ghost:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(49, 130, 206, 0.4);
}

.arrow-left {
  font-family: monospace;
  font-size: 1.1rem;
}

/* Tabs */
.tabs {
  margin-top: 2.5rem;
}

.tabs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--muted);
  padding: 0.5rem;
  border-radius: var(--radius);
}

.tab-button {
  flex: 1;
  min-width: 100px;
  padding: 0.875rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--muted-foreground);
  transition: var(--transition);
  white-space: nowrap;
}

.tab-button:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--foreground);
}

.tab-button.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* Image Container & Gallery */
.image-container {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--muted);
  box-shadow: var(--shadow-md);
}

.image-container img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  background: #000;
}

.image-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.nav-button {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.nav-button:active {
  transform: scale(0.95);
}

#image-counter,
#image-counter-after {
  color: white;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 80px;
  text-align: center;
}

/* Project Data Table */
.project-data {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
}

.project-data table {
  width: 100%;
  border-collapse: collapse;
}

.project-data th,
.project-data td {
  padding: 1rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.project-data tr:last-child th,
.project-data tr:last-child td {
  border-bottom: none;
}

.project-data th {
  background: var(--muted);
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.9rem;
  width: 40%;
}

.project-data td {
  font-size: 0.95rem;
  color: var(--muted-foreground);
}

.project-data tr:hover td {
  background: var(--muted);
}

/* Auth Modal */
.auth-modal {
  padding: 3rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, var(--muted) 0%, var(--background) 100%);
  border-radius: var(--radius);
}

.auth-content {
  max-width: 400px;
  margin: 0 auto;
}

.auth-content h3 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  color: var(--primary);
}

.auth-content input {
  width: 100%;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--card-bg);
}

.auth-content input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.auth-content button {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(49, 130, 206, 0.3);
  width: 100%;
}

.auth-content button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(49, 130, 206, 0.4);
}

.auth-error {
  color: #e53e3e;
  margin-top: 1rem;
  font-weight: 500;
}

/* Footer */
.footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  margin-top: auto;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .menu-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--card-bg);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    box-shadow: var(--shadow-lg);
    transition: right 0.3s ease;
    gap: 0.5rem;
  }

  .nav-links.active {
    right: 0;
  }

  .nav-link {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
  }

  .hero {
    padding: 3rem 0 2rem;
  }

  .hero h1 {
    margin-bottom: 1rem;
  }

  .projects-grid {
    gap: 1.5rem;
  }

  .project-content {
    padding: 1.25rem;
  }

  .project-title {
    font-size: 1.15rem;
  }

  .project-details {
    padding: 1.5rem;
    margin-top: 0;
  }

  .tabs-list {
    flex-direction: column;
  }

  .tab-button {
    width: 100%;
  }

  .project-data th,
  .project-data td {
    padding: 0.875rem 1rem;
    font-size: 0.85rem;
    display: block;
    width: 100%;
  }

  .project-data tr {
    display: block;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
  }

  .project-data tr:last-child {
    border-bottom: none;
  }

  .project-data th {
    background: transparent;
    border-bottom: none;
    padding-bottom: 0.25rem;
    color: var(--muted-foreground);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .project-data td {
    padding-top: 0;
    color: var(--foreground);
    font-weight: 500;
  }

  .nav-button {
    width: 44px;
    height: 44px;
  }

  .image-nav {
    padding: 1rem;
    gap: 0.75rem;
  }

  .button-ghost {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }

  .view-project-btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .nav-button {
    width: 52px;
    height: 52px;
  }

  .tab-button {
    padding: 1rem;
  }

  .view-project-btn,
  .button-ghost {
    min-height: 48px;
  }
}

/* Print styles */
@media print {
  .header,
  .footer,
  .button-ghost,
  .image-nav,
  .tabs-list {
    display: none !important;
  }

  .project-details {
    box-shadow: none;
    border: none;
  }
}
