/* Design System - Modern Light Mode (Mercado Livre Theme) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --border-light: #e6e6e6;
  --border-focus: #3483fa; /* ML Blue */
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-light: #999999;
  --ml-yellow: #fff159; /* ML Yellow */
  --ml-blue: #3483fa; /* ML Blue */
  --ml-blue-hover: #2968c8;
  --success: #00a650; /* ML Green */
  --danger: #f73f55;
  --warning: #ffad1f;
  --info: #3483fa;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Auth Pages (Login/Register) Layout */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  min-height: 100vh;
  background: radial-gradient(circle at top right, rgba(52, 131, 250, 0.05), transparent 40%),
              radial-gradient(circle at bottom left, rgba(255, 241, 89, 0.1), transparent 40%),
              var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.4s ease-out;
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

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

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 35px;
  padding-left: 8px;
}

.sidebar-brand-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease-in-out;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background-color: #f6f8f9;
  color: var(--ml-blue);
  border-left-color: var(--ml-blue);
}

.sidebar-link.active {
  background-color: #e8f0fe;
  color: var(--ml-blue);
  border-left-color: var(--ml-blue);
  font-weight: 600;
}

.sidebar-link svg {
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-info {
  font-size: 13px;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 40px;
  background-color: var(--bg-primary);
  overflow-y: auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 20px;
}

.page-title h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.page-title p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Grid & Cards System */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

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

.card-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: #ffffff;
  border: 1px solid #ccd1d6;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(52, 131, 250, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  gap: 8px;
}

.btn-primary {
  background-color: var(--ml-blue);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(52, 131, 250, 0.15);
}

.btn-primary:hover {
  background-color: var(--ml-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(52, 131, 250, 0.25);
}

.btn-secondary {
  background-color: #f0f2f5;
  color: var(--text-primary);
  border: 1px solid #dcdfe4;
}

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

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

.btn-danger:hover {
  background-color: #e02f44;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
}

/* Lists and Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}

th, td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  background-color: #f8fafc;
}

tr:hover td {
  background-color: #fafbfc;
}

/* Badge status */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background-color: rgba(0, 166, 80, 0.1);
  color: var(--success);
  border: 1px solid rgba(0, 166, 80, 0.2);
}

.badge-danger {
  background-color: rgba(247, 63, 85, 0.1);
  color: var(--danger);
  border: 1px solid rgba(247, 63, 85, 0.2);
}

.badge-warning {
  background-color: rgba(255, 173, 31, 0.1);
  color: var(--warning);
  border: 1px solid rgba(255, 173, 31, 0.2);
}

.badge-info {
  background-color: rgba(52, 131, 250, 0.1);
  color: var(--info);
  border: 1px solid rgba(52, 131, 250, 0.2);
}

.badge-secondary {
  background-color: #f1f3f5;
  color: var(--text-secondary);
  border: 1px solid #e1e3e6;
}

/* Fixed Alert Container at top-right */
#alert-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
  width: calc(100% - 40px);
}

.alert {
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s ease-out;
}

.alert-success {
  background-color: #e6f6ee;
  color: var(--success);
  border: 1px solid rgba(0, 166, 80, 0.3);
}

.alert-error {
  background-color: #fdf2f4;
  color: var(--danger);
  border: 1px solid rgba(247, 63, 85, 0.3);
}

/* Accordion Fold for flows list */
.accordion-item {
  border: 1px solid var(--border-light);
  background-color: var(--bg-secondary);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  background-color: #fafbfc;
  transition: background-color 0.2s;
}

.accordion-header:hover {
  background-color: #f1f3f5;
}

.accordion-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.accordion-icon {
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 20px;
  border-top: 1px solid var(--border-light);
}

.accordion-item.active .accordion-content {
  display: block;
}

/* Rectangular step card without rounded borders */
.flow-card-item {
  border: 1px solid var(--border-light);
  border-radius: 0 !important; /* Forces rectangular sharp edges */
  padding: 16px 20px;
  margin-bottom: 12px;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flow-step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--ml-blue);
  font-size: 13px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding-bottom: 8px;
}

/* Toggle Switch slider */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccd1d6;
  transition: .3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--ml-blue);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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