:root {
  --primary: #00bcd4; /* Cyan */
  --primary-dark: #0097a7;
  --bg-dark: #0a192f; /* Dark Blue */
  --bg-darker: #020c1b;
  --bg-card: #112240;
  --text-light: #ccd6f6;
  --text-muted: #8892b0;
  --accent: #64ffda;
  --danger: #ff4d4d;
  --success: #00e676;
  --warning: #ffea00;
  --border: #233554;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-light);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: var(--primary);
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent);
}

/* Base UI Elements */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background-color: var(--primary);
  color: var(--bg-darker);
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.install-prompt {
  background-color: var(--primary);
  color: var(--bg-dark);
  padding: 10px;
  text-align: center;
  display: none; /* managed by JS */
}

.btn:hover {
  background-color: var(--primary-dark);
  box-shadow: 0 0 10px var(--primary);
}

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

.btn-outline:hover {
  background-color: rgba(0, 188, 212, 0.1);
}

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

.btn-danger:hover {
  background-color: #d32f2f;
  box-shadow: 0 0 10px var(--danger);
}

.btn-success {
  background-color: var(--success);
  color: #000;
}

.btn-success:hover {
  background-color: #00c853;
  box-shadow: 0 0 10px var(--success);
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.85rem;
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 10px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-light);
  border-radius: 4px;
  transition: border-color 0.3s ease;
}

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

/* Landing Page Styles */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 50px;
  background-color: rgba(2, 12, 27, 0.8);
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.navbar .logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 20px;
}

.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  background: linear-gradient(to bottom, var(--bg-darker), var(--bg-dark));
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 20px;
  color: var(--text-light);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 30px;
}

.section {
  padding: 80px 50px;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 50px;
  color: var(--text-light);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.service-card {
  background-color: var(--bg-card);
  padding: 30px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.3s ease;
}

.service-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
}

.service-card h3 {
  margin-bottom: 15px;
  color: var(--accent);
}

/* Auth Page */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: var(--bg-darker);
}

.auth-box {
  background-color: var(--bg-card);
  padding: 40px;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.auth-box h2 {
  margin-bottom: 20px;
  text-align: center;
  color: var(--accent);
}

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-header h2 {
  color: var(--accent);
  font-size: 1.2rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.sidebar-nav a {
  padding: 15px 20px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  background-color: rgba(0, 188, 212, 0.1);
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

.main-content {
  flex-grow: 1;
  margin-left: 250px;
  padding: 30px;
  background-color: var(--bg-dark);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.stat-card .title {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.stat-card .value {
  color: var(--accent);
  font-size: 2rem;
  font-weight: bold;
}

/* Table CRM Layout */
.table-container {
  background-color: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

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

th {
  background-color: rgba(2, 12, 27, 0.5);
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
}

tbody tr:hover {
  background-color: rgba(0, 188, 212, 0.05);
}

/* Status Badges */
.badge {
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.status-new { background-color: rgba(0, 188, 212, 0.2); color: var(--primary); }
.status-called { background-color: rgba(136, 146, 176, 0.2); color: var(--text-light); }
.status-interested { background-color: rgba(100, 255, 218, 0.2); color: var(--accent); }
.status-hold { background-color: rgba(255, 234, 0, 0.2); color: var(--warning); }
.status-confirmed { background-color: rgba(0, 230, 118, 0.2); color: var(--success); }
.status-project-finalized { background-color: rgba(0, 188, 212, 0.3); color: #84ffff; border: 1px solid var(--primary); }
.status-project-completed { background-color: rgba(0, 230, 118, 0.3); color: #b9f6ca; border: 1px solid var(--success); }
.status-not-interested { background-color: rgba(255, 77, 77, 0.2); color: var(--danger); }

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: var(--bg-card);
  padding: 30px;
  border-radius: 8px;
  width: 100%;
  max-width: 500px;
  border: 1px solid var(--border);
  position: relative;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.close-btn:hover {
  color: var(--danger);
}

/* Action Buttons within table */
.action-btns {
  display: flex;
  gap: 10px;
}

.mobile-menu-btn {
  display: block; /* Visible on desktop now for toggling */
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar {
    padding: 15px 20px;
  }
  
  .nav-links {
    display: none; /* hidden for mobile until toggled */
  }

  .main-content {
    margin-left: 0;
    padding: 15px;
  }

  .mobile-menu-btn {
    display: block;
  }
  
  .mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(17, 34, 64, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 -5px 15px rgba(0,0,0,0.5);
    padding: 10px 15px;
    justify-content: space-between;
    z-index: 100;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
  }
  
  .mobile-bottom-bar .btn {
    flex: 1;
    margin: 0 5px;
    padding: 15px 10px; /* Touch friendly */
    border-radius: 10px;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  /* Add padding bottom to main content to not overlap bottom bar */
  .has-bottom-bar {
    padding-bottom: 90px;
  }

  /* Full screen modals for app feel */
  .modal-content {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    overflow-y: auto;
    padding: 20px;
  }

  /* One column grid for modal forms on mobile */
  .modal-content > form > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Sticky Header */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    background-color: rgba(10, 25, 47, 0.95);
    backdrop-filter: blur(5px);
    padding: 15px 0;
    margin-top: -15px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  /* Table to Cards on Mobile */
  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    background-color: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 10px;
    margin-bottom: 20px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  }

  td {
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
    padding-left: 45%;
    text-align: right;
    min-height: 45px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 40%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: bold;
    color: var(--text-muted);
    font-size: 0.85rem;
  }
  
  td:last-child {
    border-bottom: 0;
    padding-top: 15px;
  }

  .action-btns {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Mobile Adjustments Overrides */
.sidebar {
  overflow-y: auto;
  padding-bottom: 80px; /* Ensure space for scrolling on mobile */
}

/* Desktop Sidebar Toggle Styles */
.sidebar.collapsed {
  transform: translateX(-100%);
}
.main-content {
  transition: margin-left 0.3s ease;
}
.main-content.expanded {
  margin-left: 0;
}

@media (max-width: 768px) {
  /* Mobile Navigation */
  #mobileNavToggle { display: block !important; }
  .nav-links {
    display: none !important;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background: var(--bg-darker);
    padding: 20px;
    text-align: center;
    z-index: 1000;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .nav-links.active {
    display: flex !important;
  }
  .nav-links a {
    margin: 10px 0;
  }
  
  /* Mobile Sidebar - Fix scrolling on mobile */
  .sidebar {
    width: 100%;
    max-height: 100vh;
    padding-bottom: 20px;
    transform: translateX(-100%);
    z-index: 999;
  }
  
  .sidebar.active {
    transform: translateX(0);
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
  }

  .sidebar-nav {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 10px;
  }

  .sidebar-nav::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
  }

  .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0, 188, 212, 0.3);
    border-radius: 10px;
  }

  .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 188, 212, 0.6);
  }
  
  /* Hide mobile bottom bars completely as requested */
  .mobile-bottom-bar,
  .bottom-nav {
    display: none !important;
  }
  
  /* Prevent main content from having bottom padding if bottom bar is gone */
  .main-content.has-bottom-bar {
    padding-bottom: 20px !important;
  }
}
