/* ===================================================
   工務店専用ポータル — style.css
   ブルー系 / レスポンシブ / モバイルファースト
   =================================================== */

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

:root {
  --blue-primary:   #1a73e8;
  --blue-dark:      #0d47a1;
  --blue-deeper:    #1565c0;
  --blue-light:     #e8f0fe;
  --blue-lighter:   #f0f6ff;
  --text-main:      #202124;
  --text-sub:       #5f6368;
  --text-white:     #ffffff;
  --border:         #dadce0;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.12);
  --shadow-md:      0 2px 12px rgba(0,0,0,.14);
  --shadow-hover:   0 4px 20px rgba(26,115,232,.25);
  --radius:         12px;
  --radius-sm:      8px;
  --header-h:       60px;
  --sidebar-w:      240px;
  --transition:     0.22s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: #f5f7fa;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { text-decoration: none; color: inherit; }

/* =================== HEADER =================== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: linear-gradient(90deg, #0d47a1 0%, #1a73e8 100%);
  box-shadow: 0 2px 8px rgba(13,71,161,.35);
  z-index: 1000;
  display: flex;
  align-items: center;
}
.header-inner {
  width: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo-icon { font-size: 24px; line-height: 1; }
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.logo-main {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

/* Search */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 340px;
}
.search-input {
  width: 100%;
  height: 36px;
  padding: 0 14px;
  border-radius: 20px;
  border: none;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: background var(--transition), box-shadow var(--transition);
}
.search-input::placeholder { color: rgba(255,255,255,.65); }
.search-input:focus {
  background: rgba(255,255,255,.28);
  box-shadow: 0 0 0 2px rgba(255,255,255,.4);
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
  z-index: 2000;
  display: none;
}
.search-results.active { display: block; }
.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--blue-lighter); }
.sri-icon { font-size: 16px; }
.sri-body { flex: 1; min-width: 0; }
.sri-title { font-size: 13px; font-weight: 500; }
.sri-page { font-size: 11px; color: var(--text-sub); }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background var(--transition);
}
.hamburger:hover { background: rgba(255,255,255,.15); }
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* =================== SIDEBAR =================== */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 900;
  transition: box-shadow var(--transition);
}
.sidebar-header {
  padding: 16px 20px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-sub);
}
.nav-list { list-style: none; padding: 0 8px 24px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.nav-item:hover {
  background: var(--blue-light);
  color: var(--blue-primary);
}
.nav-item.active {
  background: var(--blue-light);
  color: var(--blue-primary);
  font-weight: 700;
}
.nav-icon { font-size: 18px; flex-shrink: 0; }

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 850;
}
.overlay.active { display: block; }

/* =================== MAIN =================== */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* =================== PAGES =================== */
.page { display: none; animation: fadeIn .25s ease; }
.page.active { display: block; }

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

