/* ============================================================
   AguaSecret — Design System
   ============================================================ */

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

/* ─── CSS Variables ───────────────────────────────────────── */
:root {
  /* Palette */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-900: #1e3a5f;

  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;

  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;

  --emerald-400: #34d399;
  --emerald-500: #10b981;

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;

  --rose-400: #fb7185;
  --rose-500: #f43f5e;

  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Sidebar */
  --sidebar-w: 260px;
  --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  --sidebar-text: #94a3b8;
  --sidebar-active: #60a5fa;
  --sidebar-active-bg: rgba(96, 165, 250, 0.12);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.05);

  /* Surface */
  --bg-body: #f0f4f8;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .12);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transition */
  --transition: 0.2s ease;
}

/* ─── Reset ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ──────────────────────────────────────────────── */
.admin-layout,
.morador-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-400));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(96, 165, 250, .4);
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  font-weight: 400;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, .06);
  margin: 0 16px 12px;
}

.sidebar-nav {
  list-style: none;
  padding: 0 12px;
  flex: 1;
}

.sidebar-nav .nav-item {
  margin-bottom: 2px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.sidebar-nav .nav-link i {
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.sidebar-nav .nav-item.active .nav-link {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
}

.sidebar-nav .nav-item.active .nav-link i {
  color: var(--sidebar-active);
}

.sidebar-footer {
  padding: 12px 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  margin-top: auto;
}

.logout-link {
  color: var(--rose-400) !important;
}

.logout-link:hover {
  background: rgba(244, 63, 94, .1) !important;
  color: var(--rose-400) !important;
}

/* ─── Main Content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--transition);
}

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  background: var(--bg-body);
  color: var(--text-primary);
}

.topbar-breadcrumb {
  flex: 1;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 40px;
  padding: 6px 14px 6px 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.user-btn:hover {
  background: var(--bg-body);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-400));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
}

/* ─── Content Area ────────────────────────────────────────── */
.content-area {
  padding: 28px 28px 40px;
  flex: 1;
}

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: none;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-body {
  padding: 16px;
}

/* ─── Stat Cards ──────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stat-color, var(--blue-500));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--stat-bg, rgba(59, 130, 246, .1));
  color: var(--stat-color, var(--blue-500));
  flex-shrink: 0;
}

.stat-body {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-value {
  font-size: 23px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-top: 4px;
}

.stat-change {
  font-size: 12px;
  margin-top: 4px;
}

.stat-change.up {
  color: var(--emerald-500);
}

.stat-change.down {
  color: var(--rose-500);
}

/* Color modifiers */
.stat-blue {
  --stat-color: var(--blue-500);
  --stat-bg: rgba(59, 130, 246, .1);
}

.stat-cyan {
  --stat-color: var(--cyan-500);
  --stat-bg: rgba(6, 182, 212, .1);
}

.stat-green {
  --stat-color: var(--emerald-500);
  --stat-bg: rgba(16, 185, 129, .1);
}

.stat-amber {
  --stat-color: var(--amber-500);
  --stat-bg: rgba(245, 158, 11, .1);
}

.stat-rose {
  --stat-color: var(--rose-500);
  --stat-bg: rgba(244, 63, 94, .1);
}

.stat-teal {
  --stat-color: var(--teal-500);
  --stat-bg: rgba(20, 184, 166, .1);
}

/* ─── Badges ──────────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-pago {
  background: rgba(16, 185, 129, .12);
  color: var(--emerald-500);
}

.badge-pendente {
  background: rgba(245, 158, 11, .12);
  color: var(--amber-500);
}

.badge-isento {
  background: rgba(96, 165, 250, .12);
  color: var(--blue-500);
}

.badge-alto {
  background: rgba(244, 63, 94, .12);
  color: var(--rose-500);
}

/* ─── Tables ──────────────────────────────────────────────── */
.table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.table-modern thead th {
  background: #f8fafc;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table-modern tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
  white-space: nowrap;
}

.table-modern tbody tr:last-child td {
  border-bottom: none;
}

.table-modern tbody tr:hover td {
  background: #f8fafc;
}

.table-search-wrap .input-group:focus-within {
  border-color: var(--blue-400) !important;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.table-search-wrap input::placeholder {
  font-size: 12px;
  color: #94a3b8;
}

/* ─── Forms ───────────────────────────────────────────────── */
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control,
.form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
  outline: none;
}

.form-control.photo-upload {
  cursor: pointer;
  background: #f8fafc;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(59, 130, 246, .3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--blue-700), var(--blue-600));
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, .4);
  color: #fff;
}

.btn-outline-primary {
  border: 1.5px solid var(--blue-500);
  color: var(--blue-500);
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-weight: 600;
  font-size: 14px;
  background: none;
  transition: all var(--transition);
}

.btn-outline-primary:hover {
  background: var(--blue-500);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #059669, var(--emerald-500));
  border: none;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, var(--rose-500));
  border: none;
}

