/* 
 * Lead Management System 
 * Main Stylesheet
 */

:root {
  --primary: #007bff;
  --secondary: #6c757d;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
  --light: #f8f9fa;
  --dark: #343a40;
  --primary-dark: #0056b3;
  --border-radius: 0.25rem;
  --transition-speed: 0.3s;
  --sidebar-width: 250px;
  --header-height: 60px;
  --footer-height: 60px;
}

/* ===== Base Styles ===== */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  transition: background-color 0.3s ease;
}

main {
  flex: 1;
  padding: 2rem 0;
}

/* ===== Layout Components ===== */

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  z-index: 100;
  padding: 0;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
  overflow-y: auto;
  transition: transform var(--transition-speed);
}

.sidebar .nav-link {
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  color: var(--bs-body-color);
  opacity: 0.75;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.sidebar .nav-link:hover {
  opacity: 1;
  background-color: rgba(var(--bs-primary-rgb), 0.1);
}

.sidebar .nav-link.active {
  opacity: 1;
  color: var(--bs-primary);
  background-color: rgba(var(--bs-primary-rgb), 0.15);
  border-left: 3px solid var(--bs-primary);
}

.sidebar .nav-link i {
  margin-right: 0.5rem;
  width: 24px;
  text-align: center;
}

.sidebar .nav-link .badge {
  margin-left: auto;
}

.sidebar-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  padding: 1rem 1.25rem;
  color: var(--bs-gray-600);
  font-weight: 600;
}

/* Collapsible sidebar for mobile */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .content-wrapper {
    margin-left: 0 !important;
  }
}

.content-wrapper {
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-speed);
}

/* ===== Header & Navigation ===== */
.navbar-brand {
  font-weight: 600;
  display: flex;
  align-items: center;
}

.navbar-brand img {
  margin-right: 0.5rem;
  height: 30px;
}

.navbar.main-header {
  height: var(--header-height);
}

.main-header .dropdown-toggle::after {
  display: none;
}

.main-header .user-dropdown {
  display: flex;
  align-items: center;
}

.main-header .user-dropdown img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 50%;
  margin-right: 0.5rem;
}

/* ===== Cards & Containers ===== */
.card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

.card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header i {
  margin-right: 0.5rem;
}

.card-header .card-tools {
  margin-left: auto;
}

/* ===== Tables ===== */
.table th {
  font-weight: 600;
  border-top: none;
}

.table-hover tbody tr {
  transition: background-color 0.2s ease;
}

.data-table thead th {
  background-color: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--bs-primary);
  border-bottom: none;
}

.data-table .actions {
  white-space: nowrap;
}

/* ===== Forms ===== */
.form-control:focus {
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.custom-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

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

.form-label {
  font-weight: 500;
}

.form-text {
  font-size: 0.85rem;
}

/* ===== Buttons ===== */
.btn {
  font-weight: 500;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon i {
  margin-right: 0.5rem;
}

.btn-icon.btn-sm i {
  margin-right: 0.3rem;
}

.btn-circle {
  width: 40px;
  height: 40px;
  padding: 6px 0;
  border-radius: 50%;
  text-align: center;
  line-height: 1.428571429;
}

.btn-circle.btn-sm {
  width: 30px;
  height: 30px;
  padding: 4px 0;
}

.btn-circle.btn-lg {
  width: 50px;
  height: 50px;
  padding: 10px 0;
}

/* ===== Badges & Labels ===== */
.badge {
  font-weight: 500;
}

.badge-outline-primary {
  background-color: transparent;
  border: 1px solid var(--bs-primary);
  color: var(--bs-primary);
}

.badge-outline-success {
  background-color: transparent;
  border: 1px solid var(--bs-success);
  color: var(--bs-success);
}

.badge-outline-danger {
  background-color: transparent;
  border: 1px solid var(--bs-danger);
  color: var(--bs-danger);
}

.badge-outline-warning {
  background-color: transparent;
  border: 1px solid var(--bs-warning);
  color: var(--bs-warning);
}

/* ===== Progress Bars ===== */
.progress {
  height: 0.75rem;
  margin-bottom: 1rem;
}

.progress-sm {
  height: 0.375rem;
}

/* ===== Alerts ===== */
.alert {
  display: flex;
  align-items: center;
}

.alert i {
  margin-right: 0.75rem;
  font-size: 1.25rem;
}

/* ===== Utilities ===== */
.cursor-pointer {
  cursor: pointer;
}

.rounded-lg {
  border-radius: 0.5rem !important;
}

.shadow-hover {
  transition: box-shadow 0.3s ease;
}

.shadow-hover:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* ===== Page Specific Styles ===== */

/* Dashboard */
.stat-card {
  position: relative;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: var(--border-radius);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.stat-card .stat-icon {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 2.5rem;
  opacity: 0.3;
  /* Prevent icon from being too large */
  max-width: 40%;
  overflow: hidden;
}

.stat-card .stat-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.stat-card .stat-description {
  font-size: 0.875rem;
  color: var(--bs-gray-600);
}

.stat-card .stat-content {
  position: relative;
  z-index: 1;
  padding-right: 40px; /* Give space for the icon */
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.login-card .card-title {
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo img {
  height: 60px;
}

/* User Management */
.user-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.user-card .card-header {
  background-color: transparent;
  border-bottom: none;
  padding-bottom: 0;
}

.user-card .user-avatar {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bs-primary);
}

.user-card .user-name {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.25rem;
}

.user-card .user-role {
  font-size: 0.875rem;
  color: var(--bs-gray-600);
  text-align: center;
  margin-bottom: 1rem;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.slide-up {
  animation: slideUp 0.5s ease-in-out;
}

/* ===== Print Styles ===== */
@media print {
  .sidebar, .main-header, .no-print {
    display: none !important;
  }
  
  .content-wrapper {
    margin-left: 0 !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #dee2e6;
  }
  
  .table {
    width: 100% !important;
  }
}

/* Dealer and Prospect specific styles */
.dealer-card, .prospect-card {
  transition: all 0.3s ease;
}

.dealer-card:hover, .prospect-card:hover {
  transform: translateY(-5px);
}

.matching-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.matching-indicator.matched {
  background-color: var(--bs-success);
}

.matching-indicator.unmatched {
  background-color: var(--bs-danger);
}

.matching-indicator.partial {
  background-color: var(--bs-warning);
}

/* Map view */
.map-container {
  height: 600px;
  width: 100%;
  border-radius: var(--border-radius);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  margin-bottom: 1.5rem;
}

.map-legend {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 10px;
  border-radius: var(--border-radius);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* File upload */
.dropzone {
  border: 2px dashed var(--bs-gray-400);
  border-radius: var(--border-radius);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--bs-primary);
  background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.dropzone .upload-icon {
  font-size: 3rem;
  color: var(--bs-gray-500);
  margin-bottom: 1rem;
}

.dropzone .upload-message {
  color: var(--bs-gray-600);
  margin-bottom: 1rem;
}

/* Email templates */
.email-template-preview {
  border: 1px solid var(--bs-gray-300);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Responsiveness */
@media (max-width: 768px) {
  .card-responsive {
    overflow-x: auto;
  }
  
  .hide-mobile {
    display: none;
  }
}