/* Splash Leads CRM - Mobile-First Professional Dashboard */

:root {
  --primary: #06b6d4;
  --primary-dark: #0891b2;
  --status-new: #f59e0b;
  --status-contacted: #06b6d4;
  --status-quoted: #a855f7;
  --status-booked: #10b981;
  --status-won: #22c55e;
  --status-lost: #ef4444;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1f2937;
  --bg-elevated: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --border-light: #475569;
}

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

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

/* =====================================================
   NAVIGATION - Mobile First
   ===================================================== */
.nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 8px;
}

.nav-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.nav-brand span {
  color: var(--text-primary);
}

.nav-links {
  display: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-right .btn {
  padding: 8px 12px;
  font-size: 12px;
}

/* Desktop nav */
@media (min-width: 768px) {
  .nav {
    padding: 0 24px;
  }

  .nav-brand {
    font-size: 18px;
  }

  .nav-links {
    display: flex;
    gap: 4px;
    margin-left: 32px;
  }

  .nav-right .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-link:hover,
.nav-link.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* =====================================================
   LAYOUT - Mobile First
   ===================================================== */
.main {
  padding: 16px 12px;
}

@media (min-width: 768px) {
  .main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 24px;
  }
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }
}

.page-title {
  font-size: 20px;
  font-weight: 600;
}

@media (min-width: 768px) {
  .page-title {
    font-size: 22px;
  }
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

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

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 480px) {
  .card-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
  }
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-body {
  padding: 14px;
}

@media (min-width: 768px) {
  .card-body {
    padding: 18px;
  }
}

/* =====================================================
   STATS GRID - Mobile First
   ===================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

@media (min-width: 992px) {
  .stats-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 20px;
  }
}

.stat-card {
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  padding: 12px;
}

@media (min-width: 768px) {
  .stat-card {
    padding: 16px;
  }
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (min-width: 768px) {
  .stat-label {
    font-size: 12px;
    margin-bottom: 6px;
  }
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

@media (min-width: 768px) {
  .stat-value {
    font-size: 28px;
  }
}

.stat-value.new { color: var(--status-new); }
.stat-value.contacted { color: var(--status-contacted); }
.stat-value.quoted { color: var(--status-quoted); }
.stat-value.booked { color: var(--status-booked); }
.stat-value.won { color: var(--status-won); }

/* =====================================================
   STATUS TAGS
   ===================================================== */
.status-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

@media (min-width: 768px) {
  .status-tag {
    padding: 3px 10px;
    font-size: 11px;
  }
}

.status-tag.new { background: rgba(245, 158, 11, 0.15); color: var(--status-new); }
.status-tag.contacted { background: rgba(6, 182, 212, 0.15); color: var(--status-contacted); }
.status-tag.quoted { background: rgba(168, 85, 247, 0.15); color: var(--status-quoted); }
.status-tag.booked { background: rgba(16, 185, 129, 0.15); color: var(--status-booked); }
.status-tag.won { background: rgba(34, 197, 94, 0.15); color: var(--status-won); }
.status-tag.lost { background: rgba(239, 68, 68, 0.15); color: var(--status-lost); }

/* =====================================================
   PIPELINE KANBAN - Mobile First
   ===================================================== */
.pipeline-container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.pipeline-column {
  min-width: 85vw;
  max-width: 85vw;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 140px);
  scroll-snap-align: start;
  flex-shrink: 0;
}

@media (min-width: 480px) {
  .pipeline-column {
    min-width: 300px;
    max-width: 300px;
  }
}

@media (min-width: 768px) {
  .pipeline-column {
    min-width: 280px;
    max-width: 280px;
    max-height: calc(100vh - 160px);
  }
}

.column-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: 10px 10px 0 0;
}

.column-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.column-count {
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.column-body {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =====================================================
   LEAD CARDS - Mobile First
   ===================================================== */
.lead-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border-color);
}

.lead-card:hover {
  border-color: var(--primary);
  background: var(--bg-elevated);
}

.lead-card.dragging {
  opacity: 0.5;
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.lead-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.lead-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.lead-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.lead-detail-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.lead-detail-row svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.lead-detail-row.service {
  color: var(--primary);
  font-weight: 500;
}

.lead-detail-row.service svg {
  color: var(--primary);
}

.lead-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  gap: 10px;
}

.lead-source-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 0;
  flex: 1;
}

.lead-source-badge img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .lead-source-badge img {
    width: 48px;
    height: 48px;
  }
}

.lead-source-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--status-won);
  white-space: nowrap;
}

/* =====================================================
   SITE BADGES (for tables) - Mobile First
   ===================================================== */
.site-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.site-badge img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .site-badge {
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .site-badge img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
  }
}

/* =====================================================
   TABLES - Mobile First (Card Layout)
   ===================================================== */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

@media (min-width: 768px) {
  th, td {
    padding: 12px 14px;
  }
}

th {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

@media (min-width: 768px) {
  th {
    font-size: 11px;
  }
}

tbody tr {
  transition: background 0.1s;
}

tbody tr:hover td {
  background: var(--bg-secondary);
}

/* =====================================================
   FORMS - Mobile First
   ===================================================== */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px; /* Prevents zoom on iOS */
  transition: border-color 0.15s;
}

@media (min-width: 768px) {
  .form-control {
    padding: 9px 12px;
    font-size: 13px;
  }
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

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

/* =====================================================
   FILTERS - Mobile First
   ===================================================== */
.filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

@media (min-width: 480px) {
  .filters {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
  }
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-group select {
  flex: 1;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
}

@media (min-width: 768px) {
  .filter-group select {
    flex: none;
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* =====================================================
   SEARCH - Mobile First
   ===================================================== */
.search-box {
  position: relative;
  display: none;
}

@media (min-width: 768px) {
  .search-box {
    display: block;
  }
}

.search-box input {
  padding: 8px 12px 8px 32px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  width: 180px;
}

@media (min-width: 992px) {
  .search-box input {
    width: 220px;
  }
}

.search-box::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* =====================================================
   MODAL - Mobile First
   ===================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
  }
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

@media (min-width: 768px) {
  .modal {
    border-radius: 10px;
    max-width: 450px;
  }
}

.modal-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

@media (min-width: 768px) {
  .modal-close {
    font-size: 22px;
  }
}

.modal-body {
  padding: 18px;
}

.modal-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
}

.modal-footer .btn {
  flex: 1;
}

@media (min-width: 768px) {
  .modal-footer {
    justify-content: flex-end;
  }

  .modal-footer .btn {
    flex: none;
  }
}

/* =====================================================
   EMPTY & LOADING STATES
   ===================================================== */
.empty-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
}

.empty-state h3 {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 14px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: var(--text-muted);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
}

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

/* =====================================================
   MOBILE NAVIGATION MENU
   ===================================================== */
.mobile-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}

@media (min-width: 768px) {
  .mobile-nav {
    display: none;
  }
}

.mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
}

.mobile-nav a.active {
  color: var(--primary);
}

.mobile-nav svg {
  width: 24px;
  height: 24px;
}

/* Add bottom padding to main content for mobile nav */
@media (max-width: 767px) {
  body {
    padding-bottom: 70px;
  }
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */
.hide-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hide-mobile {
    display: block;
  }
}

.hide-desktop {
  display: block;
}

@media (min-width: 768px) {
  .hide-desktop {
    display: none;
  }
}
