:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-accent: #334155;
  --accent-teal: #0ed5c0;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 1.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 2.5rem;
}

.nav-links {
  list-style: none;
  flex-grow: 1;
}

.nav-links li {
  margin-bottom: 0.75rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.nav-links a:hover, .nav-links a.active {
  background-color: var(--bg-accent);
  color: var(--text-primary);
  transform: translateX(5px);
}

.nav-links a.active {
  border-left: 4px solid var(--accent-teal);
}

.nav-links i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

.user-profile {
  display: flex;
  align-items: center;
  padding: 1rem;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 0.75rem;
  margin-top: auto;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 12px;
}

.user-info .name {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-info .role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-image: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.05), transparent);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  background-color: rgba(15, 23, 42, 0.8);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.header-title p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
  color: #000;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 213, 192, 0.3);
}

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

.btn-secondary:hover {
  background-color: #475569;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.btn-danger:hover {
  background-color: rgba(239, 68, 68, 0.4);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
}

.stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.1);
}

.stat-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.stat-card h3 {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0.5rem 0;
}

.stat-card .trend {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
}

.trend.positive { color: #10b981; }
.trend.negative { color: #ef4444; }

/* Pipeline Section */
.pipeline-section {
  padding: 0 2rem 2rem 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  overflow-x: auto;
}

.pipeline-column {
  background-color: rgba(30, 41, 59, 0.5);
  border-radius: 0.75rem;
  padding: 1rem;
  min-height: 400px;
}

.column-header {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
}

.deal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: grab;
  transition: all 0.3s ease;
}

.deal-card:hover {
  border-color: var(--accent-teal);
  transform: scale(1.02);
}

.deal-card h4 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.deal-card .value {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.deal-card .tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  display: inline-block;
  margin-top: 0.5rem;
}

.tag.b2b { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.tag.b2c { background-color: rgba(139, 92, 246, 0.2); color: #a78bfa; }

/* Tables (for Vendedores) */
.table-container {
  background-color: var(--bg-secondary);
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 0 2rem 2rem 2rem;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

th {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

td {
  font-size: 0.95rem;
}

tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-active { background-color: rgba(16, 185, 129, 0.2); color: #10b981; }
.status-inactive { background-color: rgba(239, 68, 68, 0.2); color: #ef4444; }

/* Login Page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at center, rgba(59, 130, 246, 0.1), transparent);
}

.login-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  padding: 2.5rem;
  border-radius: 1rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-card h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-card p {
  color: var(--text-secondary);
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

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

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

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background-color: rgba(15, 23, 42, 0.5);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px rgba(14, 213, 192, 0.2);
}

.login-card .btn {
  width: 100%;
  padding: 0.75rem;
  margin-top: 1rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-accent); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: var(--bg-secondary);
  margin: 10% auto;
  padding: 2rem;
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.3s ease;
}

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

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

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.close-modal {
  color: var(--text-secondary);
  font-size: 1.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: var(--text-primary);
}

.modal .form-group {
  margin-bottom: 1.25rem;
}

.modal .btn {
  width: 100%;
  padding: 0.75rem;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1024px) {
  .pipeline-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    top: 0;
    left: -100%;
    z-index: 1000;
    height: 100vh;
    transition: left 0.3s ease;
  }

  .sidebar.active {
    left: 0;
  }

  #mobile-menu-btn, .btn-mobile-menu {
    display: block !important;
  }

  .main-content {
    width: 100%;
    margin-top: 0;
  }

  .dashboard-grid {
    padding: 1rem;
    grid-template-columns: 1fr;
  }

  header {
    padding: 1rem;
  }

  .header-title h1 {
    font-size: 1.2rem;
  }

  .header-title p {
    display: none;
  }

  .hide-mobile {
    display: none;
  }

  .table-container {
    margin: 1rem;
    padding: 0.5rem;
    overflow-x: auto;
  }

  .pipeline-section {
    padding: 1rem;
  }

  .pipeline-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-column {
    min-height: auto;
    margin-bottom: 1rem;
  }

  .modal-content {
    margin: 5% auto;
    width: 95%;
    padding: 1.5rem;
  }

  /* Bottom Navigation for Mobile (Optional alternative) */
  /* If you want bottom nav, uncomment this and adjust index.html */
  /* .sidebar { ... transform into bottom bar ... } */
}

@media (max-width: 480px) {
  .header-actions {
    gap: 0.5rem;
  }
  
  .btn {
    padding: 0.5rem 0.8rem;
  }
}
