/* ══════════════════════════════════════
   plan.css
   ══════════════════════════════════════ */

/* ── Tab bar ─────────────────────────── */
.plan-tabs-bar {
  background: #fff;
  border-bottom: 2px solid #f0f0f0;
  position: sticky;
  top: 72px;
  z-index: 100;
}
.plan-tabs {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  gap: 0;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem;
  scrollbar-width: none;
}
.plan-tabs::-webkit-scrollbar { display: none; }

.plan-tab {
  white-space: nowrap;
  padding: .9rem 1.4rem;
  font-size: .99rem;
  font-weight: 300;
  color: #888;
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: color .2s, border-color .2s;
  flex-shrink: 0;
}
.plan-tab:hover { color: #333; }
.plan-tab.active {
  color: #1a1a2e;
  border-bottom-color: #1a1a2e;
  font-weight: 300;
}

/* ── Content wrapper ─────────────────── */
.plan-content {
  padding: 2rem 1.5rem 5rem;
}

/* ── Search ──────────────────────────── */
.plan-search-wrap { margin-bottom: 1.75rem; display: flex; justify-content: center; }
.plan-search-form {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: .55rem 1.1rem;
  width: 100%;
  max-width: 560px;
}
.plan-search-form i:first-child { color: #9ca3af; flex-shrink: 0; }
.plan-search-form input {
  flex: 1;
  border: none;
  outline: none;
  font-size: .88rem;
  font-family: 'Mitr', sans-serif;
  color: #333;
  background: transparent;
}
.plan-search-clear {
  color: #9ca3af;
  text-decoration: none;
  display: flex;
  align-items: center;
  font-size: .82rem;
}
.plan-search-clear:hover { color: #ef4444; }

/* ── Card grid ───────────────────────── */
.plan-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem;
}

/* ── Card ────────────────────────────── */
.plan-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  transition: transform .25s ease, box-shadow .25s ease;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.plan-card.plan-card-nofile { cursor: default; }
.plan-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 32px rgba(0,0,0,.14);
}
.plan-card.plan-card-nofile:hover {
  transform: none;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* ── Cover ───────────────────────────── */
.plan-card-cover {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--g-200);
  flex-shrink: 0;
}
.plan-card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.plan-card:hover .plan-card-cover img { transform: scale(1.05); }

.plan-card-cover-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--g-400);
  font-size: 3rem;
}

/* Title overlay */
.plan-card-overlay {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 1rem .9rem .7rem;
  background: linear-gradient(to bottom, rgba(0,0,0,.65) 0%, rgba(0,0,0,0) 100%);
}
.plan-card-overlay-title {
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.plan-card-overlay-year {
  font-size: .7rem;
  color: rgba(255,255,255,.85);
  margin-top: .2rem;
}

/* ── Card footer ─────────────────────── */
.plan-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem .85rem;
  border-top: 1px solid #f3f4f6;
  gap: .5rem;
}
.plan-card-year {
  font-size: .72rem;
  color: #9ca3af;
  font-weight: 600;
}
.plan-card-actions { display: flex; gap: .3rem; margin-left: auto; }

.plan-action-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .95rem;
  text-decoration: none;
  transition: background .15s;
  border: none; cursor: pointer;
  background: transparent;
}
.plan-action-view { color: #0284c7; }
.plan-action-view:hover { background: #f0f4f8; }
.plan-action-dl   { color: #16a34a; margin-left: -10px; }
.plan-action-dl:hover { background: #f0f4f8; }
.plan-action-btn.disabled { opacity: .3; cursor: not-allowed; pointer-events: none; }

/* ── Sub-tabs (table view) ───────────── */
.plan-subtabs-bar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
.plan-subtabs {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  gap: 0;
  padding: 4px;
  margin: .3rem auto .54rem;
  width: fit-content;
  background: #f3f4f6;
  border-radius: 6px;
  scrollbar-width: none;
}
.plan-subtabs::-webkit-scrollbar { display: none; }
.plan-subtab {
  white-space: nowrap;
  padding: .28rem .85rem;
  font-size: .99rem;
  font-weight: 300;
  color: #555;
  text-decoration: none;
  border-radius: 4px;
  border: none;
  background: transparent;
  transition: all .2s;
  flex-shrink: 0;
}
.plan-subtab:hover { color: #1a1a2e; }
.plan-subtab.active { background: #1a1a2e; color: #fff; font-weight: 300; }

/* ── Sub2-tabs (underline, level 2) ─── */
.plan-sub2tabs-bar {
  background: #fff;
  border-bottom: 2px solid #f0f0f0;
}
.plan-sub2tabs {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  gap: 0;
  padding: 0 1.5rem;
  scrollbar-width: none;
}
.plan-sub2tabs::-webkit-scrollbar { display: none; }
.plan-sub2tab {
  white-space: nowrap;
  padding: .75rem 1.1rem;
  font-size: .99rem;
  font-weight: 300;
  color: #888;
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
  transition: color .2s, border-color .2s;
  flex-shrink: 0;
}
.plan-sub2tab:hover { color: #333; }
.plan-sub2tab.active {
  color: #1a1a2e;
  border-bottom-color: #1a1a2e;
  font-weight: 300;
}

/* ── Table ───────────────────────────── */
.plan-table-wrap {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  overflow: hidden;
  margin-top: .5rem;
  margin-bottom: 1.5rem;
}
.plan-table {
  width: 100%;
  border-collapse: collapse;
}
.plan-table thead th {
  background: #f8faf8;
  font-size: .9rem;
  font-weight: 400;
  color: #111;
  padding: .65rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.plan-table tbody td {
  padding: .65rem 1.25rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: .95rem;
  color: #555;
  vertical-align: middle;
  font-weight: 300;
}
.plan-table tbody tr:last-child td { border-bottom: none; }
.plan-table tbody tr:hover td { background: #f8faf8; }
.plan-col-date { white-space: nowrap; min-width: 140px; }
.plan-table-actions { text-align: right; white-space: nowrap; }

/* ── Pagination ──────────────────────── */
.plan-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 1.5rem 0;
  flex-wrap: wrap;
}
.plan-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 .6rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-family: 'Mitr', sans-serif;
  text-decoration: none;
  color: #444;
  border: 1px solid #e5e7eb;
  background: #fff;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.plan-page-btn:hover,
.plan-page-btn.active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.plan-page-btn.disabled { opacity: .4; pointer-events: none; }

/* ── Empty state ─────────────────────── */
.plan-empty {
  text-align: center;
  padding: 5rem 1rem;
}
.plan-empty i { font-size: 3.5rem; display: block; margin-bottom: 1rem; color: #d1d5db; }
.plan-empty p { font-size: .9rem; color: #9ca3af; }

/* ── Responsive ──────────────────────── */
@media (max-width: 768px) {
  .plan-card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
  .plan-content { padding: 1.5rem 1rem 3rem; }
}
@media (max-width: 400px) {
  .plan-card-grid { grid-template-columns: 1fr 1fr; }
}
