/* ========================================
   RTZ CLUB - WhatsApp Automation Panel
   Cores da Identidade Visual RTZ CLUB
   ======================================== */

:root {
  --azul-noite: #101926;
  --azul-neblina: #233855;
  --areia-clara: #DAD2C3;
  --bege-supernova: #C09A6C;
  --branco: #FFFFFF;
  --preto: #000000;

  --bg-primary: var(--azul-noite);
  --bg-secondary: var(--azul-neblina);
  --bg-light: var(--areia-clara);
  --accent: var(--bege-supernova);
  --text-light: var(--branco);
  --text-dark: var(--preto);
}

@font-face {
  font-family: 'Bancher';
  src: url('https://rtzclub.com.br/wp-content/themes/developer/fonts/Bancher.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-light);
  margin: 0;
  min-height: 100vh;
}

h1, h2, h3, .page-header h2, .login-box h1, .stat-card .label {
  font-family: 'Bancher', 'Segoe UI', sans-serif;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 250px;
  background: var(--bg-secondary);
  padding: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(192, 154, 108, 0.15);
}

.sidebar-logo {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(192, 154, 108, 0.15);
}

.sidebar-logo img.logo-main {
  width: 120px;
  height: auto;
  margin-bottom: 4px;
}

.sidebar-logo img.logo-icon {
  width: 36px;
  height: 36px;
}

.sidebar-logo h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  margin: 0;
  letter-spacing: 2px;
}

.sidebar-logo small {
  color: var(--areia-clara);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* Nav icons */
.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.nav-icon path, .nav-icon circle, .nav-icon rect, .nav-icon line, .nav-icon polyline, .nav-icon polygon {
  stroke: var(--areia-clara);
  transition: stroke 0.2s;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  opacity: 1;
}

.sidebar-nav a:hover .nav-icon path,
.sidebar-nav a:hover .nav-icon circle,
.sidebar-nav a:hover .nav-icon rect,
.sidebar-nav a:hover .nav-icon line,
.sidebar-nav a:hover .nav-icon polyline,
.sidebar-nav a:hover .nav-icon polygon,
.sidebar-nav a.active .nav-icon path,
.sidebar-nav a.active .nav-icon circle,
.sidebar-nav a.active .nav-icon rect,
.sidebar-nav a.active .nav-icon line,
.sidebar-nav a.active .nav-icon polyline,
.sidebar-nav a.active .nav-icon polygon {
  stroke: var(--accent);
}

/* Nav count badges */
.nav-count {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(192, 154, 108, 0.2);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

.sidebar-nav a.active .nav-count {
  background: rgba(192, 154, 108, 0.3);
}

/* Eagle icon for Membros */
.icon-eagle {
  width: 20px;
  height: 20px;
  display: inline-block;
  background-image: url('/img/simbolo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.6;
  flex-shrink: 0;
}

.sidebar-nav a:hover .icon-eagle,
.sidebar-nav a.active .icon-eagle {
  opacity: 1;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--areia-clara);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(192, 154, 108, 0.1);
  color: var(--accent);
}

.sidebar-nav a.active {
  background: rgba(192, 154, 108, 0.15);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-nav a .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(192, 154, 108, 0.15);
  font-size: 12px;
  color: rgba(218, 210, 195, 0.5);
}

.sidebar-footer .user-name {
  color: var(--areia-clara);
  font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: 250px;
  padding: 32px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(192, 154, 108, 0.15);
}

.page-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-light);
}

.page-header .subtitle {
  color: var(--areia-clara);
  font-size: 13px;
  margin-top: 4px;
  opacity: 0.7;
}

