/* ============================================================
   HandyMan SA — Main Stylesheet
   ============================================================ */

:root {
  --primary:    #1a56db;
  --primary-dk: #1341b2;
  --accent:     #f97316;
  --accent-dk:  #ea6c0e;
  --dark:       #111827;
  --grey:       #6b7280;
  --light:      #f9fafb;
  --border:     #e5e7eb;
  --success:    #10b981;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:  0 10px 25px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--dark); background: #fff; line-height: 1.6; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1.4rem; border-radius: var(--radius); font-weight: 600;
  font-size: .9rem; cursor: pointer; border: none; transition: all .2s;
  text-decoration: none !important; line-height: 1.4;
}
.btn-primary   { background: var(--primary);   color: #fff; }
.btn-primary:hover { background: var(--primary-dk); }
.btn-accent    { background: var(--accent);    color: #fff; }
.btn-accent:hover  { background: var(--accent-dk); }
.btn-outline   { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-sm        { padding: .35rem .9rem; font-size: .82rem; }
.btn-lg        { padding: .9rem 2rem; font-size: 1rem; }
.btn-block     { width: 100%; }
.btn:disabled  { opacity: .55; cursor: not-allowed; }

/* ---- Navbar ----------------------------------------------- */
.navbar {
  position: sticky; top: 0; z-index: 1000; background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 1.5rem;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  font-size: 1.3rem; font-weight: 800; color: var(--primary); text-decoration: none;
  display: flex; align-items: center; gap: .5rem;
}
.navbar-brand span { color: var(--accent); }
.nav-links { display: flex; gap: 1.5rem; list-style: none; align-items: center; }
.nav-links a { color: var(--grey); font-weight: 500; transition: color .2s; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); text-decoration: none; }
.nav-links a.btn { color: #fff !important; }
.nav-links a.btn-outline { color: var(--primary) !important; }
.nav-links a.btn-outline:hover { color: #fff !important; }
.nav-links .btn { padding: .45rem 1.1rem; }
.hamburger { display: none; background: none; border: none; cursor: pointer; font-size: 1.4rem; }

/* ---- Hero -------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, #1a56db 0%, #1341b2 60%, #0f2d80 100%);
  color: #fff; padding: 6rem 1.5rem; text-align: center;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.2; margin-bottom: 1.2rem; }
.hero h1 span { color: #fbbf24; }
.hero p { font-size: 1.15rem; opacity: .9; max-width: 600px; margin: 0 auto 2rem; }
.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-btns .btn-outline { border-color: rgba(255,255,255,.7); color: #fff; }
.hero-btns .btn-outline:hover { background: rgba(255,255,255,.15); }

/* ---- Search bar ------------------------------------------- */
.search-bar {
  background: #fff; border-radius: 50px; padding: .5rem .5rem .5rem 1.2rem;
  display: flex; align-items: center; gap: .5rem; box-shadow: var(--shadow-lg);
  max-width: 600px; margin: 0 auto;
}
.search-bar input {
  flex: 1; border: none; outline: none; font-size: 1rem; background: transparent;
}
.search-bar select {
  border: none; outline: none; background: transparent; font-size: .9rem; color: var(--grey);
  padding: 0 .5rem; cursor: pointer;
}
.search-bar .btn { border-radius: 40px; white-space: nowrap; }

/* ---- Section layout --------------------------------------- */
.section { padding: 5rem 1.5rem; }
.section-sm { padding: 3rem 1.5rem; }
.container { max-width: 1200px; margin: 0 auto; }
.section-title { text-align: center; margin-bottom: 3rem; }
.section-title h2 { font-size: 2rem; font-weight: 800; color: var(--dark); }
.section-title p  { color: var(--grey); margin-top: .5rem; font-size: 1.05rem; }

/* ---- Cards ------------------------------------------------ */
.card {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-body { padding: 1.5rem; }
.card-img { width: 100%; height: 180px; object-fit: cover; }

/* Artisan card */
.artisan-card { display: flex; flex-direction: column; }
.artisan-card-header { padding: 1.2rem; display: flex; gap: .9rem; align-items: flex-start; }
.artisan-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--border); }
.artisan-info h3 { font-size: 1rem; font-weight: 700; margin-bottom: .15rem; }
.artisan-trade { color: var(--primary); font-size: .82rem; font-weight: 600; }
.artisan-loc   { color: var(--grey); font-size: .8rem; margin-top: .15rem; }
.artisan-card-footer { padding: .6rem 1.2rem; border-top: 1px solid var(--border); background: var(--light); display: flex; gap: .5rem; align-items: center; justify-content: space-between; }

/* ---- Star ratings ----------------------------------------- */
.stars { color: #f59e0b; font-size: .8rem; letter-spacing: .5px; }
.rating-text { font-size: .75rem; color: var(--grey); }

/* ---- Badges ----------------------------------------------- */
.badge {
  display: inline-block; padding: .25rem .6rem; border-radius: 50px;
  font-size: .75rem; font-weight: 600; text-transform: capitalize;
}
.badge-open       { background: #e0f2fe; color: #0369a1; }
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-accepted   { background: #d1fae5; color: #065f46; }
.badge-in_progress{ background: #dbeafe; color: #1e40af; }
.badge-completed  { background: #ecfdf5; color: #064e3b; }
.badge-cancelled  { background: #f3f4f6; color: #374151; }
.badge-declined   { background: #fee2e2; color: #991b1b; }
.badge-disputed   { background: #fde8d8; color: #9a3412; }
.badge-paid       { background: #d1fae5; color: #065f46; }
.badge-unpaid     { background: #fee2e2; color: #991b1b; }
.badge-requested  { background: #fef3c7; color: #92400e; animation: pulse 1.5s infinite; }
.badge-info       { background: #dbeafe; color: #1e40af; }
.badge-verified   { background: #d1fae5; color: #065f46; }

/* ---- Forms ------------------------------------------------ */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .4rem; font-size: .9rem; }
.form-control {
  width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .95rem; transition: border .2s;
  outline: none; background: #fff;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); box-shadow: 0 0 0 3px rgba(5,150,105,.1); }
.invalid-feedback { font-size: .82rem; margin-top: .3rem; display: none; color: var(--danger); }
.is-invalid + .invalid-feedback { display: block; }
.is-valid   + .invalid-feedback { display: block; color: var(--success); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ---- Auth pages ------------------------------------------- */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--light); padding: 2rem 1rem; }
.auth-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; padding: 2.5rem; }
.auth-logo { text-align: center; font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 1.5rem; }
.auth-logo span { color: var(--accent); }

/* ---- Sidebar layout --------------------------------------- */
.dashboard-layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: 260px; flex-shrink: 0; background: var(--dark); color: #fff;
  padding: 1.5rem 0; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: .8rem; padding: .75rem 1.5rem;
  color: #9ca3af; font-weight: 500; transition: all .2s; text-decoration: none;
}
.sidebar-nav li a:hover, .sidebar-nav li a.active {
  color: #fff; background: rgba(255,255,255,.08); border-left: 3px solid var(--accent);
}
.sidebar-divider { border-top: 1px solid rgba(255,255,255,.1); margin: .75rem 1rem; }
.sidebar-label { font-size: .7rem; text-transform: uppercase; letter-spacing: 1px; color: #6b7280; padding: .75rem 1.5rem .25rem; font-weight: 700; }
.main-content { flex: 1; padding: 2rem; min-width: 0; }

/* ---- Stats cards ------------------------------------------ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; color: var(--dark); }
.stat-card .stat-label { color: var(--grey); font-size: .85rem; margin-top: .25rem; }
.stat-card .stat-icon  { font-size: 2rem; margin-bottom: .5rem; }

/* ---- Tables ----------------------------------------------- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--light); font-weight: 700; color: var(--grey); text-align: left; padding: .75rem 1rem; border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f9fafb; }

/* ---- Map -------------------------------------------------- */
#map { height: 500px; border-radius: var(--radius); }

/* ---- Job status tracker ----------------------------------- */
.status-track { display: flex; gap: 0; position: relative; }
.status-track::before { content: ''; position: absolute; top: 14px; left: 14px; right: 14px; height: 2px; background: var(--border); z-index: 0; }
.step { flex: 1; text-align: center; position: relative; z-index: 1; }
.step-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--border); margin: 0 auto .5rem; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; }
.step-label { font-size: .75rem; color: var(--grey); }
.step.done .step-dot   { background: var(--success); color: #fff; }
.step.active .step-dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(26,86,219,.2); }

/* ---- Alerts ----------------------------------------------- */
.alert { padding: .9rem 1.2rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; border-left: 4px solid transparent; }
.alert-success { background: #ecfdf5; border-color: var(--success); color: #065f46; }
.alert-error   { background: #fee2e2; border-color: var(--danger);  color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info    { background: #eff6ff; border-color: var(--primary); color: #1e40af; }

/* ---- Loading / spinner ------------------------------------ */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- How it works ----------------------------------------- */
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2rem; }
.how-item { text-align: center; padding: 1.5rem; }
.how-icon { width: 72px; height: 72px; border-radius: 50%; background: rgba(26,86,219,.1); margin: 0 auto 1rem; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.how-item h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: .5rem; }
.how-item p  { color: var(--grey); font-size: .9rem; }

/* ---- Artisan grid ----------------------------------------- */
.artisan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

/* ---- Pagination ------------------------------------------- */
.pagination { display: flex; gap: .5rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.page-btn { padding: .45rem .85rem; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: .88rem; background: #fff; transition: all .2s; }
.page-btn:hover   { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.active  { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled{ opacity: .4; cursor: not-allowed; }

/* ---- Toast notifications ---------------------------------- */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .75rem; }
.toast { background: #1f2937; color: #fff; padding: .9rem 1.4rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: .9rem; animation: slideIn .3s ease; min-width: 250px; max-width: 380px; display: flex; align-items: center; gap: .75rem; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.info    { border-left: 4px solid var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(249,115,22,.5); } 50% { box-shadow: 0 0 0 6px rgba(249,115,22,0); } }

/* ---- Footer ----------------------------------------------- */
.footer { background: var(--dark); color: #9ca3af; padding: 3rem 1.5rem 2rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; max-width: 1200px; margin: 0 auto; }
.footer-brand { font-size: 1.3rem; font-weight: 800; color: #fff; margin-bottom: .75rem; }
.footer-brand span { color: var(--accent); }
.footer h4 { color: #fff; font-size: .9rem; font-weight: 700; margin-bottom: .75rem; text-transform: uppercase; letter-spacing: .5px; }
.footer ul { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.footer a { color: #9ca3af; font-size: .88rem; transition: color .2s; }
.footer a:hover { color: #fff; text-decoration: none; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.5rem; margin-top: 2rem; text-align: center; font-size: .85rem; max-width: 1200px; margin-left: auto; margin-right: auto; }

/* ---- Responsive ------------------------------------------- */
@media (max-width: 900px) {
  .dashboard-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; top: 0; }
  .sidebar-nav { display: flex; overflow-x: auto; padding: 0 1rem; }
  .sidebar-nav li a { padding: .75rem 1rem; white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .sidebar-nav li a.active { border-bottom-color: var(--accent); background: transparent; color: #fff; }
}
@media (max-width: 768px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: #fff; padding: 1rem; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .nav-links.open { display: flex; }
  .hamburger { display: block; }
  #map { height: 300px; }
  .hero { padding: 4rem 1rem; }
  .browse-layout { flex-direction: column; }
}
@media (max-width: 480px) {
  .auth-card { padding: 1.5rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
