:root {
  --color-navy: #1b2a41;
  --color-navy-dark: #101a2b;
  --color-navy-light: #2f5788;
  --color-accent: #a3182b;
  --color-accent-dark: #7d1220;
  --color-gold: #c9a227;
  --color-bg: #e7ebf1;
  --gradient-hero: linear-gradient(135deg, var(--color-navy-light) 0%, var(--color-accent) 100%);
  --color-surface: #ffffff;
  --color-text: #1f2937;
  --color-muted: #6b7280;
  --color-border: #e3e6eb;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(16, 26, 43, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 26, 43, 0.14);
  --max-width: 1140px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--color-navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.brand:hover {
  text-decoration: none;
}
.brand img {
  height: 42px;
  width: auto;
  border-radius: 4px;
  background: #fff;
  padding: 2px;
}
.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.15;
}
.brand-name small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: #c8d1e0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.main-nav a {
  color: #dfe6f2;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.94rem;
}
.main-nav a:hover, .main-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.lang-toggle:hover {
  background: rgba(255,255,255,0.12);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}
.btn:hover {
  text-decoration: none;
}
.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-accent-dark);
}
.btn-secondary {
  background: #fff;
  color: var(--color-navy);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  background: #f0f2f5;
}
.btn-outline-light {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.6);
}
.btn-outline-light:hover {
  background: rgba(255,255,255,0.15);
}
.btn-danger {
  background: var(--color-accent);
  color: #fff;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Hero */
.hero {
  background: var(--gradient-hero);
  color: #fff;
  padding: 64px 0;
}
.hero .container {
  display: flex;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
}
.hero-content {
  flex: 1 1 420px;
}
.hero h1 {
  font-size: 2.3rem;
  margin: 0 0 14px;
  line-height: 1.25;
}
.hero p {
  color: #d7dee9;
  font-size: 1.05rem;
  margin-bottom: 26px;
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-badges {
  flex: 1 1 260px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 22px;
}
.hero-badges h3 {
  margin-top: 0;
  font-size: 1rem;
  color: var(--color-gold);
}
.hero-badges ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.hero-badges li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.92rem;
}
.hero-badges li:last-child {
  border-bottom: none;
}

/* Sections */
section {
  padding: 56px 0;
}
.section-title {
  text-align: center;
  margin-bottom: 34px;
}
.section-title h2 {
  font-size: 1.7rem;
  color: var(--color-navy);
  margin-bottom: 8px;
}
.section-title p {
  color: var(--color-muted);
}

/* Page banner: same gradient as the home page hero, used at the top of inner pages */
.page-banner {
  background: var(--gradient-hero);
  color: #fff;
  padding: 40px 0;
}
.page-banner .section-title {
  margin-bottom: 0;
}
.page-banner .section-title h2 {
  color: #fff;
  font-size: 1.9rem;
  margin: 0;
}
.page-banner .section-title p {
  color: rgba(255, 255, 255, 0.88);
  margin: 8px 0 0;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
}
.service-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--color-accent);
}
.service-card h3 {
  margin-top: 0;
  color: var(--color-navy);
}
.service-card ul {
  padding-left: 20px;
  color: var(--color-muted);
  margin-bottom: 0;
}

