:root {
  --primary-color: #0F172A;
  --primary-dark: #020617;
  --secondary-color: #6B7280;
  --accent-color: #2563EB;
  --ai-color: #5B21B6;
  --light-bg: #E5E7EB;
  --white: #ffffff;
  --text-muted: #9CA3AF;
  --border-color: #D1D5DB;
  --sidebar-width: 280px;
  --header-height: 60px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--white);
  color: var(--primary-color);
  overflow-x: hidden;
}

.chat-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar-modern {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-color);
}

.brand-logo i {
  font-size: 1.75rem;
  color: var(--accent-color);
}

.brand-logo span {
  font-size: 1.25rem;
  font-weight: 600;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--secondary-color);
  cursor: pointer;
}

.sidebar-nav-modern {
  flex: 1;
  padding: 15px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: var(--secondary-color);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: var(--light-bg);
  color: var(--primary-color);
}

.nav-item.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-color);
}

.nav-item i {
  font-size: 1.25rem;
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid var(--border-color);
}

.conversations-section {
  margin-bottom: 15px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
  padding: 0 10px;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  color: var(--secondary-color);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.conversation-item:hover {
  background: var(--light-bg);
}

.conversation-item i {
  font-size: 1rem;
  color: var(--text-muted);
}

.user-profile-modern {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.user-profile-modern:hover {
  background: var(--light-bg);
}

.user-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--light-bg);
}

.user-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.user-name-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary-color);
}

