* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Sarabun", "Segoe UI", Tahoma, sans-serif;
  margin: 0;
  background: #f5f7fa;
  color: #2c3e50;
  line-height: 1.6;
}

/* ===== NAVBAR ===== */
nav {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  min-height: 80px;
  display: flex;
  align-items: center;
  padding: 0 40px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 1000;
}

nav img {
  height: 50px;
  object-fit: contain;
}

nav a {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
  color: #2c3e50;
  transition: color 0.25s ease;
}

nav a:hover, nav a:focus {
  color: #0066cc;
  outline: none;
}

nav .flex-nav {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}

.auth-menu {
  display: flex;
  gap: 12px;
  align-items: center;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #f0f4f8;
  border-radius: 20px;
}

.auth-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0066cc;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.btn-logout {
  background: #ef4444;
  color: white;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.25s ease;
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
}

.btn-logout:hover {
  background: #dc2626;
}

.btn-login {
  background: #0066cc;
  color: white;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
  transition: all 0.25s ease;
}

.btn-login:hover {
  background: #0052a3;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), 
              url('https://images.unsplash.com/photo-1581578731548-c64695cc6952') center/cover;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  position: relative;
}

.hero div {
  position: relative;
  z-index: 2;
  padding: 0 20px;
}

.hero h1 {
  font-size: 42px;
  margin: 0 0 20px 0;
  font-weight: 700;
}

.hero p {
  font-size: 18px;
  margin: 0 0 20px 0;
  font-weight: 400;
  opacity: 0.95;
}

.btn-primary {
  background: #0066cc;
  border: none;
  padding: 13px 32px;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: 'Sarabun', sans-serif;
}

.btn-primary:hover {
  background: #0052a3;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 102, 204, 0.3);
}

/* ===== SERVICES ===== */
.services {
  padding: 80px 30px;
  max-width: 1200px;
  margin: auto;
  text-align: center;
}

.services h2 {
  font-size: 36px;
  margin: 0 0 15px 0;
  font-weight: 700;
  color: #2c3e50;
}

.services > p {
  font-size: 16px;
  color: #666;
  margin-bottom: 50px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 28px;
  margin-top: 40px;
}

.card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid #e8ecf1;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  border-color: #0066cc;
}

.card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 16px;
}

.card h3 {
  margin: 14px 0 8px 0;
  font-size: 22px;
  color: #2c3e50;
  font-weight: 700;
}

.card p {
  font-size: 15px;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

/* ===== PORTFOLIO SECTION ===== */
.portfolio {
  padding: 80px 30px;
  max-width: 1200px;
  margin: auto;
  text-align: center;
}

.portfolio h2 {
  font-size: 36px;
  margin: 0 0 15px 0;
  font-weight: 700;
  color: #2c3e50;
}

.portfolio > p {
  font-size: 16px;
  color: #666;
  margin-bottom: 50px;
}

.portfolio-grid {
  display: flex;
  overflow-x: auto;
  gap: 28px;
  margin-top: 40px;
  padding-bottom: 24px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #0066cc #f1f1f1;
}

.portfolio-grid::-webkit-scrollbar {
  height: 8px;
}

.portfolio-grid::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 8px;
}

.portfolio-grid::-webkit-scrollbar-thumb {
  background: #0066cc;
  border-radius: 8px;
}

.portfolio-card {
  flex: 0 0 300px;
  scroll-snap-align: start;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 1px solid #e8ecf1;
  cursor: pointer;
}

.portfolio-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  border-color: #0066cc;
}

.portfolio-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: #e8ecf1;
}

.portfolio-info {
  padding: 20px;
}

.portfolio-info h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #2c3e50;
  font-weight: 700;
}

.portfolio-info p {
  font-size: 14px;
  color: #666;
  margin: 0;
}

/* Loading State */
.loading-skeleton {
  background: linear-gradient(90deg, #e8ecf1 25%, #f5f7fa 50%, #e8ecf1 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.portfolio-card.skeleton {
  cursor: wait;
}

/* Error Message */
.error-message {
  background: #fee;
  color: #c00;
  padding: 15px;
  border-radius: 8px;
  margin: 20px;
  text-align: center;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.empty-state p {
  font-size: 18px;
  margin: 10px 0;
}

/* ===== FEATURES ===== */
.features {
  background: linear-gradient(135deg, #0066cc, #0052a3);
  color: white;
  padding: 80px 30px;
  text-align: center;
}

.features h2 {
  font-size: 36px;
  margin: 0 0 15px 0;
  font-weight: 700;
}

.features > p {
  font-size: 16px;
  opacity: 0.95;
  margin-bottom: 50px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
  margin-top: 40px;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.feature-grid div {
  background: rgba(255, 255, 255, 0.1);
  padding: 28px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.feature-grid div h3 {
  font-size: 20px;
  margin: 12px 0 12px 0;
  font-weight: 700;
}

.feature-grid div p {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.6;
  margin: 0;
}

/* ===== FLOATING BUTTONS ===== */
.line-float, .call-float {
  position: fixed;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  color: white;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  animation: floatBtn 2s infinite;
  transition: all 0.3s ease;
  border: none;
}

.line-float {
  bottom: 90px;
  right: 20px;
  background: #06C755;
}

.call-float {
  bottom: 20px;
  right: 20px;
  background: #e53935;
  animation-delay: 0.3s;
}

.line-float:hover, .call-float:hover {
  transform: scale(1.15);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

@keyframes floatBtn {
  0% { transform: translateY(0); }
  25% { transform: translateY(-8px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

/* ===== FOOTER ===== */
footer {
  background: #1f2937;
  color: #9ca3af;
  text-align: center;
  padding: 40px 30px;
  margin-top: 60px;
  font-size: 14px;
  border-top: 1px solid #374151;
}

footer a {
  color: #0066cc;
  text-decoration: none;
  transition: color 0.25s ease;
}

footer a:hover {
  color: #0052a3;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
  }

  nav .flex-nav {
    width: 100%;
    margin-left: 0;
    gap: 12px;
    margin-top: 8px;
  }

  .hero {
    height: 340px;
    padding: 0 20px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .services, .portfolio, .features {
    padding: 50px 20px;
  }

  .portfolio-card {
    flex: 0 0 260px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 26px;
  }

  .portfolio-card {
    flex: 0 0 220px;
  }
}