:root {
  --primary-color: #1a73e8;
  --primary-light: #64b5f6;
  --primary-dark: #1976d2;
  --secondary-color: #4285f4;
  --accent-purple: #9c27b0;
  --accent-pink: #e91e63;
  --accent-orange: #ff5722;
  --accent-yellow: #ffc107;
  --accent-green: #4caf50;
  --accent-teal: #009688;
  --accent-cyan: #00bcd4;
  --accent-blue: #2196f3;
  --text-color: #333;
  --text-light: #ffffff;
  --text-dark: #333333;
  --white: #ffffff;
  --gradient-start: #2196f3;
  --gradient-end: #64b5f6;
  --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Prompt", sans-serif;
}

body {
  background: linear-gradient(135deg, #e8f0fe 0%, #ffffff 100%);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(26, 115, 232, 0.015) 10px,
      rgba(26, 115, 232, 0.015) 11px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 10px,
      rgba(26, 115, 232, 0.015) 10px,
      rgba(26, 115, 232, 0.015) 11px
    ),
    linear-gradient(
      45deg,
      transparent 33.33%,
      rgba(26, 115, 232, 0.02) 33.33%,
      rgba(26, 115, 232, 0.02) 66.66%,
      transparent 66.66%
    ),
    linear-gradient(
      -45deg,
      transparent 33.33%,
      rgba(26, 115, 232, 0.02) 33.33%,
      rgba(26, 115, 232, 0.02) 66.66%,
      transparent 66.66%
    );
  background-size: 30px 30px, 30px 30px, 60px 60px, 60px 60px;
  animation: waveFlow 15s linear infinite;
}

@keyframes waveFlow {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  100% {
    background-position: 60px 60px, 60px 60px, 120px 120px, 120px 120px;
  }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

header {
  background: linear-gradient(135deg, #0f2b61 0%, #1e40af 50%, #3b82f6 100%);
  padding: 3rem 2rem;
  border-radius: 0 0 60px 60px;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(15, 43, 97, 0.2);
  position: relative;
  overflow: hidden;
}

header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    270deg,
    #0f2b61,
    #1e40af,
    #3b82f6,
    #1e40af,
    #0f2b61
  );
  background-size: 400% 400%;
  animation: gradientFlow 15s ease infinite;
  opacity: 1;
}

header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  animation: lightPulse 10s ease-in-out infinite;
  mix-blend-mode: overlay;
}

@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes lightPulse {
  0%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  50% {
    opacity: 0.6;
    transform: translateY(-10px);
  }
}

.logo {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.logo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shine 8s linear infinite;
  border-radius: inherit;
}

