/* FormFound — App Styles */
/* Matches FormFound's warm, artisanal aesthetic: cream, charcoal, rust, sage */

:root {
  --warm: #f5f0eb;
  --charcoal: #1a1a1a;
  --rust: #b8652f;
  --sage: #7a8c6e;
  --cream: #faf8f5;
  --grain: #e8e0d5;
  --border: #d4cbc0;
}

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

body {
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.6;
}

/* Header / Nav */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-nav .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--rust);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--charcoal);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.nav-links a:hover { opacity: 1; }

/* Hero / Page header */
.page-hero {
  padding: 4rem 2rem 2rem;
  max-width: 760px;
  margin: 0 auto;
}

.page-hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.page-hero p {
  font-size: 1.0625rem;
  color: #555;
  max-width: 520px;
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* Section titles */
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 0.75rem;
}

/* Card */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

/* Form elements */
label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #444;
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

input, select, textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9375rem;
  background: var(--cream);
  color: var(--charcoal);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(184, 101, 47, 0.1);
}

textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row.three-col { grid-template-columns: 1fr 1fr 1fr; }
.form-row.two-col { grid-template-columns: 1fr 1fr; }
.form-row.four-col { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-group { margin-bottom: 1rem; }

select { cursor: pointer; }

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--rust);
  color: #fff;
}

.btn-primary:hover { background: #a05728; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--grain);
  color: var(--charcoal);
}

.btn-secondary:hover { background: #d8cfc4; }

.btn-ghost {
  background: transparent;
  color: var(--rust);
  padding: 0.5rem 1rem;
}

.btn-ghost:hover { background: var(--grain); }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Designs grid */
.designs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.design-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.design-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.design-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: var(--grain);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rust);
  font-size: 3rem;
}

.design-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.design-image-placeholder {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
  color: var(--rust);
  opacity: 0.4;
}

.design-body {
  padding: 1.5rem;
}

.design-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.design-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-type { background: var(--grain); color: #555; }
.badge-style { background: rgba(122, 140, 110, 0.15); color: var(--sage); }
.badge-difficulty-beginner { background: rgba(122, 140, 110, 0.2); color: var(--sage); }
.badge-difficulty-intermediate { background: rgba(184, 101, 47, 0.12); color: var(--rust); }
.badge-difficulty-advanced { background: rgba(26, 26, 26, 0.1); color: var(--charcoal); }

.design-description {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.utilization-bar {
  height: 6px;
  background: var(--grain);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.utilization-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.utilization-label {
  font-size: 0.75rem;
  color: #777;
}

/* Cut list */
.cut-list {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 1rem;
}

.cut-list-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 0.75rem;
}

.cut-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.cut-table th {
  text-align: left;
  color: #888;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cut-table td {
  padding: 0.5rem 0.5rem;
  color: #333;
}

.cut-table tr:last-child td { border-bottom: none; }
.cut-table tbody tr:hover { background: var(--warm); }

/* Fabrication notes */
.fab-notes {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--warm);
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #333;
}

/* Loading spinner */
.spinner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(250, 248, 245, 0.9);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}

.loading-overlay.active { display: flex; }

.loading-overlay .spinner-box {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  color: var(--charcoal);
}

.loading-overlay p {
  color: #666;
  font-size: 0.9375rem;
}

/* Photo upload */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--warm);
}

.photo-upload-area:hover {
  border-color: var(--rust);
  background: rgba(184, 101, 47, 0.04);
}

.photo-upload-area input[type="file"] { display: none; }

.upload-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.upload-text { font-size: 0.9rem; color: #666; }

.photo-previews {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.photo-preview {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview button {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
}

.tab {
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab.active {
  color: var(--charcoal);
  border-bottom-color: var(--rust);
}

.tab:hover:not(.active) { color: var(--charcoal); }

/* Status message */
.status-message {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.status-message.error {
  background: rgba(184, 101, 47, 0.1);
  color: var(--rust);
  border: 1px solid rgba(184, 101, 47, 0.2);
}

.status-message.success {
  background: rgba(122, 140, 110, 0.1);
  color: var(--sage);
  border: 1px solid rgba(122, 140, 110, 0.2);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #888;
}

.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state p { font-size: 0.9375rem; }

/* Alert / notice */
.notice {
  padding: 1rem 1.25rem;
  background: var(--warm);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  color: #555;
  margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .form-row.two-col, .form-row.four-col { grid-template-columns: 1fr; }
  .app-nav { padding: 1rem; }
  .container { padding: 0 1rem 3rem; }
  .card { padding: 1.25rem; }
  .designs-grid { grid-template-columns: 1fr; }
}