/* Hero */
.page-hero {
  background: linear-gradient(135deg, #0d47a1 0%, #1a73e8 50%, #42a5f5 100%);
  padding: 48px 24px 44px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='30' cy='30' r='28' fill='none' stroke='rgba(255,255,255,.06)' stroke-width='1'/%3E%3C/svg%3E") repeat;
}
.hero-content { position: relative; z-index: 1; }
.hero-title {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 10px;
}
.hero-sub { color: rgba(255,255,255,.85); font-size: 15px; }

/* Page banner (for sub-pages) */
.page-banner {
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.banner-icon { font-size: 36px; flex-shrink: 0; }
.banner-text h2 { font-size: 20px; font-weight: 700; color: #fff; }
.banner-text p { font-size: 13px; color: rgba(255,255,255,.8); margin-top: 2px; }

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Section titles */
.section-title-wrap { margin-bottom: 14px; }
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-desc { font-size: 12px; color: var(--text-sub); margin-top: 3px; }

/* =================== QUICK CARDS (HOME) =================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.quick-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.quick-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--blue-primary);
}
.qc-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.qc-body { flex: 1; min-width: 0; }
.qc-title { font-size: 14px; font-weight: 700; }
.qc-desc { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.qc-arrow { font-size: 22px; color: var(--text-sub); flex-shrink: 0; }

/* =================== LINK CHIPS =================== */
.link-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: var(--blue-light);
  color: var(--blue-dark);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), box-shadow var(--transition);
  cursor: pointer;
  border: 1px solid rgba(26,115,232,.2);
}
.chip:hover {
  background: var(--blue-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,115,232,.3);
}

/* =================== NOTICES =================== */
.notice-list { display: flex; flex-direction: column; gap: 8px; }
.notice-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: box-shadow var(--transition);
}
.notice-item:hover { box-shadow: var(--shadow-sm); }
.notice-item.notice-new { border-left: 3px solid var(--blue-primary); }
.notice-badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  background: var(--border);
  color: var(--text-sub);
  white-space: nowrap;
}
.notice-badge.new { background: var(--blue-primary); color: #fff; }
.notice-title { font-size: 13px; font-weight: 500; }
.notice-date { font-size: 11px; color: var(--text-sub); margin-top: 2px; }

/* =================== TOOL SECTIONS =================== */
.tool-section { margin-bottom: 36px; }
.tool-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 3px solid var(--blue-primary);
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.tool-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  cursor: pointer;
}
.tool-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--blue-primary);
}
.tc-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}
.tc-body { flex: 1; min-width: 0; }
.tc-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.tc-desc { font-size: 12px; color: var(--text-sub); line-height: 1.5; margin-bottom: 8px; }

/* Tags */
.tc-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.tc-tag.green   { background: #e6f4ea; color: #1e7e34; }
.tc-tag.blue    { background: #e8f0fe; color: #1557b0; }
.tc-tag.red     { background: #fce8e6; color: #c5221f; }
.tc-tag.yellow  { background: #fef7e0; color: #b06000; }
.tc-tag.orange  { background: #fef3e2; color: #b05a00; }
.tc-tag.purple  { background: #f3e8fd; color: #7c1fa8; }
.tc-tag.gray    { background: #f1f3f4; color: #5f6368; }

/* =================== FOOTER =================== */
.footer {
  margin-left: var(--sidebar-w);
  background: var(--blue-dark);
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 16px;
  font-size: 12px;
}

/* =================== SCROLLBAR =================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0c9d8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #8fa3bf; }

/* =================== RESPONSIVE =================== */

/* Tablet (≤900px) */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .tool-grid  { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* Mobile (≤680px) */
@media (max-width: 680px) {
  :root { --header-h: 56px; }

  /* Header */
  .logo-sub { display: none; }
  .hamburger { display: flex; }
  .search-wrap { max-width: 180px; }

  /* Sidebar hidden by default on mobile, shown when .open */
  .sidebar {
    display: none;
    z-index: 950;
  }
  .sidebar.open {
    display: block;
    box-shadow: 4px 0 20px rgba(0,0,0,.18);
  }

  /* Main takes full width */
  .main { margin-left: 0; }
  .footer { margin-left: 0; }

  /* Hero */
  .page-hero { padding: 32px 16px 28px; }

  /* Cards */
  .card-grid { grid-template-columns: 1fr; }
  .tool-grid  { grid-template-columns: 1fr; }

  /* Quick card */
  .quick-card { padding: 14px; }
  .qc-icon { width: 40px; height: 40px; font-size: 20px; }

  /* Container */
  .container { padding: 16px 12px 50px; }

  /* Banner */
  .page-banner { padding: 20px 16px; }
  .banner-icon { font-size: 28px; }

  /* Tool card */
  .tool-card { padding: 14px; }
  .tc-icon { font-size: 20px; }
  .tc-title { font-size: 13px; }

  /* Search full width on focus */
  .search-wrap { max-width: 200px; }
}

/* Very small (≤380px) */
@media (max-width: 380px) {
  .logo-main { font-size: 13px; }
  .search-wrap { max-width: 140px; }
  .search-input { font-size: 12px; }
}
