/* ==========================================
   Donnie Real Estate Portal – Main Stylesheet
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Reset & Variables --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #1a365d;
  --navy-dark:  #0f2240;
  --navy-light: #2a4a7f;
  --gold:       #c9a84c;
  --gold-light: #e8c96f;
  --bg:         #f0f4f8;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --muted:      #64748b;
  --success:    #22c55e;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --info:       #3b82f6;
  --sidebar-w:  260px;
  --radius:     10px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
  --transition: all .2s ease;
}

html, body { height: 100%; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }

/* --- Typography --- */
h1,h2,h3,h4,h5,h6 { font-weight: 600; line-height: 1.3; color: var(--navy); }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

/* --- Layout --- */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .logo-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  display: block;
}
.sidebar-logo .logo-sub {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,.08);
  border-left-color: var(--gold);
}
.sidebar-nav a svg { flex-shrink: 0; opacity: .7; }
.sidebar-nav a:hover svg, .sidebar-nav a.active svg { opacity: 1; }

.sidebar-nav .nav-section {
  padding: 12px 20px 4px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer a {
  color: rgba(255,255,255,.6);
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-footer a:hover { color: var(--gold); }
.sidebar-user {
  color: #fff;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 1.05rem; font-weight: 600; color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-body { padding: 32px; flex: 1; }

/* --- Cards --- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fbfcfe;
}
.card-body { padding: 24px; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--navy); }

/* --- Stat Cards --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue  { background: #eff6ff; color: var(--info); }
.stat-icon.green { background: #f0fdf4; color: var(--success); }
.stat-icon.gold  { background: #fffbeb; color: var(--warning); }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* --- Tables --- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #f8fafc;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
td { padding: 13px 16px; font-size: .9rem; vertical-align: middle; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border: none; border-radius: 7px;
  font-size: .875rem; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--navy);    color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger);  color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--border);  color: var(--text); }
.btn-gold      { background: var(--gold);    color: var(--navy); font-weight: 700; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-outline { background: transparent; border: 1.5px solid var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }

/* --- Forms --- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 500; font-size: .875rem; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(26,54,93,.12); }
.form-control.error { border-color: var(--danger); }
.form-hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
textarea.form-control { min-height: 90px; resize: vertical; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; max-height: 180px; overflow-y: auto; border: 1.5px solid var(--border); border-radius: 7px; padding: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; padding: 4px 8px; border-radius: 5px; transition: var(--transition); }
.checkbox-label:hover { background: var(--bg); }
.checkbox-label input { accent-color: var(--navy); width: 15px; height: 15px; }

.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: #fafbfc;
}
.file-upload-area:hover, .file-upload-area.dragover { border-color: var(--navy); background: #eff6ff; }
.file-upload-area p { color: var(--muted); font-size: .875rem; margin-top: 8px; }
.file-upload-area input[type=file] { display: none; }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
}
.badge-navy    { background: #eff6ff; color: var(--navy); }
.badge-success { background: #f0fdf4; color: #15803d; }
.badge-danger  { background: #fef2f2; color: #dc2626; }
.badge-gold    { background: #fffbeb; color: #b45309; }
.badge-muted   { background: #f1f5f9; color: var(--muted); }

/* --- Alerts / Flash Messages --- */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .9rem;
}
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* --- Document cards (user portal) --- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.doc-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.doc-icon { font-size: 2rem; }
.doc-name { font-weight: 600; font-size: .9rem; word-break: break-word; }
.doc-meta { font-size: .78rem; color: var(--muted); }

/* --- Project cards (user portal) --- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.project-card-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: 24px 20px;
  color: #fff;
}
.project-card-header h3 { color: #fff; font-size: 1rem; }
.project-card-header .address { color: rgba(255,255,255,.7); font-size: .82rem; margin-top: 4px; }
.project-card-body { padding: 16px 20px; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.project-card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: #f8fafc; }

/* --- Notifications --- */
.notif-item {
  display: flex;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #eff6ff; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); flex-shrink: 0; margin-top: 7px; }
.notif-text { font-size: .9rem; }
.notif-time { font-size: .78rem; color: var(--muted); margin-top: 3px; }

/* --- Section tabs (project detail) --- */
.section-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.section-tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: .9rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.section-tab.active { color: var(--navy); border-bottom-color: var(--navy); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Auth pages (login / set-password) --- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  padding: 20px;
}
.auth-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-text { font-size: 1.5rem; font-weight: 800; color: var(--navy); letter-spacing: -.01em; }
.auth-logo .logo-sub { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.auth-title { font-size: 1.2rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.auth-subtitle { font-size: .875rem; color: var(--muted); margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: .85rem; color: var(--muted); }

/* --- Page header row --- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.breadcrumb { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--navy); }
.breadcrumb-sep { opacity: .4; }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state svg { opacity: .25; margin-bottom: 16px; }
.empty-state h3 { color: var(--muted); font-weight: 500; }
.empty-state p { color: var(--muted); font-size: .9rem; margin-top: 6px; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page-body { padding: 16px; }
  .auth-card { padding: 30px 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