.btn-warning {
  background: linear-gradient(135deg, #d97706, var(--amber-500));
  border: none;
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ─── Charts ──────────────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
}

/* ─── Upload Preview ──────────────────────────────────────── */
.upload-preview {
  width: 100%;
  max-width: 200px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--border-color);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition);
}

.upload-preview:hover {
  border-color: var(--blue-400);
}

.upload-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.upload-placeholder {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

.upload-placeholder i {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
}

/* ─── Login Page ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--login-bg, linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--login-glow1, rgba(96, 165, 250, .15)) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  border-radius: 50%;
  animation: pulse-glow 4s ease-in-out infinite alternate;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--login-glow2, rgba(34, 211, 238, .1)) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  border-radius: 50%;
  animation: pulse-glow 5s ease-in-out infinite alternate-reverse;
}

@keyframes pulse-glow {
  from {
    opacity: .5;
  }

  to {
    opacity: 1;
  }
}

.login-card {
  background: rgba(255, 255, 255, .04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 25px 50px rgba(0, 0, 0, .5);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--blue-500), var(--cyan-400));
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(96, 165, 250, .4);
}

.login-logo h1 {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
}

.login-logo p {
  font-size: 14px;
  color: rgba(255, 255, 255, .5);
}

.login-card .form-label {
  color: rgba(255, 255, 255, .7);
}

.login-card .form-control {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #fff;
}

.login-card .form-control::placeholder {
  color: rgba(255, 255, 255, .3);
}

.login-card .form-control:focus {
  background: rgba(255, 255, 255, .1);
  border-color: var(--blue-400);
  color: #fff;
}

.login-card .btn-primary {
  width: 100%;
  padding: 13px;
  font-size: 15px;
}

/* ─── Alerts ──────────────────────────────────────────────── */
.alert-modern {
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-modern.success {
  background: rgba(16, 185, 129, .1);
  color: #059669;
}

.alert-modern.error {
  background: rgba(244, 63, 94, .1);
  color: #dc2626;
}

.alert-modern.warning {
  background: rgba(245, 158, 11, .1);
  color: #d97706;
}

.alert-modern.info {
  background: rgba(59, 130, 246, .1);
  color: #2563eb;
}

/* ─── Photo Thumbnail ─────────────────────────────────────── */
.photo-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  transition: transform var(--transition);
  border: 2px solid var(--border-color);
}


/* ─── Progress ────────────────────────────────────────────── */
.progress-modern {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-modern .progress-bar {
  border-radius: 4px;
  transition: width .6s ease;
}

/* ─── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.page-header .sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .content-area {
    padding: 16px;
  }

  .stat-value {
    font-size: 20px;
  }

  .login-card {
    padding: 32px 24px;
    margin: 16px;
  }
}

/* ─── SweetAlert custom ───────────────────────────────────── */
.swal2-popup {
  border-radius: var(--radius-lg) !important;
  font-family: 'Inter', sans-serif !important;
}

.swal2-confirm {
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
}

.swal2-cancel {
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
}

/* ─── Animations ──────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp .4s ease both;
}

.animate-in:nth-child(1) {
  animation-delay: .05s;
}

.animate-in:nth-child(2) {
  animation-delay: .10s;
}

.animate-in:nth-child(3) {
  animation-delay: .15s;
}

.animate-in:nth-child(4) {
  animation-delay: .20s;
}