/* ===== RESET & VARIABLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange:       #f56b2a;
  --orange-hover: #d4521b;
  --orange-light: #fff3ee;
  --orange-faint: #fdf0e8;
  --text:         #2c2c2c;
  --text-light:   #666;
  --text-muted:   #999;
  --bg:           #f4f4f4;
  --white:        #ffffff;
  --border:       #e5e5e5;
  --shadow-sm:    0 1px 4px rgba(0,0,0,.07);
  --shadow:       0 2px 10px rgba(0,0,0,.09);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.18);
  --radius:       8px;
  --radius-lg:    12px;
  --font:         'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ===== HEADER ===== */
.header {
  background: var(--orange);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(245,107,42,.35);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 28px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  opacity: .9;
}

.logo h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.2px;
  line-height: 1.2;
}

.logo-sub {
  font-size: .8rem;
  opacity: .75;
  font-weight: 400;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.4);
  color: #fff;
  text-decoration: none;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}

.download-link:hover {
  background: rgba(255,255,255,.3);
  border-color: rgba(255,255,255,.6);
}

.download-link-attention {
  background: #fff;
  color: var(--orange);
  border-color: #fff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, .85);
  animation: download-pulse 1.2s infinite;
}

.download-link-attention:hover {
  background: #fff6f2;
  color: var(--orange-hover);
}

@keyframes download-pulse {
  0% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, .85);
  }
  50% {
    opacity: .72;
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
  }
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .download-link-attention {
    animation: none;
  }
}

.header-stats {
  display: flex;
  gap: 20px;
  font-size: .82rem;
  opacity: .9;
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-item strong {
  font-weight: 700;
}

/* ===== ROOM NAVIGATION ===== */
.room-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 62px;
  z-index: 100;
  overflow-x: auto;
  scrollbar-width: none;
}

.room-nav::-webkit-scrollbar { display: none; }

.room-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
}

.room-tab {
  flex-shrink: 0;
  padding: 0 18px;
  height: 48px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: .875rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
  position: relative;
}

.room-tab:hover {
  color: var(--orange);
  background: var(--orange-faint);
}

.room-tab.active {
  color: var(--orange);
  font-weight: 600;
  border-bottom-color: var(--orange);
}

.tab-icon {
  font-size: 1rem;
  line-height: 1;
}

.tab-count {
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: .72rem;
  font-weight: 500;
}

.room-tab.active .tab-count {
  background: var(--orange-light);
  color: var(--orange);
}

/* ===== MAIN ===== */
.main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 28px 60px;
}

/* ===== ROOM HEADER ===== */
.room-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.room-header-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.room-header-icon { font-size: 1.5rem; }

.room-header-meta {
  font-size: .85rem;
  color: var(--text-muted);
}

.room-header-meta span {
  margin-right: 16px;
}

.room-header-meta strong {
  color: var(--text-light);
  font-weight: 600;
}

/* ===== PHOTO GRID ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.photo-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  position: relative;
}

.photo-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: #ddd;
}

.photo-card:hover .photo-overlay {
  opacity: 1;
}

.photo-thumb-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #f0f0f0;
}

.photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}

.photo-card:hover .photo-thumb {
  transform: scale(1.04);
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(245,107,42,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .18s;
}

.photo-overlay-btn {
  width: 46px;
  height: 46px;
  background: var(--orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(245,107,42,.45);
}

.photo-overlay-btn svg {
  width: 20px;
  height: 20px;
  color: #fff;
  stroke: #fff;
}

.photo-footer {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.photo-name {
  font-size: .76rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.photo-badge {
  background: var(--orange);
  color: #fff;
  border-radius: 20px;
  padding: 2px 9px;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: .3px;
}

/* ===== LOADING ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  gap: 18px;
  color: var(--text-muted);
  font-size: .9rem;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ERROR ===== */
.error-box {
  max-width: 520px;
  margin: 60px auto;
  background: var(--white);
  border: 1px solid #f0c0b0;
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.error-box h2 {
  color: #c0392b;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.error-box p {
  color: var(--text-light);
  font-size: .9rem;
  line-height: 1.6;
  margin-top: 6px;
}

.error-box code {
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: .82rem;
  color: var(--orange);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .58);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 960px;
  width: 100%;
  max-height: 88vh;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.98);
  transition: transform .22s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.07);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  z-index: 10;
  color: var(--text);
}

.modal-close:hover { background: rgba(0,0,0,.14); }

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-content {
  display: flex;
  height: 88vh;
  max-height: 88vh;
}

.modal-photo-wrap {
  flex: 0 0 48%;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-items-header {
  padding: 22px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  padding-right: 40px;
  line-height: 1.3;
}

.modal-subtitle {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.item-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Custom scrollbar in modal */
.item-list::-webkit-scrollbar { width: 5px; }
.item-list::-webkit-scrollbar-track { background: transparent; }
.item-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.item-list::-webkit-scrollbar-thumb:hover { background: #ccc; }

.item-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  transition: border-color .15s, background .15s;
  cursor: default;
}

.item-card:hover {
  border-color: var(--orange);
  background: var(--orange-faint);
}

.item-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.item-id {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: .5px;
  flex-shrink: 0;
  line-height: 1.6;
}

.item-desc {
  font-size: .855rem;
  color: var(--text);
  line-height: 1.45;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.item-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .72rem;
  color: var(--text-muted);
  padding: 2px 7px;
}

.item-tag.cat { color: var(--orange); border-color: var(--orange-light); background: var(--orange-light); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .header-actions { gap: 10px; }
  .download-link {
    height: 30px;
    padding: 0 10px;
    font-size: .72rem;
  }
  .header-stats { gap: 12px; }
  .stat-item:last-child { display: none; }
  .main { padding: 16px 16px 48px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .modal-content { flex-direction: column; height: auto; max-height: 92vh; }
  .modal-photo-wrap { flex: 0 0 240px; }
  .modal { max-height: 92vh; }
}

@media (max-width: 480px) {
  .header-stats { display: none; }
  .download-link {
    height: 28px;
    padding: 0 9px;
    font-size: .68rem;
  }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .room-tab { padding: 0 12px; font-size: .82rem; }
  .tab-count { display: none; }
}
