/* ========================================
   XmuCloud - Custom Styles
   Color Scheme: Deep Navy + Teal Accent
   ======================================== */

:root {
  --primary: #1a365d;
  --primary-light: #2c5282;
  --primary-dark: #0f2440;
  --accent: #0d9488;
  --accent-light: #14b8a6;
  --accent-dark: #0a7a70;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --text-light-muted: #94a3b8;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  --radius: 12px;
}

/* ---- Base ---- */
* { box-sizing: border-box; }

body {
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-dark);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

img { content-visibility: auto; }

/* ---- Navbar ---- */
#mainNav {
  background: var(--primary);
  padding: 0.8rem 0;
  transition: padding 0.3s, background-color 0.3s, box-shadow 0.3s;
  will-change: padding;
}

#mainNav.scrolled {
  background: var(--primary-dark);
  padding: 0.5rem 0;
  box-shadow: var(--shadow-lg);
}

#mainNav .navbar-brand {
  font-size: 1.3rem;
  letter-spacing: 0.5px;
}

#mainNav .nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: color 0.2s;
}

#mainNav .nav-link:hover,
#mainNav .nav-link.active {
  color: var(--accent-light);
}

.lang-switch {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  padding: 0.3rem 0.8rem !important;
  font-size: 0.85rem;
}

.lang-switch:hover { border-color: var(--accent-light); }