.user-plan {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.user-menu-btn {
  background: none;
  border: none;
  color: var(--secondary-color);
  cursor: pointer;
}

.main-chat-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.chat-welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.welcome-content {
  max-width: 800px;
  width: 100%;
}

.welcome-greeting {
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 40px;
  text-align: center;
}

.search-container {
  margin-bottom: 40px;
}

.search-box {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease;
}

.search-box:focus-within {
  box-shadow: 0 4px 25px rgba(37, 99, 235, 0.15);
  border-color: var(--accent-color);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--primary-color);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-actions {
  display: flex;
  gap: 5px;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: var(--light-bg);
  color: var(--primary-color);
}

.send-btn {
  background: var(--accent-color);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.send-btn:hover {
  background: #1d4ed8;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.suggestion-card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.suggestion-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.1);
}

.suggestion-card i {
  font-size: 1.5rem;
  color: var(--accent-color);
}

.suggestion-card span {
  font-size: 0.95rem;
  color: var(--primary-color);
  line-height: 1.4;
}

.expand-btn {
  flex-direction: row;
  justify-content: center;
  color: var(--secondary-color);
}

.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.message-group {
  display: flex;
  gap: 15px;
  max-width: 800px;
}

.user-message {
  margin-left: auto;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(91, 33, 182, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-avatar i {
  color: var(--ai-color);
  font-size: 1.25rem;
}

.user-message .message-avatar {
  background: var(--accent-color);
}

.user-message .message-avatar i {
  color: white;
}

.message-content {
  flex: 1;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sender-name {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.9rem;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.message-body {
  background: var(--light-bg);
  padding: 15px 20px;
  border-radius: 18px;
  border-top-left-radius: 4px;
  line-height: 1.6;
  color: var(--primary-color);
}

.user-message .message-body {
  background: var(--accent-color);
  color: white;
  border-radius: 18px;
  border-top-right-radius: 4px;
  border-top-left-radius: 18px;
}

.chat-input-area {
  padding: 20px 40px 30px;
  border-top: 1px solid var(--border-color);
}

.input-wrapper {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.input-action {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.input-action:hover {
  background: var(--light-bg);
  color: var(--primary-color);
}

.chat-text-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--primary-color);
}

.chat-text-input::placeholder {
  color: var(--text-muted);
}

.input-send {
  background: var(--accent-color);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.input-send:hover {
  background: #1d4ed8;
}

.input-disclaimer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 10px;
}

@media (max-width: 991px) {
  .sidebar-modern {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .main-chat-area {
    margin-left: 0;
  }

  .chat-welcome {
    padding: 20px;
  }

  .welcome-greeting {
    font-size: 1.5rem;
  }

  .search-box {
    flex-wrap: wrap;
  }

  .suggestions-grid {
    grid-template-columns: 1fr;
  }

  .chat-messages-area {
    padding: 20px;
  }

  .chat-input-area {
    padding: 15px 20px 20px;
  }
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  z-index: 1000;
  transition: all 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h3 {
  color: var(--white);
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

.sidebar-brand span {
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
}

.sidebar-nav {
  padding: 20px 0;
  list-style: none;
}

.sidebar-nav li {
  margin: 5px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border-left-color: var(--white);
}

.sidebar-nav i {
  margin-right: 12px;
  width: 20px;
  text-align: center;
}

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: all 0.3s ease;
}

.header {
  height: var(--header-height);
  background: var(--white);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 999;
}

.header-left {
  display: flex;
  align-items: center;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary-color);
  cursor: pointer;
}

.header-title {
  font-size: 1.25rem;
  color: var(--primary-color);
  font-weight: 500;
  margin-left: 15px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--accent-color);
  cursor: pointer;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-icon {
  position: relative;
  color: var(--secondary-color);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.header-icon:hover {
  color: var(--primary-color);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e53935;
  color: white;
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-info {
  text-align: right;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--secondary-color);
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.content-wrapper {
  padding: 30px;
}

.page-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 25px;
  font-weight: 500;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--white);
  border-radius: 10px;
  padding: 25px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-right: 15px;
}

.stat-icon.blue {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-color);
}

.stat-icon.green {
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
}

.stat-icon.orange {
  background: rgba(245, 158, 11, 0.1);
  color: #F59E0B;
}

.stat-icon.red {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

.stat-icon.ai {
  background: rgba(91, 33, 182, 0.1);
  color: var(--ai-color);
}

.stat-details h4 {
  font-size: 1.75rem;
  color: var(--secondary-color);
  margin: 0;
  font-weight: 600;
}

.stat-details p {
  color: var(--text-muted);
  margin: 5px 0 0;
  font-size: 0.9rem;
}

.card {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 25px;
}

.card-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h5 {
  margin: 0;
  color: var(--primary-color);
  font-weight: 500;
}

.card-body {
  padding: 25px;
}

.chart-container {
  height: 300px;
  position: relative;
}

.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  background: var(--light-bg);
  padding: 12px 15px;
  text-align: left;
  font-weight: 500;
  color: var(--secondary-color);
  border-bottom: 2px solid var(--border-color);
  font-size: 0.9rem;
}

.table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  color: var(--secondary-color);
  font-size: 0.9rem;
}

.table tr:hover {
  background: rgba(26, 35, 126, 0.03);
}

.badge {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(76, 175, 80, 0.15);
  color: #2e7d32;
}

.badge-warning {
  background: rgba(255, 152, 0, 0.15);
  color: #ef6c00;
}

.badge-info {
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent-color);
}

.badge-ai {
  background: rgba(91, 33, 182, 0.15);
  color: var(--ai-color);
}

.btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent-color);
  color: var(--white);
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--secondary-color);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--secondary-color);
}

.btn-outline:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  color: var(--secondary-color);
  font-weight: 500;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - 120px);
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
}

