/* Date: 2026-02-16 */
/* File: customer-portal/styles.css */
/* Purpose: Customer Portal — complete styling */

:root {
  --cp-primary: #3b82f6;
  --cp-primary-hover: #2563eb;
  --cp-bg: #f8fafc;
  --cp-card-bg: #ffffff;
  --cp-text: #1e293b;
  --cp-text-muted: #64748b;
  --cp-border: #e2e8f0;
  --cp-success: #22c55e;
  --cp-warning: #f59e0b;
  --cp-danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cp-bg);
  color: var(--cp-text);
  min-height: 100vh;
}

/* Auth card */
.cp-auth-card {
  max-width: 420px;
  margin: 80px auto;
  padding: 32px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .08);
}

/* Form elements */
.cp-form-group {
  margin-bottom: 16px;
}

.cp-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
}

.cp-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.15s;
  outline: none;
}

.cp-input:focus {
  border-color: var(--cp-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}

select.cp-input {
  appearance: none;
  background: #fff 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='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 32px;
}

/* Alerts */
.cp-alert {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.cp-alert-error {
  background: #fef2f2;
  color: #dc2626;
}

.cp-alert-success {
  background: #f0fdf4;
  color: #16a34a;
}

/* Buttons */
.cp-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.cp-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cp-btn-primary {
  background: var(--cp-primary);
  color: white;
}

.cp-btn-primary:hover:not(:disabled) {
  background: var(--cp-primary-hover);
}

.cp-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.cp-btn-full {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

/* Layout */
.cp-layout {
  display: flex;
  min-height: 100vh;
}

.cp-sidebar {
  width: 240px;
  background: var(--cp-card-bg);
  border-right: 1px solid var(--cp-border);
  padding: 20px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.cp-sidebar-brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--cp-border);
  font-size: 18px;
  font-weight: 700;
  color: var(--cp-primary);
}

.cp-sidebar-nav {
  padding: 12px 0;
}

.cp-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--cp-text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.cp-sidebar-nav a:hover,
.cp-sidebar-nav a.active {
  background: #eff6ff;
  color: var(--cp-primary);
}

.cp-main {
  margin-left: 240px;
  flex: 1;
  padding: 24px;
  min-width: 0;
}

.cp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.cp-header h1 {
  font-size: 24px;
  font-weight: 700;
}

/* Cards grid */
.cp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.cp-card {
  background: var(--cp-card-bg);
  border: 1px solid var(--cp-border);
  border-radius: 12px;
  padding: 20px;
}

.cp-card-label {
  font-size: 13px;
  color: var(--cp-text-muted);
  margin-bottom: 4px;
}

.cp-card-value {
  font-size: 28px;
  font-weight: 700;
}

.cp-card-detail {
  font-size: 12px;
  color: var(--cp-text-muted);
  margin-top: 4px;
}

/* Table */
.cp-table-wrapper {
  background: var(--cp-card-bg);
  border: 1px solid var(--cp-border);
  border-radius: 12px;
  overflow: hidden;
  overflow-x: auto;
}

.cp-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

.cp-table th,
.cp-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--cp-border);
  font-size: 14px;
}

.cp-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--cp-text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badges */
.cp-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

.cp-badge-active {
  background: #dcfce7;
  color: #166534;
}

.cp-badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.cp-badge-trial {
  background: #dbeafe;
  color: #1e40af;
}

.cp-badge-locked {
  background: #fee2e2;
  color: #991b1b;
}

.cp-badge-suspended {
  background: #e2e3e5;
  color: #383d41;
}

/* Progress bar */
.cp-progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.cp-progress-fill {
  height: 100%;
  background: var(--cp-primary);
  border-radius: 4px;
  transition: width 0.3s;
}

.cp-progress-fill.warning {
  background: var(--cp-warning);
}

.cp-progress-fill.danger {
  background: var(--cp-danger);
}

/* Modal */
.cp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.cp-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
}

/* Loading state */
.cp-loading {
  text-align: center;
  padding: 24px;
  color: var(--cp-text-muted);
  font-size: 14px;
}

/* Mobile sidebar toggle */
.cp-mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--cp-card-bg);
  border: 1px solid var(--cp-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 20px;
  cursor: pointer;
}

/* Pagination links */
#users-pagination a {
  color: var(--cp-primary);
  text-decoration: none;
  margin: 0 8px;
  font-size: 14px;
}

#users-pagination a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .cp-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    position: fixed;
  }

  .cp-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, .1);
  }

  .cp-main {
    margin-left: 0;
    padding: 16px;
    padding-top: 56px;
  }

  .cp-mobile-toggle {
    display: block;
  }

  .cp-auth-card {
    margin: 40px 16px;
    padding: 24px;
  }

  .cp-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .cp-header input {
    width: 100% !important;
  }

  .cp-cards {
    grid-template-columns: 1fr;
  }
}