/* ============================================
   CRM Management Panel - Main Stylesheet
   ============================================ */

:root {
  /* Color Palette */
  --primary: #6C3EF9;
  --secondary: #0F1A3C;
  --accent-1: #25F4EE;
  --accent-2: #FF8748;
  --bg-light: #F8F9FA;
  --bg-white: #FFFFFF;
  --success: #30D158;
  --warning: #FFD60A;
  --danger: #FF453A;
  --text-primary: #212529;
  --text-secondary: #6C757D;
  --border-color: #E9ECEF;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ============================================
   Sidebar Navigation
   ============================================ */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 280px;
  background: linear-gradient(180deg, var(--secondary) 0%, #1a2a4a 100%);
  color: white;
  z-index: 1000;
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: 80px;
}

.sidebar.collapsed .sidebar-logo span {
  display: none;
}

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  width: 100%;
}

.sidebar.collapsed .sidebar-toggle {
  width: 100%;
  margin-top: 0.5rem;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  min-height: 70px;
}

.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  align-items: center;
}

@media (min-width: 769px) {
  .sidebar.collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
  }
  
  .sidebar.collapsed .sidebar-logo {
    justify-content: center;
  }
  
  .sidebar.collapsed .sidebar-toggle {
    width: 100%;
    margin-top: 0.5rem;
  }
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo i {
  font-size: 2rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(180deg);
}

.sidebar-menu {
  padding: 1rem 0;
}

.menu-item {
  position: relative;
  margin: 0.25rem 0.75rem;
}

.menu-item > a {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: 10px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.menu-item > a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--primary);
  transform: scaleY(0);
  transition: var(--transition);
}

.menu-item > a:hover,
.menu-item > a.active {
  background: rgba(108, 62, 249, 0.2);
  color: white;
  transform: translateX(5px);
}

.menu-item > a:hover::before,
.menu-item > a.active::before {
  transform: scaleY(1);
}

.menu-item > a i {
  width: 24px;
  font-size: 1.25rem;
  margin-right: 0.75rem;
  transition: var(--transition);
}

.menu-item > a:hover i {
  transform: scale(1.2);
  color: var(--accent-1);
}

.menu-item > a span {
  white-space: nowrap;
  transition: var(--transition);
}

.sidebar.collapsed .menu-item > a span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .menu-item > a {
  justify-content: center;
  padding: 0.875rem;
}

/* Submenu */
.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  margin: 0.5rem 0.75rem;
}

.submenu.active {
  max-height: 500px;
}

.submenu-item a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem 0.75rem 3rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: var(--transition);
  border-radius: 6px;
  margin: 0.25rem 0.5rem;
}

.submenu-item a:hover {
  background: rgba(108, 62, 249, 0.15);
  color: white;
  transform: translateX(5px);
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
  margin-left: 280px;
  min-height: 100vh;
  transition: var(--transition);
  padding: 2rem;
}

.sidebar.collapsed ~ .main-content {
  margin-left: 80px;
}

/* Top Bar */
.topbar {
  background: var(--bg-white);
  padding: 1.25rem 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.topbar-left h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--secondary);
  margin: 0;
}

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

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  padding: 0.625rem 1rem 0.625rem 2.75rem;
  border: 2px solid var(--border-color);
  border-radius: 25px;
  width: 300px;
  transition: var(--transition);
  font-size: 0.9rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 62, 249, 0.1);
}

.search-box i {
  position: absolute;
  left: 1rem;
  color: var(--text-secondary);
}

/* ============================================
   Cards & Widgets
   ============================================ */

