/* CRM Call Center Portal - Laravel-style theme */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #64748b;
  --accent: #6366f1;
  --accent-blue: #3b82f6;
  --bg-dark: #1e293b;
  --bg-card: #ffffff;
  --bg-body: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 0.5rem;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --sidebar-width: 16rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  background-size: 200% 200%;
  animation: gradient 8s ease infinite;
}

@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.login-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  color: var(--primary);
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
  text-align: center;
}

.login-card .subtitle {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
}

.login-card .form-group {
  margin-bottom: 1.25rem;
}

.login-card label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.login-card input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  padding: 0.9rem;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 14px -2px rgba(99, 102, 241, 0.4);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}

/* Layout: sidebar + main */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  color: var(--text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.2s ease, width 0.2s ease;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.25rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.5rem;
}

.nav-section-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.75rem 1rem 0.25rem;
  margin-top: 0.5rem;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-radius: var(--radius);
  margin: 0 0.25rem;
  font-weight: 500;
  font-size: 0.9375rem;
}

.nav-link:hover {
  background: var(--bg-body);
  color: var(--primary);
}

.nav-link.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.nav-link svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  opacity: 0.85;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
}

.sidebar-footer {
  padding: 1rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-body);
}

.sidebar-collapse-btn {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.sidebar-collapse-btn:hover {
  color: var(--primary);
  background: #fff;
}

.sidebar-footer .user-info {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.sidebar-footer .user-info strong {
  color: var(--text);
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.875rem;
}

.btn-logout {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  background: #fff;
  color: var(--danger);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 1.5rem;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

body.sidebar-collapsed .main-content { margin-left: 4.5rem; }

body.sidebar-collapsed .sidebar { width: 4.5rem; }

body.sidebar-collapsed .sidebar .sidebar-brand-text,
body.sidebar-collapsed .sidebar .nav-section-title,
body.sidebar-collapsed .sidebar .user-info,
body.sidebar-collapsed .sidebar .btn-logout { opacity: 0; visibility: hidden; width: 0; overflow: hidden; display: none; }
body.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: 0.625rem; font-size: 0; }
body.sidebar-collapsed .sidebar .nav-link svg { flex-shrink: 0; width: 1.25rem; height: 1.25rem; }
body.sidebar-collapsed .sidebar .sidebar-brand { padding: 1rem; justify-content: center; }
body.sidebar-collapsed .sidebar .sidebar-collapse-btn { padding: 0.4rem; }
body.sidebar-collapsed .sidebar .sidebar-collapse-btn svg { transform: rotate(180deg); }
body.sidebar-collapsed .sidebar .sidebar-footer .user-info { margin: 0; }

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  color: var(--bg-dark);
  font-weight: 700;
}

.page-header .breadcrumb {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Cards */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-body {
  padding: 1.25rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data-table th,
table.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text);
}

table.data-table tr:hover {
  background: #f8fafc;
}

table.data-table .badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-contacted { background: #fef3c7; color: #b45309; }
.badge-qualified { background: #d1fae5; color: #047857; }
.badge-lost { background: #fee2e2; color: #b91c1c; }
.badge-won { background: #d1fae5; color: #065f46; }

/* Buttons small */
.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #64748b; color: #fff; }
.btn-info { background: var(--accent-blue); color: #fff; }

/* Forms in cards */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Stats tiles on dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-tile {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.stat-tile.lead { border-left-color: #6366f1; }
.stat-tile.data { border-left-color: #f59e0b; }
.stat-tile.users { border-left-color: #22c55e; }

.stat-tile .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
}

.stat-tile .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Mobile: hamburger sidebar */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 101;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding-top: 4rem;
  }

  body.sidebar-collapsed .main-content { margin-left: 0; }

  .sidebar-overlay.show {
    display: block;
  }
}

@media (max-width: 576px) {
  .login-card {
    padding: 1.5rem;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  table.data-table th,
  table.data-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-bar select,
.filter-bar input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.filter-bar .btn {
  margin: 0;
}

/* Leads Filteration index – icon cards */
.lead-filter-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.lead-filter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.75rem 1.25rem;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}

.lead-filter-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.lead-filter-icon {
  width: 56px;
  height: 56px;
  border-radius: 0.75rem;
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.lead-filter-icon svg {
  width: 28px;
  height: 28px;
}

.lead-filter-card strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.lead-filter-card span:last-child {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Shared layout for File Converters & VICI Tools grids */
.file-converters-sections {
  margin-top: 1rem;
}
.file-converters-section {
  margin-bottom: 2.5rem;
}
.file-converters-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}
.file-converters-sections .lead-filter-cards {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.file-converters-sections .lead-filter-card {
  padding: 1.25rem 1rem;
}
.file-converters-sections .lead-filter-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 0.75rem;
}
.file-converters-sections .lead-filter-icon svg {
  width: 24px;
  height: 24px;
}
.file-converters-sections .lead-filter-card strong {
  font-size: 0.95rem;
}
.file-converters-sections .lead-filter-card span:last-child {
  font-size: 0.8rem;
}
.tool-badge {
  display: inline-block;
  margin-bottom: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.badge-free {
  background: #d1fae5;
  color: #047857;
}
.badge-pro {
  background: #fee2e2;
  color: #b91c1c;
}

.page-header .breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.page-header .breadcrumb a:hover {
  text-decoration: underline;
}
