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

:root {
  /* Dark Premium Dashboard Palette based on image */
  --bg-main: #0a0c10; 
  --bg-sidebar: rgba(15, 18, 25, 0.85);
  --bg-card: rgba(26, 30, 41, 0.6);
  --bg-card-hover: rgba(35, 40, 54, 0.8);
  
  --accent-blue: #FF6B00; /* Replaced blue with Ferrari glowing orange */
  --accent-blue-hover: #e65c00;
  --accent-gradient: linear-gradient(135deg, #FF6B00, #ffb347);
  --accent-purple: #8b5cf6;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8; 
  --text-darker: #475569;
  
  --border-light: rgba(255, 255, 255, 0.08);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px rgba(255, 107, 0, 0.4);
  
  /* Status Colors */
  --status-green: #10b981;
  --status-yellow: #f59e0b;
  --status-red: #ef4444;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

* {
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  overflow: hidden; /* Full app takes screen */
}

/* Sidebar / Left Navigation */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  margin-bottom: 3rem;
}

.logo-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--border-light);
  box-shadow: inset 0 0 10px rgba(255,255,255,0.02);
}

.nav-item.active .nav-icon {
  color: var(--accent-blue);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-main) url('https://images.unsplash.com/photo-1534438327276-14e5300c3a48?q=80&w=1470&auto=format&fit=crop') no-repeat center center;
  background-size: cover;
  background-blend-mode: overlay;
}

/* Top Header */
.top-header {
  height: 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2.5rem;
  border-bottom: 1px solid var(--border-light);
}

.header-search {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 300px;
}

.header-search input {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  width: 100%;
  font-size: 0.9rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.mono-icon {
  filter: grayscale(100%) opacity(0.8);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Dashboard Content */
.dashboard-content {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Typography */
h1 { font-size: 2rem; font-weight: 500; letter-spacing: -0.5px; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 500; color: var(--text-main); margin-bottom: 1.5rem; }
h3 { font-size: 0.95rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 1rem;}
p { color: var(--text-muted); line-height: 1.6; }

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.grid-layout-main { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; align-items: start; height: 100%; }

/* Buttons */
.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(255, 107, 0, 0.6);
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: rgba(255,255,255,0.05);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* Forms & Inputs */
.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.custom-input, .custom-select, .custom-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: rgba(0,0,0,0.2);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.custom-input:focus, .custom-select:focus, .custom-textarea:focus { border-color: var(--accent-blue); }
.custom-textarea { resize: vertical; min-height: 80px; }

/* Lists */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: padding-left 0.2s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover, .list-item.active {
  padding-left: 0.5rem;
}
.list-item.active { border-left: 3px solid var(--accent-blue); }

/* Badges & Status */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-red { background: rgba(239, 68, 68, 0.1); color: var(--status-red); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-yellow { background: rgba(245, 158, 11, 0.1); color: var(--status-yellow); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-green { background: rgba(16, 185, 129, 0.1); color: var(--status-green); border: 1px solid rgba(16, 185, 129, 0.2); }

/* Data Visualization Placeholders */
.data-value { font-size: 2.5rem; font-weight: 300; margin: 0.5rem 0; display: flex; align-items: baseline; gap: 0.5rem; }
.data-unit { font-size: 1rem; color: var(--text-muted); }

/* Sub Tabs Horizontal */
.horizontal-tabs {
  display: flex;
  gap: 2rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
}
.htab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding-bottom: 0.75rem;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}
.htab:hover { color: var(--text-main); }
.htab.active { color: var(--accent-blue); font-weight: 600; }
.htab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent-blue);
  box-shadow: 0 -2px 10px rgba(59, 130, 246, 0.5);
}

/* Login Screen Override */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-card {
  width: 400px;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

/* Tab Buttons */
.btn-tab {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}
.btn-tab:hover {
  color: var(--text-main);
  background: rgba(255,255,255,0.05);
}
.btn-tab.active {
  color: #fff;
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-glow);
}

.customer-tab-content {
  animation: fadeIn 0.3s ease;
}

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

/* FullCalendar Overrides */
.fc {
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
}
.fc-theme-standard .fc-scrollgrid {
  border-color: var(--border-light) !important;
}
.fc-theme-standard td, .fc-theme-standard th {
  border-color: var(--border-light) !important;
}
.fc .fc-button-primary {
  background-color: var(--bg-surface) !important;
  border-color: var(--border-light) !important;
  color: var(--text-main) !important;
}
.fc .fc-button-primary:hover {
  background-color: var(--bg-deep) !important;
}
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active {
  background-color: var(--accent-blue) !important;
  color: #fff !important;
  border-color: var(--accent-blue) !important;
}
.fc-event {
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.fc .fc-col-header-cell-cushion {
  color: var(--text-main) !important;
  text-decoration: none !important;
  background: transparent !important;
  font-weight: 500;
  padding: 0.5rem;
}
.fc-theme-standard th {
  background: transparent !important;
}

.ai-advice-content ul, .ai-advice-content ol {
  padding-left: 1.5rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}
.ai-advice-content li {
  margin-bottom: 0.25rem;
}

/* ==========================================
   MOBILE RESPONSIVENESS
========================================== */
@media (max-width: 850px) {
  
  /* Layout Changes */
  body {
    flex-direction: column;
  }
  
  .app-sidebar {
    display: none !important; /* Hide Desktop Sidebar */
  }
  
  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-light);
    justify-content: space-around;
    padding: 0.75rem 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  .mobile-nav-item.active {
    color: var(--accent-blue);
  }
  
  /* Main Content Adjustments */
  .main-wrapper {
    margin-bottom: 60px; /* Space for bottom nav */
  }
  
  .top-header {
    padding: 0 1rem;
    height: 60px;
  }
  
  .header-search {
    width: auto;
    padding: 0.4rem 0.8rem;
    flex: 1;
    margin-right: 1rem;
  }
  
  .user-profile > div:first-child {
    display: none; /* Hide name/role text next to avatar */
  }
  
  .dashboard-content {
    padding: 1rem 0.5rem;
  }
  
  /* Grid collapses to 1 column */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .grid-layout-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .mobile-customer-selector {
    display: block !important;
  }

  /* Customer list becomes a full screen modal on mobile */
  #desktopCustomerSidebar {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 2000;
    background: var(--bg-main);
    border-radius: 0;
    margin: 0;
    border: none;
  }

  #desktopCustomerSidebar.show-mobile {
    display: flex !important;
  }
  
  .mobile-close-btn {
    display: inline-block !important;
  }
  
  /* Disable any horizontal wrapping issues */
  body, html {
    overflow-x: hidden;
  }
  
  /* Table wrapping for mobile */
  .card {
    padding: 1rem;
    overflow-x: hidden;
  }
  
  /* Tabs 2x2 layout */
  .customer-tabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 0.5rem;
  }
  
  .customer-tabs .btn-tab {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.85rem;
  }

  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.1rem; }
}

