@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Modern Slate & Indigo Palette */
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --secondary: #10B981;
  --secondary-hover: #059669;
  
  --dark: #0F172A;
  --dark-light: #1E293B;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50: #F8FAFC;
  
  --white: #FFFFFF;
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --warning: #F59E0B;
  --info: #3B82F6;
  
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.4);
  
  /* Refined Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-indigo: 0 10px 15px -3px rgba(99, 102, 241, 0.2);
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
}

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

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--slate-100);
}
::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--slate-50);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--dark);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

/* Auth Pages */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--slate-50);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
  position: relative;
  overflow: hidden;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s ease-out;
}

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

.auth-card h2 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), #818CF8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card p.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-size: 1rem;
}

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 0.5rem;
}

.form-control {
  width: 100%;
  padding: 0.875rem 1.25rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  color: var(--slate-800);
  background-color: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--white);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-indigo);
}

.btn-primary:active {
  transform: translateY(0);
}

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

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  box-shadow: var(--shadow-xl);
}

.sidebar-header {
  height: 80px;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -1px;
}

.sidebar-header h1 span {
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  padding: 2rem 1.25rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.25rem;
  color: var(--slate-400);
  text-decoration: none;
  border-radius: var(--radius-lg);
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-family: 'Outfit', sans-serif;
  transition: var(--transition);
}

.nav-item i {
  margin-right: 1rem;
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
  transition: var(--transition);
}

.nav-item:hover {
  background-color: rgba(255,255,255,0.05);
  color: var(--white);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), #818CF8);
  color: var(--white);
  box-shadow: var(--shadow-indigo);
}

.nav-item.active i {
  color: var(--white);
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 280px);
}

/* Topbar */
.topbar {
  height: 80px;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-xl);
  transition: var(--transition);
  cursor: pointer;
}

.user-profile:hover {
  background-color: var(--slate-100);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #818CF8);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: var(--shadow-indigo);
}

.user-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--dark);
}

.user-role {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Page Content */
.page-content {
  padding: 2.5rem;
  flex: 1;
}

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

.stat-card {
  background-color: var(--white);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  transition: var(--transition);
}

.stat-icon.primary { background-color: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-icon.success { background-color: rgba(16, 185, 129, 0.1); color: var(--secondary); }
.stat-icon.warning { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-card:hover .stat-icon {
  transform: scale(1.1);
}

.stat-details h3 {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.stat-details .value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark);
  font-family: 'Outfit', sans-serif;
  line-height: 1;
}

/* Cards */
.card {
  background-color: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 2rem;
}

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

.card-header h3 {
  font-size: 1.25rem;
  margin: 0;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  padding: 1.25rem 1.75rem;
  text-align: left;
}

th {
  background-color: var(--slate-50);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

td {
  font-size: 0.95rem;
  color: var(--slate-700);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

tbody tr:hover td {
  background-color: var(--slate-50);
  color: var(--primary);
}

/* Page Header */
.page-header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}
.page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.025em;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
}

/* Filters Bar */
.filters-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}
.filters-group {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.filter-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.filter-item label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 0;
}
.filter-select {
  border: 1px solid var(--border);
  background: var(--slate-50);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  padding: 0.5rem 2rem 0.5rem 1rem;
  outline: none;
  border-radius: var(--radius-md);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px;
  transition: var(--transition);
}
.filter-select:hover { 
  border-color: var(--primary);
  background-color: var(--white);
}

/* Specific Badge colors for Tickets */
.badge-assigned { background-color: rgba(99, 102, 241, 0.1); color: var(--primary); border: 1px solid rgba(99, 102, 241, 0.2); }
.badge-followup { background-color: rgba(139, 92, 246, 0.1); color: #8B5CF6; border: 1px solid rgba(139, 92, 246, 0.2); }

/* Animation Utils */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
/* Dashboard Header */
.dashboard-header {
  margin-bottom: 2.5rem;
}
.dashboard-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.025em;
}
.dashboard-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
}

/* KPI / Stats Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: var(--transition);
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.kpi-content {
  display: flex;
  flex-direction: column;
}
.kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.kpi-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--dark);
  font-family: 'Outfit', sans-serif;
  line-height: 1;
}
.kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: var(--transition);
}
.kpi-icon.primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.kpi-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.kpi-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--secondary); }
.kpi-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.dashboard-sections {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 2rem;
}

@media (max-width: 1200px) {
  .dashboard-sections {
    grid-template-columns: 1fr;
  }
}

/* Badge Soft (used in dashboards) *//* Mention Autocomplete */
.mention-dropdown {
  position: absolute;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  min-width: 200px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}
.mention-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition);
}
.mention-item:hover, .mention-item.active {
  background: var(--light);
  color: var(--primary);
}
.mention-item .avatar-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Mention Tag in Display */
.mention-tag {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  transition: var(--transition);
  cursor: default;
}
.mention-tag:hover {
  background: var(--primary);
  color: var(--white);
}

/* Multi-Attachment Styles */
.attachments-container {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-main);
  text-decoration: none;
  transition: var(--transition);
}
.attachment-pill:hover {
  background: var(--white);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.attachment-pill i {
  color: var(--text-muted);
}
.attachment-pill:hover i {
  color: var(--primary);
}

.file-selection-preview {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-open { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-assigned { background-color: rgba(99, 102, 241, 0.1); color: var(--primary); }
.badge-progress { background-color: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-closed { background-color: rgba(16, 185, 129, 0.1); color: var(--secondary); }

/* Alerts */
.alert {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.alert-error {
  background-color: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FEE2E2;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    width: 80px;
    padding: 0;
  }
  .sidebar-header h1, .nav-item span, .sidebar-footer {
    display: none;
  }
  .sidebar-header {
    justify-content: center;
    padding: 0;
  }
  .nav-item {
    justify-content: center;
    padding: 1rem;
  }
  .nav-item i {
    margin-right: 0;
  }
  .main-content {
    margin-left: 80px;
    max-width: calc(100% - 80px);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    max-width: 100%;
  }
  .topbar {
    padding: 0 1.5rem;
  }
  .page-content {
    padding: 1.5rem;
  }
}