/* Cards / gallery */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.filter-bar button {
  background: #fff;
  border: 1px solid var(--color-border);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-navy);
}
.filter-bar button.active, .filter-bar button:hover {
  background: var(--color-navy);
  color: #fff;
  border-color: var(--color-navy);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.project-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.project-card .thumb {
  aspect-ratio: 4 / 3;
  background: #dfe3ea center/cover no-repeat;
  background-size: cover;
}
.project-card .body {
  padding: 16px 18px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.project-card h3 {
  margin: 0 0 6px;
  font-size: 1.08rem;
  color: var(--color-navy);
}
.project-card .meta {
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}
.badge {
  display: inline-block;
  background: var(--color-navy);
  color: #fff;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.badge.category-ADU { background: #2a6f4a; }
.badge.category-NEW_CONSTRUCTION { background: #1b2a41; }
.badge.category-REMODELING { background: #7a5b1e; }
.badge.category-EARTHQUAKE_RETROFIT { background: var(--color-accent); }

.stars {
  color: var(--color-gold);
  letter-spacing: 1px;
}
.rating-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--color-muted);
  margin-top: auto;
  padding-top: 10px;
}

/* Project detail */
.detail-gallery {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.detail-gallery .main-image {
  aspect-ratio: 4 / 3;
  background: #dfe3ea center/cover no-repeat;
  border-radius: var(--radius);
}
.thumb-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  align-content: start;
}
.thumb-strip img {
  border-radius: 8px;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
}
.thumb-strip img.active {
  border-color: var(--color-accent);
}

.detail-header h1 {
  color: var(--color-navy);
  margin-bottom: 6px;
}
.detail-meta {
  color: var(--color-muted);
  margin-bottom: 20px;
}
.detail-description {
  background: var(--color-surface);
  padding: 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
  white-space: pre-line;
}

/* Reviews */
.review-item {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.review-item .review-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.review-item .reviewer {
  font-weight: 600;
  color: var(--color-navy);
}
.review-item .review-date {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.star-picker {
  display: flex;
  gap: 4px;
  font-size: 1.6rem;
  cursor: pointer;
  color: #d3d7de;
  margin-bottom: 12px;
}
.star-picker span.selected, .star-picker span:hover, .star-picker span.hovered {
  color: var(--color-gold);
}

/* Forms */
.form-card {
  background: var(--color-surface);
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 620px;
  margin: 0 auto;
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: var(--color-navy);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}
.form-group textarea {
  min-height: 110px;
  resize: vertical;
}
.form-hint {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 4px;
}
.form-error {
  color: var(--color-accent);
  font-size: 0.85rem;
  margin-top: 4px;
}
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}
.alert-success {
  background: #e5f4ec;
  color: #1e6b42;
  border: 1px solid #bfe3cd;
}
.alert-error {
  background: #fbe9ea;
  color: #8c1c26;
  border: 1px solid #f2c1c6;
}

.file-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.file-preview-grid img {
  border-radius: 6px;
  aspect-ratio: 1;
  object-fit: cover;
}

/* Footer */
.site-footer {
  background: var(--color-navy-dark);
  color: #c8d1e0;
  padding: 40px 0 24px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
.footer-grid h4 {
  color: #fff;
  margin-top: 0;
}
.footer-grid a {
  color: #c8d1e0;
}
.footer-bottom {
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 18px;
  font-size: 0.82rem;
}

/* Tables (admin) */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}
table.data-table th, table.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}
table.data-table th {
  background: var(--color-navy);
  color: #fff;
  font-weight: 600;
}
table.data-table tr:last-child td {
  border-bottom: none;
}
table.data-table tr:hover td {
  background: #f5f7fa;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-muted);
}
.status-pill.NEW { background: #a3182b; }
.status-pill.CONTACTED { background: #c9a227; color: #3a2c00; }
.status-pill.IN_PROGRESS { background: #2563eb; }
.status-pill.COMPLETED { background: #1e6b42; }
.status-pill.CLOSED { background: #6b7280; }

.admin-shell {
  display: flex;
  min-height: calc(100vh - 64px);
}
.admin-sidebar {
  width: 220px;
  background: var(--color-navy);
  color: #fff;
  padding: 20px 0;
  flex-shrink: 0;
}
.admin-sidebar a {
  display: block;
  padding: 12px 22px;
  color: #dfe6f2;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
}
.admin-content {
  flex: 1;
  padding: 30px;
  max-width: 1100px;
}
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 43, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 200;
}
.modal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 26px;
  max-width: 640px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-card h2 {
  margin-top: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.image-manager {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.image-manager .img-item {
  position: relative;
}
.image-manager img {
  border-radius: 6px;
  aspect-ratio: 1;
  object-fit: cover;
}
.image-manager .img-item button[data-action="delete-image"] {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(163, 24, 43, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
}
.pagination button {
  border: 1px solid var(--color-border);
  background: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.pagination button.active {
  background: var(--color-navy);
  color: #fff;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 40px 0;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
}
.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-navy);
}
.stat-card .label {
  color: var(--color-muted);
  font-size: 0.86rem;
}

.license-strip {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.license-strip img {
  max-width: 220px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
}
.license-images {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.license-images img {
  cursor: zoom-in;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.license-images img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 43, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 300;
  cursor: zoom-out;
}
.lightbox-overlay.active {
  display: flex;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 780px) {
  .detail-gallery {
    grid-template-columns: 1fr;
  }
  .admin-shell {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    display: flex;
    overflow-x: auto;
    padding: 10px;
  }
  .admin-sidebar a {
    padding: 10px 16px;
    white-space: nowrap;
  }
}