.card {
  background: var(--bg-white);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

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

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

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--secondary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title i {
  color: var(--primary);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  padding: 0.625rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-size: 0.9rem;
}

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

.btn-primary:hover {
  background: #5a2dd9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 62, 249, 0.3);
}

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

.btn-secondary:hover {
  background: #1a2a4a;
  transform: translateY(-2px);
}

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

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

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

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

/* ============================================
   Badges & Status
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(48, 209, 88, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 214, 10, 0.1);
  color: #b8940a;
}

.badge-danger {
  background: rgba(255, 69, 58, 0.1);
  color: var(--danger);
}

.badge-info {
  background: rgba(37, 244, 238, 0.1);
  color: #1a9b96;
}

.badge-primary {
  background: rgba(108, 62, 249, 0.1);
  color: var(--primary);
}

/* ============================================
   Tables
   ============================================ */

.table-responsive {
  overflow-x: auto;
  border-radius: 8px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-white);
}

.table thead {
  background: var(--bg-light);
}

.table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.table th:hover {
  background: rgba(108, 62, 249, 0.05);
  color: var(--primary);
}

.table th i {
  margin-left: 0.5rem;
  opacity: 0.5;
  transition: var(--transition);
}

.table th:hover i {
  opacity: 1;
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background: rgba(108, 62, 249, 0.03);
  transform: scale(1.01);
}

/* ============================================
   Animations
   ============================================ */

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.animate-slide-in {
  animation: slideIn 0.5s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out;
}

/* ============================================
   Utilities
   ============================================ */

.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--secondary); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ============================================
   Responsive
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: 1001;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .sidebar.collapsed {
    width: 280px;
  }
  
  .sidebar.collapsed .sidebar-header {
    flex-direction: row;
    justify-content: space-between;
  }
  
  .sidebar.collapsed .sidebar-logo span {
    display: inline;
  }
  
  .sidebar.collapsed .sidebar-toggle {
    width: 36px;
    margin-top: 0;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 1rem;
    padding-top: 4rem;
    width: 100%;
    overflow-x: hidden;
  }
  
  .topbar {
    padding: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
  }
  
  .topbar-left h1 {
    font-size: 1.5rem;
  }
  
  .search-box {
    width: 100%;
    max-width: 100%;
  }
  
  .search-box input {
    width: 100%;
    max-width: 100%;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .topbar-right {
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1rem;
  }
  
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  
  .table {
    min-width: 600px;
    font-size: 0.85rem;
  }
  
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
  }
  
  .kanban-board {
    flex-direction: column;
    overflow-x: visible;
  }
  
  .kanban-stage {
    min-width: 100%;
    width: 100%;
  }
  
  .modal-content {
    width: 95%;
    padding: 1.5rem;
    max-height: 90vh;
    margin: 1rem;
  }
  
  .notification-list {
    width: calc(100vw - 2rem);
    right: 1rem;
    max-width: 350px;
  }
  
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .chart-wrapper {
    height: 250px;
  }
  
  .chart-wrapper canvas {
    max-width: 100%;
    height: auto;
  }
  
  .row {
    margin: 0;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }
  
  .col-lg-4,
  .col-lg-6,
  .col-lg-8 {
    padding: 0.5rem;
    margin-bottom: 1rem;
    width: 100%;
    display: block !important;
  }
  
  /* Chat contacts panel - mobilde kesinlikle görünür */
  .row.chat-container .col-lg-4.chat-contacts-panel,
  .row.chat-container #chatContactsPanel,
  .chat-contacts-panel,
  #chatContactsPanel {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    z-index: 100 !important;
    background: white !important;
    overflow-y: auto !important;
  }
  
  #chatContactsList {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  #chatContactsList .chat-contact {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  #chatContactsList .chat-avatar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .col-lg-6 .card {
    height: auto !important;
  }
  
  .stat-card {
    min-height: 160px;
  }
  
  .funnel-container {
    padding: 0.5rem;
  }
  
  .funnel-stage {
    padding: 0.75rem 1rem;
  }
  
  .chat-contact {
    padding: 0.75rem !important;
  }
  
  .file-item {
    padding: 0.75rem;
    flex-wrap: wrap;
  }
  
  .widget-grid {
    grid-template-columns: 1fr;
  }
  
  .calendar-container {
    padding: 1rem;
  }
  
  .calendar-grid {
    gap: 0.25rem;
  }
  
  .calendar-day {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5a2dd9;
}