@keyframes shine {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.logo h1 {
  color: white;
  font-size: 2.8rem;
  margin: 0;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  letter-spacing: -0.5px;
  line-height: 1.2;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.logo p {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.25rem;
  margin: 1rem 0 0 0;
  font-weight: 300;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.search-box {
  background: white;
  border-radius: 50px;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  max-width: 600px;
  margin: 1rem auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  position: relative;
}

.search-box input {
  border: none;
  outline: none;
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: transparent;
}

.search-box i {
  color: #1a73e8;
  font-size: 1.2rem;
}

.clear-button {
  background: none;
  border: none;
  color: #1a73e8;
  cursor: pointer;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.clear-button:hover {
  opacity: 1;
}

main {
  flex: 1;
  width: 100%;
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 1600px) {
  .systems-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 2000px) {
  .container {
    max-width: 1400px;
  }

  .systems-grid {
    max-width: 1400px;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

.system-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.3s ease;
  overflow: hidden;
  animation: cardAppear 0.5s ease forwards;
  animation-delay: calc(var(--order) * 0.1s);
  opacity: 0;
  transform: translateY(20px);
  height: 100%;
  min-height: 250px;
  justify-content: center;
}

@keyframes cardAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* HDC Service */
.system-card[data-type="hdc-service"] {
  background: linear-gradient(135deg, #f48fb1, #ec407a);
}

/* HDC Surat */
.system-card[data-type="hdc-surat"] {
  background: linear-gradient(135deg, #42a5f5, #0d47a1);
}

/* Payslip */
.system-card[data-type="payslip"] {
  background: linear-gradient(135deg, #26a69a, #00695c);
}

/* HMONEY */
.system-card[data-type="hmoney"] {
  background: linear-gradient(135deg, #66bb6a, #2e7d32);
}

/* MWIS */
.system-card[data-type="mwis"] {
  background: linear-gradient(135deg, #9c27b0, #6a1b9a);
}

/* Strategy */
.system-card[data-type="strategy"] {
  background: linear-gradient(135deg, #26c6da, #00838f);
}

/* Booking */
.system-card[data-type="booking"] {
  background: linear-gradient(135deg, #ffa726, #ef6c00);
}

/* Document */
.system-card[data-type="document"] {
  background: linear-gradient(135deg, #ef5350, #c62828);
}

/* Bed Dashboard */
.system-card[data-type="bed"] {
  background: linear-gradient(135deg, #7986cb, #303f9f);
}

.system-card i {
  font-size: 2.8em;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  margin-bottom: 1.5rem;
  color: white;
  transition: all 0.3s ease;
}

.system-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  filter: brightness(1.1);
  transition: all 0.3s ease;
}

.system-card:hover i {
  transform: scale(1.2);
  background: rgba(255, 255, 255, 0.3);
}

.system-card h3 {
  color: white;
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ปรับขนาดตัวอักษรสำหรับชื่อระบบที่ยาว */
.system-card[data-type="strategy"] h3,
.system-card[data-type="document"] h3,
.system-card[data-type="bed"] h3,
.system-card[data-type="payslip"] h3 {
  font-size: 1.3rem;
}

.system-card p {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0;
}

/* Responsive Design */
@media (max-width: 1400px) {
  .systems-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 1rem 2rem;
  }

  .system-card {
    padding: 1.8rem;
  }
}

@media (max-width: 1200px) {
  .systems-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 1rem;
  }

  .container {
    padding: 0 1rem 1rem;
  }

  header {
    padding: 2.5rem 1.8rem;
    border-radius: 0 0 50px 50px;
  }

  .logo {
    padding: 0.8rem;
  }

  .logo h1 {
    font-size: 2.2rem;
  }

  .search-box {
    width: 90%;
    max-width: 500px;
  }
}

@media (max-width: 768px) {
  .systems-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .system-card {
    padding: 1.5rem;
  }

  .system-card i {
    width: 70px;
    height: 70px;
    font-size: 2.2em;
    margin-bottom: 1rem;
  }

  .system-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.6rem;
  }

  .system-card p {
    font-size: 0.9rem;
  }

  header {
    padding: 2rem 1.5rem;
    border-radius: 0 0 40px 40px;
  }

  .logo h1 {
    font-size: 2.2rem;
  }

  .logo p {
    font-size: 1.1rem;
  }

  .search-box {
    padding: 0.6rem 1.2rem;
    margin: 1rem auto;
  }

  .search-box input {
    font-size: 0.9rem;
  }

  footer {
    margin-top: 2.5rem;
    padding: 0.8rem 0;
  }
}

@media (max-width: 576px) {
  .systems-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .system-card {
    padding: 1.5rem;
  }

  .system-card i {
    width: 65px;
    height: 65px;
    font-size: 2em;
  }

  header {
    padding: 1.8rem 1rem;
    border-radius: 0 0 30px 30px;
  }

  .logo h1 {
    font-size: 1.8rem;
  }

  .logo p {
    font-size: 1rem;
    margin-top: 0.8rem;
  }

  .search-box {
    padding: 0.5rem 1rem;
    margin: 1rem auto;
    width: 95%;
  }

  .search-box input {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  .search-box i {
    font-size: 1rem;
  }

  footer {
    margin-top: 2rem;
    padding: 0.7rem 0;
  }
}

/* Fix for very small screens */
@media (max-width: 360px) {
  .system-card {
    padding: 1.2rem;
  }

  .system-card i {
    width: 60px;
    height: 60px;
    font-size: 1.8em;
  }

  .system-card h3 {
    font-size: 1.2rem;
  }

  .system-card p {
    font-size: 0.85rem;
  }

  .logo h1 {
    font-size: 1.6rem;
  }

  .logo p {
    font-size: 0.85rem;
  }
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #666;
}

.no-results i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #1a73e8;
  opacity: 0.5;
}

.no-results p {
  font-size: 1.2rem;
  margin: 0;
}

footer {
  margin-top: 3rem;
  padding: 1rem 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  padding: 0 1rem;
}

.footer-content p {
  color: #999;
  font-size: 0.9rem;
  margin: 0;
}

.footer-content a {
  color: #888;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-content a:hover {
  color: #666;
}

@media (max-width: 576px) {
  .footer-content p {
    font-size: 0.85rem;
  }
}

.system-card.maintenance {
  position: relative;
  cursor: not-allowed;
  filter: grayscale(0.7);
  pointer-events: none;
}

.system-card.maintenance::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: inherit;
  z-index: 1;
}

.system-card.maintenance::after {
  content: "ขออภัย กำลังปรับปรุง!";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  font-weight: 500;
  color: #dc2626;
  z-index: 2;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.system-card.maintenance i,
.system-card.maintenance h3,
.system-card.maintenance p {
  opacity: 0.7;
}

@media (max-width: 768px) {
  .system-card.maintenance::after {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .system-card.maintenance::after {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }
}
