/* ============================================================
   handyman-daniel.com — Main Stylesheet
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --secondary:     #f59e0b;
  --text:          #1f2937;
  --text-light:    #6b7280;
  --bg:            #ffffff;
  --bg-light:      #f9fafb;
  --border:        #e5e7eb;
  --success:       #10b981;
  --error:         #ef4444;
  --radius:        8px;
  --shadow:        0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --max-width:     1200px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Navigation ───────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  box-shadow: var(--shadow);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.nav-logo:hover {
  text-decoration: none;
  color: var(--primary-dark);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text);
  font-weight: 500;
  transition: color .15s;
}

.nav-links a:hover {
  color: var(--primary);
  text-decoration: none;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  padding: 5rem 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.2rem;
  opacity: .9;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  font-size: .95rem;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  line-height: 1.4;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: #ffffff;
  border-color: var(--secondary);
}

.btn-secondary:hover {
  background: #d97706;
  border-color: #d97706;
}

.btn-danger {
  background: var(--error);
  color: #ffffff;
  border-color: var(--error);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #ffffff;
}

.btn-sm {
  padding: .35rem .8rem;
  font-size: .825rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-body {
  padding: 1.25rem;
}

.card-body h3 {
  font-size: 1.1rem;
  margin-bottom: .4rem;
}

.card-body p {
  color: var(--text-light);
  font-size: .9rem;
}

/* ── Sections ─────────────────────────────────────────────── */
.section {
  padding: 3rem 0;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: .4rem;
  font-size: .9rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: .55rem .85rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.form-control::placeholder {
  color: var(--text-light);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ── Stars ────────────────────────────────────────────────── */
.stars {
  display: flex;
  align-items: center;
  gap: .1rem;
}

.star {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--border);
  transition: color .1s;
  user-select: none;
  line-height: 1;
}

.star.active,
.star:hover {
  color: var(--secondary);
}

/* ── Reviews ──────────────────────────────────────────────── */
.review {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .75rem;
}

.review-author {
  font-weight: 700;
  font-size: 1rem;
}

.review-date {
  font-size: .825rem;
  color: var(--text-light);
  white-space: nowrap;
}

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

.photo-upload-area:hover,
.photo-upload-area.dragover {
  border-color: var(--primary);
  background: rgba(37,99,235,.04);
  color: var(--primary);
}

.photo-upload-area p {
  margin: 0;
  font-size: .95rem;
}

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

.photo-preview {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

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

.photo-preview .remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s;
}

.photo-preview .remove-btn:hover {
  background: var(--error);
}

/* ── Gallery ──────────────────────────────────────────────── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.gallery img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: var(--radius);
  transition: opacity .2s;
}

.gallery img:hover {
  opacity: .88;
}

/* ── Toast Notifications ──────────────────────────────────── */
@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  padding: .85rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: .9rem;
  font-weight: 500;
  color: #ffffff;
  min-width: 220px;
  max-width: 340px;
  animation: slideIn .25s ease-out forwards;
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--error);   }
.toast-info    { background: var(--primary);  }

/* ── Admin Layout ─────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 56px);
}

.admin-sidebar {
  background: var(--bg-light);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
}

.admin-sidebar a {
  display: block;
  padding: .65rem 1.5rem;
  color: var(--text);
  font-weight: 500;
  font-size: .9rem;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.admin-sidebar a:hover {
  background: var(--border);
  color: var(--primary);
}

.admin-sidebar a.active {
  background: var(--primary);
  color: #ffffff;
}

.admin-content {
  padding: 2rem;
  overflow-x: auto;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ── Data Table ───────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-light);
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .05em;
}

.data-table tbody tr:hover {
  background: var(--bg-light);
}

.data-table td:last-child {
  white-space: nowrap;
}

/* ── Status Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-new        { background: #dbeafe; color: #1d4ed8; }
.badge-reviewed   { background: #fef3c7; color: #b45309; }
.badge-responded  { background: #d1fae5; color: #065f46; }

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  background: var(--bg-light);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-light);
  font-size: .875rem;
}

.footer a {
  color: var(--text-light);
}

.footer a:hover {
  color: var(--primary);
}

/* ── Loading ──────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-light);
  font-size: 1rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero {
    padding: 3rem 0;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    display: none;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .gallery img {
    height: 150px;
  }

  .nav-links {
    gap: .75rem;
  }

  .section-title {
    font-size: 1.5rem;
  }
}
