/* ========================================================
   Sri Krishna Energies - Solar CRM
   Enterprise UI Design System & Modern Typography
   ======================================================== */

:root {
  --primary: #F59E0B;
  --primary-hover: #D97706;
  --primary-light: #FEF3C7;
  --secondary: #E11D48;
  --secondary-hover: #BE185D;
  --secondary-light: #FFE4E6;
  --dark: #0F172A;
  --dark-surface: #1E293B;
  --light-bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --success: #10B981;
  --success-light: #D1FAE5;
  --info: #0284C7;
  --info-light: #E0F2FE;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--light-bg);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  line-height: 1.5;
  font-size: 0.9rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, .brand-text h1, .page-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  letter-spacing: -0.025em;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

/* Header & Navigation Bar */
.navbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  width: 100%;
}

.nav-container {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0.65rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  height: 44px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-text .company-sub {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 0.75rem;
  color: #475569;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease-in-out;
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover {
  background: #F1F5F9;
  color: var(--dark);
}

.nav-link.active {
  background: var(--primary-light);
  color: #92400E;
  font-weight: 700;
}

.nav-badge {
  background: var(--secondary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.2;
}

/* Nav Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  padding: 6px;
  z-index: 1000;
  margin-top: 6px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.active .nav-dropdown-menu {
  display: block;
  animation: dropdownFade 0.15s ease-out;
}

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

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.55rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.dropdown-link:hover {
  background: #F1F5F9;
  color: var(--dark);
}

.dropdown-link.active {
  background: var(--primary-light);
  color: #92400E;
  font-weight: 700;
}

/* Main Container - Full Fluid Fit without Right Gap */
.main-wrapper {
  width: 100%;
  max-width: 1600px;
  margin: 1.75rem auto 3.5rem;
  padding: 0 2rem;
  flex: 1;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.55rem 1.15rem;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #D97706, #B45309);
  color: #FFFFFF;
}

.btn-secondary {
  background: linear-gradient(135deg, #E11D48, #BE185D);
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(225, 29, 72, 0.25);
}
.btn-secondary:hover {
  background: linear-gradient(135deg, #BE185D, #9F1239);
  color: #FFFFFF;
}

.btn-dark {
  background: var(--dark);
  color: #FFFFFF;
}
.btn-dark:hover {
  background: var(--dark-surface);
}

.btn-outline {
  background: #FFFFFF;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
}

.btn-whatsapp {
  background: #25D366;
  color: white;
}
.btn-whatsapp:hover {
  background: #1EBE5D;
  color: white;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* Cards & Statistics */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
  width: 100%;
}

.stat-card {
  background: #FFFFFF;
  padding: 1.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.warning::after { background: var(--primary); }
.stat-card.danger::after { background: var(--secondary); }
.stat-card.success::after { background: var(--success); }
.stat-card.info::after { background: var(--info); }

.stat-content .stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-content .stat-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--dark);
  margin-top: 4px;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.warning { background: #FEF3C7; color: #D97706; }
.stat-icon.danger { background: #FFE4E6; color: #E11D48; }
.stat-icon.success { background: #D1FAE5; color: #059669; }
.stat-icon.info { background: #E0F2FE; color: #0284C7; }

/* Cards */
.card {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.75rem;
  width: 100%;
}

.card-header {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 1.35rem;
}

/* Tables & Wrappers */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.86rem;
}

.table th {
  background: #F8FAFC;
  color: #475569;
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
}

.table tr:hover {
  background: #FBFDFF;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-info { background: #E0F2FE; color: #075985; }
.badge-danger { background: #FFE4E6; color: #9F1239; }
.badge-secondary { background: #F1F5F9; color: #475569; }

/* 8-Stage Milestone Pipeline Tracker */
.pipeline-container {
  display: flex;
  align-items: flex-start;
  position: relative;
  overflow-x: auto;
  padding: 1.5rem 0.5rem 1rem;
  margin: 1.5rem 0;
  width: 100%;
}

.pipeline-step {
  flex: 1;
  min-width: 135px;
  text-align: center;
  position: relative;
  padding: 0 6px;
}

.pipeline-step::after {
  content: '';
  position: absolute;
  top: 24px;
  left: 50%;
  width: 100%;
  height: 4px;
  background: #E2E8F0;
  z-index: 1;
}

.pipeline-step:last-child::after {
  display: none;
}

.pipeline-step.completed::after {
  background: #10B981;
}

.pipeline-step.active::after {
  background: linear-gradient(to right, #10B981 50%, #E2E8F0 50%);
}

.step-node {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 3px solid #CBD5E1;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  position: relative;
  z-index: 2;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.pipeline-step.completed .step-node {
  background: #10B981;
  border-color: #10B981;
  color: #FFFFFF;
}

.pipeline-step.active .step-node {
  background: #F59E0B;
  border-color: #F59E0B;
  color: #FFFFFF;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.25);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.step-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
}

.step-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  animation: modal-up 0.2s ease-out;
}

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

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-close:hover { color: var(--dark); }

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #F8FAFC;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

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

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.95rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--dark);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* Alert / Flash */
.alert {
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger { background: #FFE4E6; color: #9F1239; border: 1px solid #FECDD3; }
.alert-info { background: #E0F2FE; color: #0369A1; border: 1px solid #BAE6FD; }

/* Responsive & Mobile Drawer */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.35rem;
  color: var(--dark);
  cursor: pointer;
  padding: 6px;
}

@media (max-width: 1024px) {
  .nav-container {
    padding: 0.65rem 1.25rem;
  }
  .main-wrapper {
    padding: 0 1.25rem;
  }
}

@media (max-width: 992px) {
  .mobile-toggle {
    display: block;
  }
  .nav-container {
    flex-wrap: wrap;
    gap: 10px;
  }
  .nav-menu {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 3;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    gap: 2px;
  }
  .nav-menu.active {
    display: flex;
  }
  .nav-link {
    width: 100%;
    padding: 0.65rem 0.85rem;
  }
  .nav-dropdown-menu {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    background: #F8FAFC;
    padding-left: 1.5rem;
    margin-top: 0;
  }
  .nav-dropdown.active .nav-dropdown-menu {
    display: block;
  }
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr !important;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .pipeline-container {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .page-title {
    font-size: 1.3rem;
  }
  .main-wrapper {
    padding: 0 1rem;
  }
  .nav-container {
    padding: 0.5rem 1rem;
  }
}

/* Print styling */
@media print {
  body { background: white !important; color: black !important; }
  .navbar, .btn, .no-print { display: none !important; }
  .main-wrapper { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
  .card { border: none !important; box-shadow: none !important; }
}