/* ==========================================
   AI EXPERT SYSTEM (FUTURISTIC)
========================================== */

/* High-Tech Morphing AI Trigger Button */
.ai-expert-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 18, 25, 0.7);
  border: 1px solid rgba(139, 92, 246, 0.4);
  padding: 8px 24px 8px 8px;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
  outline: none;
}

.ai-expert-trigger:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.9);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.4);
  transform: translateY(-2px) scale(1.02);
}

.ai-morphing-core {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #e0b3ff, var(--accent-purple), #ff6b00);
  background-size: 200% 200%;
  border-radius: 50%;
  animation: morphingCore 3s ease-in-out infinite alternate, gradientShift 4s ease infinite;
  box-shadow: 0 0 15px var(--accent-purple), inset 0 0 10px rgba(255, 255, 255, 0.8);
  position: relative;
  flex-shrink: 0;
}

/* Pulsing radar rings */
.ai-morphing-core::before,
.ai-morphing-core::after {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border-radius: 50%;
  border: 1px solid rgba(139, 92, 246, 0.8);
  animation: pulseRing 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

.ai-morphing-core::after {
  animation-delay: 1s;
}

.ai-trigger-text {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(139, 92, 246, 0.8);
  text-transform: uppercase;
}

@keyframes morphingCore {
  0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  100% { border-radius: 40% 60% 30% 70% / 60% 40% 70% 30%; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}
.typewriter-cursor {
  display: inline-block;
  width: 8px;
  height: 1.2em;
  background-color: var(--accent-purple);
  vertical-align: middle;
  margin-left: 2px;
  animation: blinkCursor 0.8s infinite;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.ai-scanning {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--accent-purple);
  font-weight: 500;
  font-size: 1.1rem;
}

.ai-scanning::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent-purple);
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

  /* Modals */
  .modal-content {
    width: 95%;
    max-height: 90vh;
    padding: 1.5rem;
  }
}
