/* ==========================================================================
   花蓮 e 校園 APP 檢索中心 - Modern Design System & Streamlined Layout
   ========================================================================== */

:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-light: #e0f2fe;
  --accent-teal: #0d9488;
  --accent-teal-light: #ccfbf1;
  --accent-orange: #f97316;
  --accent-purple: #8b5cf6;
  
  --bg-gradient: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #f1f5f9 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(226, 232, 240, 0.9);
  --glass-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  --hover-shadow: 0 20px 30px -10px rgba(2, 132, 199, 0.15);

  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Top Announcement Bar */
.top-bar {
  background: #0c4a6e;
  color: #e0f2fe;
  font-size: 0.85rem;
  padding: 8px 0;
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-status {
  background: #0284c7;
  color: #fff;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 0.75rem;
}

/* Hero Header & Card Container */
.hero-header {
  padding: 30px 0 20px 0;
}

.hero-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  box-shadow: 0 15px 35px rgba(2, 132, 199, 0.08);
  padding: 30px 28px;
  text-align: center;
  position: relative;
}

/* Header Top Right Action Button: 使用權限說明 */
.header-action-box {
  position: absolute;
  top: 24px;
  right: 28px;

}

.btn-perm-action {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #0369a1;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12);
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-perm-action:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.25);
  transform: translateY(-2px);
}

/* Title, Logo & Decorative Underline */
.hero-title-wrapper {
  display: inline-block;
  position: relative;
  margin-bottom: 8px;
}

.title-main-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.hero-title-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(2, 132, 199, 0.18));
}

.hero-header h1 {
  font-size: 2.1rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
  padding-bottom: 2px;
}

.title-underline {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #0d9488 100%);
  border-radius: 2px;
  margin: 6px auto 0 auto;
}

.hero-header .subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

/* Multi-Column Hero Grid (3-Column Layout) */
.hero-columns-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 16px;
  text-align: left;
}

.hero-col {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
}

.col-header {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

/* Column 1: Search & Hot Tags */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #bae6fd;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08);
  margin-bottom: 10px;
  transition: var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.18);
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--primary);
  font-size: 1rem;
}

.search-box input {
  width: 100%;
  padding: 10px 36px 10px 42px;
  border: none;
  background: transparent;
  font-size: 0.92rem;
  color: var(--text-main);
  outline: none;
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: #f1f5f9;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.clear-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.hot-searches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hot-label {
  font-weight: 600;
  color: #475569;
}

.hot-tag {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--primary-dark);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 0.78rem;
  transition: var(--transition-fast);
}

.hot-tag:hover {
  background: var(--primary-light);
  border-color: #7dd3fc;
}

/* Columns 2 & 3: Filter Chips */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-main);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.22);
}

/* Card Box */
.card-box {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  padding: 24px;
  margin-bottom: 24px;
}

/* Permission Matrix Modal */
.permission-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.permission-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
}

.permission-modal-card {
  position: relative;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  max-width: 900px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.permission-modal-header {
  padding: 20px 26px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.permission-modal-header h3 {
  font-size: 1.2rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.permission-modal-header .sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close-btn {
  background: #e2e8f0;
  border: none;
  color: #475569;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.permission-modal-body {
  padding: 20px 26px;
  overflow-y: auto;
}

/* Permission Matrix Table */
.permission-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.permission-table th, .permission-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.permission-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
}

.perm-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-block;
}

.perm-admin { background: #dcfce7; color: #15803d; }
.perm-edit { background: #e0f2fe; color: #0369a1; }
.perm-view { background: #f1f5f9; color: #475569; }
.perm-none { background: #fee2e2; color: #b91c1c; }

/* Features Section Cards Grid */
.features-section {
  margin-bottom: 50px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.result-count {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 22px;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--hover-shadow);
  border-color: #7dd3fc;
}

.card-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.card-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.category-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  color: #475569;
}

.feature-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.roles-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.role-pill {
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 4px;
  font-weight: 500;
  background: #e2e8f0;
  color: #334155;
}

.role-pill.role-admin { background: #dbeafe; color: #1e40af; }
.role-pill.role-homeroom { background: #ccfbf1; color: #0f766e; }
.role-pill.role-parent { background: #fef3c7; color: #92400e; }

/* Steps Box */
.steps-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
}

.steps-box h4 {
  font-size: 0.85rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.steps-list {
  list-style: none;
  counter-reset: step-counter;
}

.steps-list li {
  font-size: 0.88rem;
  color: #334155;
  margin-bottom: 8px;
  position: relative;
  padding-left: 22px;
  line-height: 1.45;
}

.steps-list li:last-child {
  margin-bottom: 0;
}

.steps-list li::before {
  content: counter(step-counter);
  counter-increment: step-counter;
  position: absolute;
  left: 0;
  top: 1px;
  width: 16px;
  height: 16px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Warning & Tip Callouts */
.callout {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.45;
}

.callout-warning {
  background: #fff7ed;
  border-left: 4px solid var(--accent-orange);
  color: #9a3412;
}

.callout-tip {
  background: #f0fdf4;
  border-left: 4px solid #22c55e;
  color: #166534;
}

.callout-important {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
  color: #991b1b;
}

/* Card Screenshot Image Area */
.card-image-box {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.card-image-box:hover {
  border-color: var(--primary);
}

.card-image-box img {
  width: 100%;
  height: auto;
  display: block;
  transition: var(--transition-fast);
}

.card-image-box:hover img {
  transform: scale(1.02);
}

.image-hover-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  backdrop-filter: blur(4px);
}

/* Buttons & Controls */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: var(--text-main); }
.btn-outline:hover { background: #f1f5f9; border-color: #94a3b8; }
.btn-secondary { background: #0f172a; color: #fff; }
.btn-secondary:hover { background: #334155; }

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  color: #f1f5f9;
  margin-top: 12px;
  font-size: 0.95rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
}

.lightbox-close {
  position: absolute;
  top: -45px;
  right: 0;
  background: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #0f172a;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* No Results Area */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results h3 {
  margin: 16px 0 8px 0;
  color: #0f172a;
}

.no-results p {
  margin-bottom: 20px;
}

/* Footer */
.footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 24px 0;
  font-size: 0.88rem;
  border-top: 1px solid #1e293b;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer strong { color: #f1f5f9; }

/* Responsive adjustments */
@media (max-width: 992px) {
  .header-action-box { position: static; margin-bottom: 12px; }
  .hero-columns-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .hero-header h1 { font-size: 1.6rem; }
  .title-main-row { flex-direction: column; gap: 8px; }
  .hero-title-logo { height: 42px; }
  .hero-card { padding: 20px 14px; }
  .cards-grid { grid-template-columns: 1fr; }
  .permission-table { display: block; overflow-x: auto; }
}