.chat-message {
  display: flex;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message.ai {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 70%;
  padding: 15px 20px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.chat-message.user .message-bubble {
  background: var(--accent-color);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.chat-message.ai .message-bubble {
  background: rgba(91, 33, 182, 0.08);
  color: var(--primary-color);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(91, 33, 182, 0.15);
}

.message-sender {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.chat-input-container {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 12px 20px;
  border: 1px solid var(--border-color);
  border-radius: 25px;
  font-size: 0.95rem;
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.chat-send-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--primary-color);
  color: var(--white);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.chat-send-btn:hover {
  background: var(--primary-dark);
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 15px 25px;
  border-top: 1px solid var(--border-color);
}

.chip {
  padding: 8px 15px;
  background: var(--light-bg);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.chip:hover {
  background: var(--ai-color);
  color: var(--white);
  border-color: var(--ai-color);
}

.step-indicator {
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
  position: relative;
}

.step-indicator::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  flex: 1;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--light-bg);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.step.active .step-number {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--white);
}

.step.completed .step-number {
  background: #4caf50;
  border-color: #4caf50;
  color: var(--white);
}

.step-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.step.active .step-label {
  color: var(--accent-color);
  font-weight: 500;
}

.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.step-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.preview-container {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 30px;
  margin-top: 20px;
}

.preview-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--accent-color);
}

.preview-header h2 {
  color: var(--primary-color);
  font-size: 1.25rem;
  margin-bottom: 5px;
}

.preview-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.preview-section {
  margin-bottom: 25px;
}

.preview-section h4 {
  color: var(--accent-color);
  font-size: 1rem;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}

.preview-section p {
  margin: 5px 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.premium-lock {
  text-align: center;
  padding: 30px;
  background: linear-gradient(135deg, rgba(91, 33, 182, 0.05) 0%, rgba(91, 33, 182, 0.1) 100%);
  border-radius: 10px;
  margin-top: 20px;
}

.premium-lock i {
  font-size: 3rem;
  color: var(--ai-color);
  margin-bottom: 15px;
}

.premium-lock h4 {
  color: var(--ai-color);
  margin-bottom: 10px;
}

.premium-lock p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.settings-section {
  margin-bottom: 30px;
}

.settings-section h4 {
  color: var(--primary-color);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-info h5 {
  font-size: 1rem;
  color: var(--secondary-color);
  margin-bottom: 3px;
}

.setting-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent-color);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
}

.toast {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 15px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success {
  border-left: 4px solid #4caf50;
}

.toast.error {
  border-left: 4px solid #e53935;
}

.toast.info {
  border-left: 4px solid var(--accent-color);
}

.toast-icon {
  font-size: 1.25rem;
}

.toast.success .toast-icon {
  color: #4caf50;
}

.toast.error .toast-icon {
  color: #e53935;
}

.toast.info .toast-icon {
  color: var(--accent-color);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 500;
  color: var(--secondary-color);
  font-size: 0.95rem;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.app-layout .modal-overlay {
  z-index: 99999;
}

.modal {
  background: var(--white);
  border-radius: 10px;
  max-width: 600px; /* Increased width for better content display */
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-lg {
  max-width: 800px;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-lg {
  max-width: 800px;
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h4 {
  color: var(--primary-color);
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 25px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-lg .modal-body {
  max-height: 65vh;
}

.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.law-content-text h5 {
  color: var(--primary-color);
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 10px;
}

.law-content-text p {
  color: var(--secondary-color);
  line-height: 1.7;
  margin-bottom: 15px;
}

.law-content-text ul {
  margin: 10px 0 15px 20px;
}

.law-content-text li {
  color: var(--secondary-color);
  line-height: 1.6;
  margin-bottom: 8px;
}

.footer {
  background: var(--white);
  padding: 20px 30px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  background: #f9fafb;
}

.main-content-area {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 30px 40px;
  max-width: calc(100vw - var(--sidebar-width));
}

.content-container {
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 30px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
}

.stats-grid-modern {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card-modern {
  background: white;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease;
}

.stat-card-modern:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper.blue {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-color);
}

.stat-icon-wrapper.purple {
  background: rgba(91, 33, 182, 0.1);
  color: var(--ai-color);
}

.stat-icon-wrapper.green {
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.content-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 25px;
}

.card-header-modern {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header-modern h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body-modern {
  padding: 15px;
}

.list-modern {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.list-item.clickable {
  text-decoration: none;
  cursor: pointer;
}

.list-item:hover {
  background: var(--light-bg);
}

.item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary-color);
}

.item-content {
  flex: 1;
}

.item-content h4 {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--primary-color);
  margin: 0 0 3px;
}

.item-content p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.badge-modern {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.alert-info-custom {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 10px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-color);
}

.form-control-modern {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background: white;
}

.form-control-modern:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.petition-preview {
  background: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  min-height: 400px;
  font-family: 'Times New Roman', serif;
  line-height: 1.8;
  white-space: pre-wrap;
  margin: 0;
}

.timeline-modern {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.highlight-box {
  background: rgba(37, 99, 235, 0.08);
  border-left: 4px solid var(--accent-color);
  border-radius: 8px;
  padding: 15px 20px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.highlight-box i {
  color: var(--accent-color);
  font-size: 1.5rem;
  margin-top: 2px;
}

.info-box {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  height: 100%;
  transition: all 0.2s ease;
}

.info-box:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.info-box i {
  font-size: 2rem;
  margin-bottom: 10px;
}

.info-box.blue i { color: var(--accent-color); }
.info-box.purple i { color: var(--ai-color); }
.info-box.green i { color: #10B981; }

.info-box h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0 0 8px;
}

.info-box p {
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin: 0;
  line-height: 1.5;
}

.accordion-modern {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.accordion-item {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

.accordion-btn {
  width: 100%;
  padding: 15px 20px;
  background: white;
  border: none;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--primary-color);
  transition: background 0.2s ease;
}

.accordion-btn:hover {
  background: var(--light-bg);
}

.accordion-btn span {
  flex: 1;
}

.accordion-btn i {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: #f9fafb;
}

.accordion-content p {
  padding: 15px 20px;
  margin: 0;
  font-size: 0.9rem;
  color: var(--secondary-color);
  line-height: 1.6;
}

.timeline-step {
  position: relative;
  padding-bottom: 25px;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-step::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-step:last-child::before {
  display: none;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.timeline-step.active .step-number {
  background: var(--accent-color);
  color: white;
}

.step-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0 0 5px;
}

.step-content p {
  font-size: 0.9rem;
  color: var(--secondary-color);
  margin: 0;
}

.law-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.law-card {
  background: var(--light-bg);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.law-card:hover {
  background: #e5e7eb;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.law-card i {
  font-size: 2.5rem;
  color: var(--accent-color);
  margin-bottom: 12px;
}

.law-card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0 0 5px;
}

.law-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.law-link {
  font-size: 0.85rem;
  color: var(--accent-color);
  font-weight: 500;
}

.accordion-inner {
  padding: 15px 20px;
}

.accordion-inner ul {
  margin: 10px 0;
  padding-left: 20px;
}

.accordion-inner li {
  margin-bottom: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.juris-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.juris-item {
  display: flex;
  gap: 15px;
  padding: 15px;
  background: var(--light-bg);
  border-radius: 10px;
  transition: background 0.2s ease;
}

.juris-item:hover {
  background: #e5e7eb;
}

.juris-badge {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.juris-badge.stf {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.juris-badge.stj {
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent-color);
}

.juris-badge.tjsp {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
}

.juris-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0 0 8px;
}

.juris-summary {
  font-size: 0.85rem;
  color: var(--secondary-color);
  margin: 0 0 10px;
  line-height: 1.5;
}

.juris-link {
  font-size: 0.85rem;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.news-item {
  background: var(--light-bg);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.news-item:hover {
  background: #e5e7eb;
}

.news-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.news-item h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 8px 0 10px;
}

.news-item p {
  font-size: 0.85rem;
  color: var(--secondary-color);
  margin: 0 0 12px;
  line-height: 1.5;
}

.news-link {
  font-size: 0.85rem;
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--secondary-color);
}

.btn-outline:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

@media (max-width: 991px) {
  .main-content-area {
    margin-left: 0;
    padding: 20px;
    max-width: 100vw;
  }

  .stats-grid-modern {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .user-info {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .content-wrapper {
    padding: 15px;
  }

  .header {
    padding: 0 15px;
  }

  .card-body {
    padding: 15px;
  }

  .chat-messages {
    padding: 15px;
  }

  .message-bubble {
    max-width: 85%;
  }

  .step-indicator {
    overflow-x: auto;
  }

  .step-label {
    font-size: 0.75rem;
  }
}