/* ---- Hero Section ---- */
.hero-section {
  position: relative;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.home-hero {
  min-height: 78vh;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(13, 148, 136, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(13, 148, 136, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  color: #fff;
}

.hero-content .lead {
  color: rgba(255, 255, 255, 0.85);
  max-width: 600px;
  margin: 0 auto;
}

.text-accent { color: var(--accent-light) !important; }

.section-kicker {
  display: inline-block;
  color: var(--accent-light);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

/* ---- Buttons ---- */
.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  padding: 0.6rem 1.8rem;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn-accent:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-outline-light {
  border-radius: 8px;
  font-weight: 500;
  padding: 0.6rem 1.8rem;
}

/* ---- Page Header ---- */
.page-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 8rem 0 4rem;
}

.page-header .lead { color: rgba(255, 255, 255, 0.8); }

/* ---- Sections ---- */
.section { padding: 5rem 0; }

.section-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.bg-light { background-color: var(--bg-light) !important; }

/* ---- Service Cards (Home) ---- */
.service-card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  will-change: transform;
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.service-icon { color: var(--accent); }

/* ---- Why Choose Us ---- */
.why-card { padding: 2rem 1rem; }

.why-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

/* ---- Product Blocks ---- */
.product-block {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  will-change: transform;
  contain: layout style;
}

.product-block:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.product-screenshot {
  overflow: hidden;
  background: #f1f5f9;
  height: 100%;
  min-height: 280px;
}

.product-screenshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-screenshot .carousel {
  height: 400px;
  overflow: hidden;
}

.product-screenshot .carousel-inner {
  height: 100%;
}

.product-screenshot .carousel-item {
  height: 100%;
}

.product-screenshot .carousel-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-screenshot .carousel-control-prev-icon,
.product-screenshot .carousel-control-next-icon {
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  padding: 1rem;
}

.product-screenshot .carousel-indicators button {
  background-color: var(--accent);
}

.product-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-icon {
  width: 56px;
  height: 56px;
  background: var(--bg-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.badge.bg-tech {
  background: var(--primary-light) !important;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  padding: 0.3rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.feature-list .fa-check-circle { color: var(--accent); }

/* ---- Featured Products ---- */
.product-promo-section {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.promo-card {
  display: block;
  height: 100%;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
}

.promo-card:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(20, 184, 166, 0.55);
  transform: translateY(-4px);
}

.promo-card-media {
  height: 190px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.promo-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.promo-card-media.icon-media {
  display: flex;
  align-items: center;
  justify-content: center;
}

.promo-card-media.icon-media img {
  width: 112px;
  height: 112px;
  border-radius: 24px;
  object-fit: contain;
}

.promo-card-body {
  padding: 1.5rem;
}

.promo-card-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.promo-card-body p {
  min-height: 5.25rem;
  color: rgba(255, 255, 255, 0.76);
}

/* ---- Product Detail Pages ---- */
.product-hero {
  padding: 8rem 0 5rem;
}

.medbar-hero {
  background: linear-gradient(135deg, #111827 0%, #1a365d 55%, #0d9488 100%);
}

.dicom-hero {
  background: linear-gradient(135deg, #0f2440 0%, #1a365d 55%, #2563eb 100%);
}

.opendrug-hero {
  background: linear-gradient(135deg, #052e1b 0%, #166534 55%, #228b22 100%);
}

.hero-product-img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.feature-card {
  border-radius: var(--radius);
}

.feature-card .text-accent {
  color: var(--accent) !important;
}

.product-logo-panel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 2rem;
}

.product-logo-panel img {
  width: 128px;
  height: 128px;
  border-radius: 28px;
  margin-bottom: 1rem;
}

.product-logo-panel p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

/* ---- AI Feature Cards ---- */
.ai-feature-card {
  padding: 2rem;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  will-change: transform;
  height: 100%;
}

.ai-feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.ai-feature-icon { color: var(--accent); }

/* ---- Tech Stack Cards ---- */
.tech-stack-card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  will-change: transform;
}

.tech-stack-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ---- About Page ---- */
.value-card {
  transition: transform 0.25s, box-shadow 0.25s;
  will-change: transform;
}

.value-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg) !important;
}

.value-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.badge.bg-primary-custom {
  background: var(--primary) !important;
  font-weight: 400;
  font-size: 0.85rem;
}

.tech-badges .badge {
  transition: transform 0.2s, background-color 0.2s;
}

.tech-badges .badge:hover {
  transform: translateY(-2px);
  background: var(--accent) !important;
}

/* ---- Case Study ---- */
.case-card {
  border-radius: var(--radius);
  transition: transform 0.25s, box-shadow 0.25s;
  will-change: transform;
}

.case-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg) !important;
}

.case-card .col-md-5 {
  position: relative;
  overflow: hidden;
}

.case-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-img-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 767px) {
  .case-card .col-md-5 {
    height: 200px;
  }
}

.badge.bg-accent-soft {
  background: rgba(13, 148, 136, 0.12) !important;
  color: var(--accent);
  font-weight: 500;
}

.case-tags .badge {
  border: 1px solid #e2e8f0;
  font-weight: 400;
}

/* ---- Contact Page ---- */
.form-control {
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.contact-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

/* ---- Footer ---- */
.footer {
  background: var(--primary-dark);
  color: #fff;
  padding: 3rem 0 1.5rem;
}

.footer a {
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.2s;
}

.footer a:hover { color: var(--accent-light); }
.footer-links li { margin-bottom: 0.4rem; }
.text-light-muted { color: rgba(255, 255, 255, 0.6) !important; }

/* ---- Animations ---- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s forwards;
}

.fade-in:nth-child(2) { animation-delay: 0.2s; }
.fade-in:nth-child(3) { animation-delay: 0.4s; }
.fade-in:nth-child(4) { animation-delay: 0.6s; }

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  will-change: opacity, transform;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hero-section { min-height: 80vh; }
  .hero-content h1 { font-size: 2rem; }
  .hero-content h2 { font-size: 1.2rem; }
  .section { padding: 3rem 0; }
  .page-header { padding: 6rem 0 3rem; }
  .page-header h1 { font-size: 2rem; }

  .product-screenshot {
    min-height: 200px;
    max-height: 300px;
  }

  .product-screenshot .carousel {
    height: 260px;
  }

  .product-block .row {
    flex-direction: column !important;
  }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .fade-in { opacity: 1; transform: none; animation: none; }
}
