/* ============================================================
   CobrançaFácil — style.css
   Tema: violet/gem para vendas de joias e produtos premium
   ============================================================ */

:root {
  --primary:       #7C3AED;
  --primary-dark:  #5B21B6;
  --primary-light: #EDE9FE;
  --secondary:     #EC4899;
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --info:          #3B82F6;
  --dark:          #1E1B4B;
  --gray-100:      #F8F7FF;
  --gray-200:      #E9E7F5;
  --gray-400:      #A8A4C5;
  --gray-600:      #6B6899;
  --sidebar-w:     260px;
  --topnav-h:      60px;
  --radius:        12px;
  --shadow:        0 2px 12px rgba(124, 58, 237, .1);
}

* { box-sizing: border-box; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-100);
  color: #2D2A55;
  margin: 0;
}

/* ---- Sidebar -------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  transition: width .25s ease;
  z-index: 1000;
  overflow: hidden;
}


.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 20px 22px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.1);
  white-space: nowrap;
}
.sidebar-brand i { color: var(--secondary); font-size: 1.4rem; }

.sidebar-section {
  padding: 18px 22px 6px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-400);
  white-space: nowrap;
}

.sidebar-nav { list-style: none; margin: 0; padding: 0 10px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--gray-400);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: all .18s;
  white-space: nowrap;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav a i { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.btn-logout {
  display: flex;
  align-items: center;
  color: var(--gray-400);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  transition: color .18s;
}
.btn-logout:hover { color: var(--danger); }

/* ---- Main wrapper --------------------------------------- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left .25s ease;
}
.main-wrapper.expanded { margin-left: 70px; }

/* ---- Top navbar ----------------------------------------- */
.topnav {
  height: var(--topnav-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.btn-menu-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--gray-600);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background .18s;
}
.btn-menu-toggle:hover { background: var(--gray-200); }
.topnav-user { font-size: .88rem; color: var(--gray-600); font-weight: 500; }

/* ---- Page content --------------------------------------- */
.page-content { padding: 28px 32px; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}

/* ---- Cards ---------------------------------------------- */
.card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 20px;
  font-weight: 600;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---- Stat cards ----------------------------------------- */
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: #D1FAE5; color: var(--success); }
.stat-icon.orange { background: #FEF3C7; color: var(--warning); }
.stat-icon.red    { background: #FEE2E2; color: var(--danger); }
.stat-icon.blue   { background: #DBEAFE; color: var(--info); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--dark); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-600); margin-top: 4px; }

/* ---- Badges --------------------------------------------- */
.badge-success   { background: #D1FAE5; color: #065F46; }
.badge-warning   { background: #FEF3C7; color: #92400E; }
.badge-danger    { background: #FEE2E2; color: #991B1B; }
.badge-info      { background: #DBEAFE; color: #1E40AF; }
.badge-secondary { background: var(--gray-200); color: var(--gray-600); }
.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  display: inline-block;
}

/* ---- Buttons -------------------------------------------- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 500;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-outline-primary { color: var(--primary); border-color: var(--primary); font-weight: 500; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* ---- Tables --------------------------------------------- */
.table th {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
}
.table td { vertical-align: middle; font-size: .88rem; }
.table tbody tr:hover { background: var(--gray-100); }

/* ---- Forms ---------------------------------------------- */
.form-label { font-weight: 500; font-size: .88rem; margin-bottom: 5px; }
.form-control, .form-select {
  border-color: var(--gray-200);
  border-radius: 8px;
  font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

/* ---- Modal ---------------------------------------------- */
.modal-header { background: var(--primary); color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.modal-header .btn-close { filter: invert(1); }
.modal-content { border-radius: var(--radius); border: none; }

/* ---- Progress bar --------------------------------------- */
.payment-progress { height: 8px; border-radius: 999px; background: var(--gray-200); overflow: hidden; }
.payment-progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width .4s; }

/* ---- Avatar --------------------------------------------- */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}

/* ---- Login page ----------------------------------------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark) 0%, var(--primary) 100%);
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo i { font-size: 2.5rem; color: var(--primary); }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--dark); margin-top: 8px; }

/* ---- Responsive ----------------------------------------- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .page-content { padding: 20px 16px; }
}

/* ---- Alerts --------------------------------------------- */
.alert-success { background: #D1FAE5; border-color: #A7F3D0; color: #065F46; }
.alert-danger   { background: #FEE2E2; border-color: #FECACA; color: #991B1B; }
.alert-warning  { background: #FEF3C7; border-color: #FDE68A; color: #92400E; }

/* ---- Upload preview ------------------------------------- */
.img-preview {
  width: 90px; height: 90px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--gray-200);
}
.img-preview-placeholder {
  width: 90px; height: 90px;
  border-radius: 10px;
  border: 2px dashed var(--gray-200);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400);
  font-size: 1.4rem;
  cursor: pointer;
  transition: border-color .2s;
}
.img-preview-placeholder:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Gmail config indicator ----------------------------- */
.gmail-status-ok   { color: var(--success); font-weight: 600; }
.gmail-status-fail { color: var(--danger);  font-weight: 600; }

/* ---- Mobile fixes ---------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s ease;
    z-index: 1000;
    width: var(--sidebar-w) !important; /* sempre largura full no mobile */
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w) !important; } /* ignora collapsed no mobile */
  .main-wrapper { margin-left: 0 !important; }
  .page-content { padding: 16px 14px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-header h1 { font-size: 1.2rem; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 1.2rem; }
  .topnav { padding: 0 14px; }
  /* Tabelas no mobile com scroll */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  /* Modais ocupam mais tela */
  .modal-dialog { margin: 10px; }
  /* Botões maiores para toque */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
}



/* ---- Sidebar collapsed (desktop) ----------------------- */
.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .sidebar-text    { display: none !important; }
.sidebar.collapsed .sidebar-section { display: none !important; }
.sidebar.collapsed .sidebar-footer  { padding: 16px 8px; }
.sidebar.collapsed .sidebar-nav a   { justify-content: center; padding: 12px 8px; }
.sidebar.collapsed .sidebar-nav a i { margin: 0 !important; font-size: 1.1rem; width: auto; }
.sidebar.collapsed .sidebar-brand   { justify-content: center; padding: 20px 8px; }
.sidebar.collapsed .sidebar-brand i { margin: 0 !important; }
/* Tooltip no collapsed */
.sidebar.collapsed .sidebar-nav a {
  position: relative;
}
.sidebar.collapsed .sidebar-nav a::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 78px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(30,27,75,.95);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: .78rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
  z-index: 9999;
}
.sidebar.collapsed .sidebar-nav a:hover::after { opacity: 1; }
