/* =====================================================
   SHIMADZU - style.css
   Mobile-first responsive stylesheet
   ===================================================== */

/* ---- CSS Variables ---- */
:root {
  --red: #b22222;
  --red-light: #c0392b;
  --dark: #1a1a1a;
  --text: #222;
  --text-muted: #666;
  --bg: #f0ede8;
  --card-bg: #ffffff;
  --border: #e0dcd5;
  --shadow: 0 2px 12px rgba(0,0,0,0.09);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.16);
  --radius: 14px;
  --nav-height: 56px;
  --font: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* =====================================================
   NAVBAR
   ===================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}
.navbar-logo {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--dark);
}
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--dark);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Desktop nav links */
.nav-links {
  display: none;
  list-style: none;
  gap: 28px;
}
.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--red); }

/* Mobile slide-in menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 999;
  padding: 16px 0;
  transform: translateY(-8px);
  opacity: 0;
  transition: all 0.25s ease;
}
.mobile-menu.open {
  display: block;
  transform: translateY(0);
  opacity: 1;
}
.mobile-menu ul { list-style: none; }
.mobile-menu ul li a {
  display: block;
  padding: 13px 24px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.mobile-menu ul li:last-child a { border-bottom: none; }
.mobile-menu ul li a:hover { background: var(--bg); color: var(--red); }

@media (min-width: 768px) {
  .hamburger { display: none; }
  .nav-links { display: flex; }
  .mobile-menu { display: none !important; }
}

/* =====================================================
   MAIN CONTENT WRAPPER
   ===================================================== */
.page-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 14px 40px;
}

/* =====================================================
   SEARCH BAR
   ===================================================== */
.search-wrap {
  margin-bottom: 16px;
}
.search-wrap input {
  width: 100%;
  padding: 12px 18px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.97rem;
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(178,34,34,0.08);
}

/* =====================================================
   CATEGORY FILTER BUTTONS
   ===================================================== */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-right: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 24px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  padding: 7px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--red); color: var(--red); }
.filter-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* =====================================================
   CATEGORY SECTION
   ===================================================== */
.category-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 18px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.category-section.hidden { display: none; }

.category-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 18px;
  position: relative;
  display: inline-block;
  width: 100%;
}
.category-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 2.5px;
  background: var(--red);
  margin: 6px auto 0;
  border-radius: 2px;
}

/* =====================================================
   MACHINE CARDS GRID
   ===================================================== */
.machines-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

@media (max-width: 480px) {
  .machines-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

.machine-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  background: #e8e4de;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}
.machine-card:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-hover);
}
.machine-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  background: #f8f6f2;
  transition: transform 0.3s ease;
}
.machine-card:hover img { transform: scale(1.06); }

/* Dark gradient overlay */
.machine-card .overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent 0%, rgba(0,0,0,0.72) 100%);
  padding: 20px 8px 8px;
  pointer-events: none;
}
.machine-card .machine-name {
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Empty category placeholder */
.empty-category {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 28px 0 10px;
}

/* =====================================================
   THREE-COLUMN SECTIONS LAYOUT (Desktop only)
   ===================================================== */
.three-col-sections {
  display: block; /* Mobile: stacked */
  margin-top: 8px;
}

@media (min-width: 768px) {
  .three-col-sections {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    align-items: start;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  /* Dividers between columns */
  .three-col-sections .non-card-section {
    border-right: 1.5px solid var(--border);
    padding: 28px 16px 28px;
  }
  .three-col-sections .non-card-section:last-child {
    border-right: none;
  }
}

/* =====================================================
   APPLICATIONS SECTION
   ===================================================== */
.non-card-section {
  text-align: center;
  padding: 32px 0 16px;
}

/* Title matches .category-title exactly */
.non-card-section h2 {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 18px;
  position: relative;
  display: inline-block;
  width: 100%;
}
.non-card-section h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 2.5px;
  background: var(--red);
  margin: 6px auto 0;
  border-radius: 2px;
}

.app-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
}

/* MIF section: single button full-width */
.mif-buttons .app-btn {
  width: 100%;
  max-width: 100%;
}

.app-buttons-r {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 0 8px;
  justify-content: center;
}

/* Buttons: white background, dark text, border — matching site style */
.app-btn {
  width: 100%;
  max-width: 340px;
  padding: 15px 28px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.22s;
  box-shadow: 0 1px 5px rgba(0,0,0,0.06);
}

.app-btn-r {
  width: 100%;
  max-width: 340px;
  padding: 12px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.22s;
  box-shadow: 0 1px 5px rgba(0,0,0,0.06);
}

.app-btn:hover,
.app-btn-r:hover {
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 3px 12px rgba(178,34,34,0.1);
}

/* Mobile: fix Retrofit buttons so they don't overflow */
@media (max-width: 767px) {
  .app-buttons-r {
    flex-wrap: wrap;
    padding: 0 4px;
    gap: 8px;
  }
  .app-btn-r {
    max-width: 100%;
    width: auto;
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    font-size: 0.82rem;
    padding: 11px 10px;
  }
}

/* =====================================================
   LOGIN CTA BANNER
   ===================================================== */
.login-cta {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 28px 0 4px;
}
.login-cta a {
  color: var(--red);
  font-weight: 600;
}

/* =====================================================
   FOOTER
   ===================================================== */
footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 28px 18px 20px;
  margin-top: 16px;
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  font-size: 0.83rem;
}
.footer-brand p {
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
  font-size: 0.78rem;
}
.footer-brand span { font-weight: 700; font-size: 0.95rem; }
.footer-col h4 {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 5px; }
.footer-col ul li a { color: var(--text-muted); font-size: 0.82rem; transition: color 0.2s; }
.footer-col ul li a:hover { color: var(--red); }
.footer-copy {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0;
  padding-top: 14px;
  margin-bottom: 20px;
}
.web-dev {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.web-dev a {
  color: #5a38c0;
  font-weight: 500;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page-bg {
  min-height: calc(100vh - var(--nav-height));
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 14px;
}
.login-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.1);
  padding: 36px 30px 32px;
  width: 100%;
  max-width: 360px;
}
.login-card h1 {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--dark);
  margin-bottom: 6px;
}
.login-card .login-sub {
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.login-card .form-group {
  margin-bottom: 13px;
}
.login-card input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-size: 0.93rem;
  background: #fafafa;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text);
}
.login-card input::placeholder { color: #aaa; }
.login-card input:focus {
  border-color: #6c47d6;
  box-shadow: 0 0 0 3px rgba(108,71,214,0.1);
  background: #fff;
}
.login-btn {
  width: 100%;
  padding: 14px;
  border-radius: 50px;
  border: none;
  background: #6c47d6;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  letter-spacing: 0.5px;
  transition: background 0.2s, transform 0.15s;
}
.login-btn:hover { background: #5a38c0; transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }
.login-error {
  display: none;
  color: #c0392b;
  font-size: 0.84rem;
  text-align: center;
  margin-top: 10px;
}
.login-error.show { display: block; }

/* =====================================================
   HIDDEN PAGE BADGE
   ===================================================== */
.protected-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff3cd;
  border: 1px solid #f0c040;
  color: #856404;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 50px;
  margin-bottom: 18px;
}
.logout-btn {
  position: fixed;
  right: 1%;
  background: none;
  border: 1.5px solid var(--red);
  color: var(--red);
  border-radius: 50px;
  padding: 6px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 10px;
}
.logout-btn:hover { background: var(--red); color: #fff; }

/* =====================================================
   LOADING STATE
   ===================================================== */
.loading-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   UTILITY
   ===================================================== */
.hidden-el { display: none !important; }
