/* Bubabio - Bioconstruction Wall Tracker */
/* Green theme matching the Next.js version */

:root {
  --primary: #42a762;
  --primary-dark: #166534;
  --primary-light: #f0fdf4;
  --primary-border: #bbf7d0;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --destructive: #dc2626;
  --destructive-light: #fef2f2;
  --accent: #f3f4f6;
  --radius: 0.5rem;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* --- Layout --- */
.container { max-width: 56rem; margin: 0 auto; padding: 0 1rem; }

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
  gap: 1rem;
}

.logo {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--primary);
  text-decoration: none;
}

nav { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; }
nav a { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
nav a:hover { color: var(--text); }

main { padding: 2rem 0; }
main .container { display: flex; flex-direction: column; gap: 1.5rem; }

/* --- Typography --- */
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 600; }
.subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.25;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: #3a9457; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--accent); }

.btn-danger {
  background: transparent;
  color: var(--destructive);
  border-color: var(--border);
  font-size: 0.75rem;
}
.btn-danger:hover { background: var(--destructive-light); }

.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.75rem; }

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.75rem;
  text-decoration: none;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }

.btn-link-danger { color: var(--destructive); }

.btn-dashed {
  width: 100%;
  padding: 0.5rem;
  border: 2px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}
.btn-dashed:hover { color: var(--text); border-color: var(--primary); }

.btn-lang {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-lang:hover { background: var(--accent); }

/* --- Forms --- */
.form-group { display: flex; flex-direction: column; gap: 0.25rem; }
.form-group label { font-size: 0.875rem; font-weight: 500; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(66, 167, 98, 0.2);
}

input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.checkbox-group { display: flex; gap: 1rem; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.checkbox-label.disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* --- Auth pages --- */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.auth-card {
  max-width: 24rem;
  width: 100%;
}

.auth-card .card { display: flex; flex-direction: column; gap: 1.5rem; }
.auth-card .auth-header { text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 1rem; }
.auth-footer { text-align: center; font-size: 0.875rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

/* --- Project list --- */
.project-header { display: flex; align-items: center; justify-content: space-between; }
.project-card { display: flex; justify-content: space-between; align-items: center; }
.project-card .project-info { flex: 1; }
.project-card .project-info a { text-decoration: none; color: var(--text); font-weight: 500; }
.project-card .project-info a:hover { color: var(--primary); }
.project-card .project-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.project-actions { display: flex; gap: 0.5rem; align-items: center; }

.create-form { display: flex; gap: 0.5rem; }
.create-form input { flex: 1; }

/* --- Wall entries --- */
.wall-card { display: flex; flex-direction: column; gap: 0.5rem; }
.wall-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.wall-info .wall-label { font-weight: 500; font-size: 0.875rem; }
.wall-info .wall-meta { font-size: 0.875rem; color: var(--text-muted); }
.wall-info .wall-openings { font-size: 0.75rem; color: var(--text-muted); }
.wall-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.wall-breakdown {
  background: var(--accent);
  border-radius: var(--radius);
  padding: 0.5rem;
  font-size: 0.875rem;
}
.wall-breakdown .bd-row { display: flex; justify-content: space-between; padding: 0.125rem 0; }
.wall-breakdown .bd-row.bd-total { font-weight: 600; border-top: 1px solid var(--border); padding-top: 0.25rem; margin-top: 0.25rem; }
.bd-label { color: var(--text-muted); }

/* --- Wall form --- */
.wall-form { display: flex; flex-direction: column; gap: 1rem; }
.wall-form .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.wall-form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* --- Openings --- */
.openings-section { border-top: 1px solid var(--border); padding-top: 0.75rem; margin-top: 0.5rem; }
.opening-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.875rem; padding: 0.25rem 0; }
.opening-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 0.5rem; align-items: end; }

/* --- Summary --- */
.summary-card { background: var(--primary-light); border-color: var(--primary-border); }
.summary-card h2 { margin-bottom: 0.5rem; }
.summary-row { display: flex; justify-content: space-between; padding: 0.25rem 0; font-size: 0.875rem; }
.summary-row.grand {
  font-weight: 700;
  font-size: 1rem;
  border-top: 2px solid var(--primary-dark);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}
.summary-section { margin-top: 1rem; }
.summary-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* --- Pricing form --- */
.pricing-section { display: flex; flex-direction: column; gap: 0.75rem; }
.pricing-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pricing-row label { font-size: 0.875rem; flex: 1; }
.pricing-row input { max-width: 8rem; text-align: right; }

/* --- Account form --- */
.account-section { display: flex; flex-direction: column; gap: 1rem; }

/* --- Messages --- */
.msg { padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 0.5rem; }
.msg-error { background: var(--destructive-light); color: var(--destructive); border: 1px solid #fecaca; }
.msg-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* --- Empty states --- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state p:first-child { font-size: 1rem; }
.empty-state p:last-child { font-size: 0.875rem; margin-top: 0.25rem; }

/* --- Misc --- */
.space-y > * + * { margin-top: 0.75rem; }
.space-y-lg > * + * { margin-top: 1.5rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 0.5rem; }
.hidden { display: none; }
.w-full { width: 100%; }
.max-w-lg { max-width: 32rem; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .wall-form .grid-2 { grid-template-columns: 1fr; }
  .opening-form { grid-template-columns: 1fr 1fr; }
  .opening-form .btn { grid-column: span 2; }
  .create-form { flex-direction: column; }
  nav { gap: 0.5rem; font-size: 0.75rem; }
}
