/* ===================================================================
   CLIENTS MANAGEMENT - Matching marketing.css styling
   =================================================================== */

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

:root {
  --px-purple: #7B38C2;
  --px-ink: #0f1220;
  --px-ink-2: #171a2b;
  --px-border: #e9e9ef;
  --px-muted: #6b7280;
  --px-bg: #fafbfe;
  
  --radius: 18px;
  --shadow: 0 8px 28px rgba(15,18,32,.08);
  
  --gray-900: #2b2f42;
  --gray-700: #3b4153;
  --gray-600: #6b7280;
  --gray-400: #9ca3af;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f8f9fc;
  
  --white: #ffffff;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  
  --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: var(--font-family);
  background: var(--px-bg);
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================================================================
   HEADER (Matching marketing.css)
   =================================================================== */

.header {
  background: var(--white);
  padding: 14px 40px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1330px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topline {
  max-width: 1330px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-top: 6px;
  padding-bottom: 8px;
}

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

.logo-img {
  height: 52px;
  width: auto;
  display: block;
}

.header-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.title {
  font-weight: 800;
  font-size: 18px;
  color: #2b2f42;
}

.subtitle {
  color: #636a7a;
  font-weight: 500;
  font-size: 13px;
}

/* Purple gradient divider line */
.divider {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--px-purple), #b08be4 70%, #d6c7f2);
  opacity: 0.85;
  max-width: 1330px;
  margin: 0 auto;
}

/* ===================================================================
   STATS BAR
   =================================================================== */

.stats {
  max-width: 1330px;
  margin: 14px auto;
  background: var(--px-ink);
  color: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.stat b {
  font-size: 18px;
}

.badge {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  user-select: none;
  font-weight: 600;
}

.page-header {
  max-width: 1330px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ===================================================================
   BUTTONS
   =================================================================== */

.btn-primary,
.btn-secondary,
.btn-delete {
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--px-purple);
  color: var(--white);
}

.btn-primary:hover {
  background: #6a2fb0;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(123, 56, 194, 0.3);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-900);
  border: 2px solid var(--px-border);
}

.btn-secondary:hover {
  border-color: var(--px-purple);
  color: var(--px-purple);
}

.btn-delete {
  background: var(--error);
  color: var(--white);
}

.btn-delete:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}

/* ===================================================================
   MAIN CONTENT
   =================================================================== */

.main-content {
  max-width: 1330px;
  margin: 20px auto;
  padding: 0 40px;
}

/* ===================================================================
   SEARCH SECTION
   =================================================================== */

.search-section {
  margin-bottom: 20px;
}

.search-container {
  position: relative;
  max-width: 600px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  font-size: 14px;
  font-family: var(--font-family);
  font-weight: 500;
  border: 2px solid var(--px-border);
  border-radius: 12px;
  background: var(--white);
  color: var(--gray-900);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--px-purple);
  box-shadow: 0 0 0 3px rgba(123, 56, 194, 0.1);
}

/* ===================================================================
   CLIENTS CONTAINER
   =================================================================== */

.clients-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--px-muted);
  font-weight: 500;
  font-size: 15px;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--px-muted);
  font-weight: 500;
  font-size: 15px;
}

/* ===================================================================
   CLIENT CARD (Compact single-line layout)
   =================================================================== */

.client-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--px-border);
  padding: 16px 20px;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.client-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 36px rgba(15,18,32,.12);
  border-color: var(--px-purple);
}

.client-card-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 200px;
  flex-shrink: 0;
}

.client-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.client-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.2;
}

.client-company {
  font-size: 13px;
  font-weight: 600;
  color: var(--px-muted);
  line-height: 1.2;
}

.client-location {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}

.client-status {
  display: none; /* Hidden */
}

.status-badge {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-expired {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-expiring {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-role-manager {
  background: rgba(123, 56, 194, 0.1);
  color: #7B38C2;
  border: 1px solid rgba(123, 56, 194, 0.3);
}

.status-role-client {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.client-status {
  display: flex;
  gap: 8px;
  align-items: center;
}

.client-card-body {
  display: flex;
  gap: 30px;
  flex: 1;
  align-items: center;
}

.client-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}

.client-detail-label {
  font-weight: 600;
  color: var(--px-muted);
  font-size: 11px;
  line-height: 1.2;
}

.client-detail-value {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 13px;
  line-height: 1.2;
}

.client-card-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.btn-small {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  min-width: 110px;
  white-space: nowrap;
}

.btn-view {
  background: rgba(123, 56, 194, 0.1);
  color: var(--px-purple);
  border: 1px solid rgba(123, 56, 194, 0.3);
}

.btn-view:hover {
  background: var(--px-purple);
  color: var(--white);
}

.btn-edit {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-edit:hover {
  background: #3b82f6;
  color: var(--white);
}

/* ===================================================================
   MODAL
   =================================================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 18, 32, 0.6);
  backdrop-filter: blur(6px);
  overflow-y: auto;
}

.modal-content {
  background-color: var(--white);
  margin: 40px auto;
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  box-shadow: 0 20px 60px rgba(15, 18, 32, 0.25);
  border: 1px solid var(--px-border);
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--px-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  font-weight: 300;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--px-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ===================================================================
   FORM STYLES
   =================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-family);
  font-weight: 500;
  border: 2px solid var(--px-border);
  border-radius: 8px;
  background: var(--gray-50);
  color: var(--gray-900);
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--px-purple);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(123, 56, 194, 0.08);
}

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

#passwordOptional {
  font-weight: 400;
  color: var(--px-muted);
  font-size: 12px;
}

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

@media (max-width: 1024px) {
  .client-card-body {
    gap: 20px;
  }
  
  .client-detail {
    min-width: 120px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 12px 20px 0;
  }
  
  .main-content {
    padding: 0 20px;
  }
  
  .client-card {
    flex-wrap: wrap;
    padding: 16px;
  }
  
  .client-card-header {
    min-width: 100%;
  }
  
  .client-card-body {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .client-detail {
    min-width: calc(50% - 6px);
  }
  
  .client-card-footer {
    width: 100%;
    flex-direction: row;
  }
  
  .btn-small {
    flex: 1;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    width: 95%;
    margin: 20px auto;
  }
}