/* ===== CARDS ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(192, 154, 108, 0.1);
}

.stat-card .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--areia-clara);
  opacity: 0.7;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
}

.stat-card .icon-big {
  font-size: 24px;
  float: right;
  opacity: 0.5;
}

/* ===== STATUS BADGE ===== */
.status-connected {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-disconnected {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-connected .status-dot { background: #2ecc71; }
.status-disconnected .status-dot { background: #e74c3c; }

/* ===== TABLES ===== */
.table-container {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(192, 154, 108, 0.1);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
}

.table-container th {
  background: rgba(16, 25, 38, 0.5);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 700;
}

.table-container td {
  padding: 12px 16px;
  border-top: 1px solid rgba(192, 154, 108, 0.05);
  font-size: 14px;
  color: var(--areia-clara);
}

.table-container tr:hover td {
  background: rgba(192, 154, 108, 0.05);
}

/* ===== BUTTONS ===== */
.btn-gold {
  background: linear-gradient(135deg, #C09A6C 0%, #d4b896 50%, #C09A6C 100%);
  color: var(--bg-primary);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  background-size: 200% 200%;
  text-decoration: none;
}

.btn-gold:hover {
  background-position: right center;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(192, 154, 108, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 10px 20px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  background: rgba(192, 154, 108, 0.1);
}

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

.btn-danger {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.btn-danger:hover {
  background: rgba(231, 76, 60, 0.25);
}

.btn-success {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--areia-clara);
  margin-bottom: 6px;
  font-weight: 600;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid rgba(192, 154, 108, 0.2);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 154, 108, 0.1);
}

.form-control::placeholder {
  color: rgba(218, 210, 195, 0.3);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23C09A6C' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(192, 154, 108, 0.15);
}

.modal-box h3 {
  margin: 0 0 20px;
  color: var(--accent);
  font-size: 18px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ===== QR CODE ===== */
.qr-container {
  background: white;
  padding: 16px;
  border-radius: 12px;
  display: inline-block;
  margin: 16px 0;
}

.qr-container img {
  max-width: 256px;
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-member {
  background: rgba(192, 154, 108, 0.15);
  color: var(--accent);
}

.badge-staff {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.badge-sent {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.badge-failed {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.badge-pending {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 8px;
  color: var(--text-light);
  font-size: 14px;
  min-width: 280px;
  animation: slideIn 0.3s ease;
}

.toast.error {
  border-color: #e74c3c;
}

.toast.success {
  border-color: #2ecc71;
}

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

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg-primary);
}

.login-box {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border: 1px solid rgba(192, 154, 108, 0.15);
  text-align: center;
}

.login-box h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 3px;
  margin: 0 0 4px;
}

.login-box .club-label {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--areia-clara);
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 32px;
}

.login-box .form-group {
  text-align: left;
}

.login-box .btn-gold {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  margin-top: 8px;
}

.login-error {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 12px;
  display: none;
}

/* ===== LOG LIST ===== */
.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(192, 154, 108, 0.05);
}

.log-item .time {
  font-size: 12px;
  color: rgba(218, 210, 195, 0.5);
  min-width: 60px;
}


/* ===== RESPONSIVE ===== */

/* Hamburger menu button (hidden on desktop) */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 201;
  background: var(--bg-secondary);
  border: 1px solid rgba(192, 154, 108, 0.3);
  color: var(--accent);
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

/* Tablet (768px and below) */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .sidebar {
    width: 250px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
  }

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

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 60px 16px 16px;
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header h2 {
    font-size: 20px;
  }

  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card .value {
    font-size: 24px;
  }

  .stat-card .label {
    font-size: 10px;
  }

  /* Tables scroll horizontally */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-container table {
    min-width: 600px;
  }

  .table-container th,
  .table-container td {
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Modal full width on mobile */
  .modal-box {
    width: 95%;
    max-width: none;
    padding: 20px;
    margin: 10px;
    max-height: 85vh;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions button,
  .modal-actions .btn-gold,
  .modal-actions .btn-outline {
    width: 100%;
    text-align: center;
  }

  /* Buttons */
  .btn-gold, .btn-outline {
    padding: 10px 16px;
    font-size: 13px;
  }

  /* Toast */
  .toast-container {
    left: 10px;
    right: 10px;
    top: 10px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* QR Code */
  .qr-container img {
    max-width: 200px;
  }

  /* Forms */
  .form-control {
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  /* Login */
  .login-box {
    padding: 24px;
    margin: 16px;
    max-width: none;
  }

  /* Action buttons wrap */
  .action-buttons,
  .toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Member cards expandable */
  .member-expand-content {
    padding: 12px !important;
  }

  .member-expand-content .detail-grid {
    grid-template-columns: 1fr !important;
  }

  /* Force all inline grids to single column on mobile */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Tabs horizontal scroll */
  [style*="display: flex"][style*="gap: 0"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Messages tabs */
  .tab-btn {
    font-size: 12px !important;
    padding: 10px 14px !important;
    white-space: nowrap;
  }

  /* Member detail grid */
  .detail-grid {
    grid-template-columns: 1fr !important;
  }

  /* Event cards responsive */
  .event-card {
    padding: 16px !important;
  }

  /* Birthday cards */
  .birthday-card .info {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  /* Toolbar/search bar stack */
  .toolbar,
  [style*="display: flex"][style*="gap: 8px"],
  [style*="display: flex"][style*="gap: 12px"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* But keep action buttons row */
  .event-actions,
  .milestone-row {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }

  /* Search input full width */
  input[type="text"][placeholder*="Buscar"],
  input[type="search"] {
    width: 100% !important;
  }

  /* Select full width */
  select.form-control {
    width: 100% !important;
  }

  /* Status badge position */
  .status-connected,
  .status-disconnected {
    font-size: 11px;
    padding: 4px 10px;
  }
}

/* Landscape mode on phones - show more desktop-like layout */
@media (max-width: 900px) and (orientation: landscape) {
  .menu-toggle {
    display: flex;
    top: 8px;
    left: 8px;
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .main-content {
    margin-left: 0;
    padding: 48px 16px 16px;
  }

  .stat-cards {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
  }

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

  .page-header {
    flex-direction: row !important;
    align-items: center;
  }

  /* Grids can use 2 columns in landscape */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Modal not full height */
  .modal-box {
    max-height: 80vh;
  }

  .modal-actions {
    flex-direction: row !important;
  }
}

/* Small phones (375px and below) */
@media (max-width: 400px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 56px 10px 10px;
  }

  .page-header h2 {
    font-size: 18px;
  }

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

  .btn-sm {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* Event cards */
  .event-card .event-actions {
    flex-wrap: wrap;
  }

  .event-card .event-actions button {
    font-size: 11px;
    padding: 4px 8px;
  }
}

/* ===== CHECKBOX MULTI-SELECT ===== */
.member-select-list {
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid rgba(192, 154, 108, 0.2);
  border-radius: 8px;
  padding: 8px;
}

.member-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
}

.member-select-item:hover {
  background: rgba(192, 154, 108, 0.05);
}

.member-select-item input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ===== LOADING ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--areia-clara);
  opacity: 0.5;
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(192, 154, 108, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
