/* TCC Modern App Styles — v2.0 */
/* Design language matches Professional Winner CRM */

:root {
  --primary: #1a5276;
  --primary-dark: #154360;
  --primary-light: #2980b9;
  --accent: #2563eb;
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   TOP BAR — Shared navigation
   ========================================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  height: 60px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.top-bar .tcc-logo {
  height: 42px;
  width: auto;
  max-width: 160px;
  display: block;
  object-fit: contain;
  /* logo on dark bar — no filter needed, icon has transparent bg */
}

.top-bar .bar-title {
  color: white;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar .bar-title .tag {
  background: rgba(255,255,255,0.2);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.top-bar .top-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-bar .top-links a,
.top-bar .top-links span {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.top-bar .top-links a:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.top-bar .top-links .user-name {
  font-weight: 400;
  opacity: 0.85;
  font-size: 12px;
}

/* ==========================================
   PW BRANDING FOOTER
   ========================================== */
.pw-branding {
  text-align: center;
  padding: 20px 16px;
  padding-bottom: calc(20px + var(--safe-bottom));
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.6;
}

.pw-branding a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.pw-branding a:hover {
  text-decoration: underline;
}

.pw-branding .pw-mark {
  font-weight: 700;
  color: var(--text-muted);
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */
h1, h2, h3 {
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

/* ==========================================
   CARDS
   ========================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid var(--border-light);
}

.card + .card {
  margin-top: 12px;
}

/* ==========================================
   BUTTONS
   ========================================== */
a.button, button.btn, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.4;
}

a.button, .btn-primary {
  background: var(--primary);
  color: white;
}

a.button:hover, .btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-alt);
  border-color: #cbd5e1;
}

a.button.green, .btn-success {
  background: var(--success);
  color: white;
}

a.button.gray, .btn-ghost {
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

a.button.blue {
  background: var(--primary-light);
  color: white;
}

/* ==========================================
   FORMS
   ========================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

form label + label {
  margin-top: 12px;
}

/* ==========================================
   NAV LINKS (Home page style)
   ========================================== */
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-list a, .nav-list .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.nav-list a:hover, .nav-list .nav-item:hover {
  background: var(--surface-alt);
}

.nav-list a .icon, .nav-list .nav-item .icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.nav-list .divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0;
}

/* ==========================================
   TABLE (Admin)
   ========================================== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 14px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-light);
}

th {
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  user-select: none;
}

th a {
  color: var(--text-muted);
  text-decoration: none;
}

th a:hover {
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

tr.inactive {
  opacity: 0.5;
}

@media (max-width: 768px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: auto;
  }
}

/* ==========================================
   BADGES
   ========================================== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  margin-left: 6px;
}

/* ==========================================
   MEMBER PHOTOS
   ========================================== */
img.member-photo {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  border: 2px solid var(--border-light);
}

@media (max-width: 600px) {
  img.member-photo {
    width: 36px;
    height: 36px;
  }
}

/* ==========================================
   MODALS
   ========================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--surface);
  margin: 40px auto;
  padding: 24px;
  width: 92%;
  max-width: 480px;
  border-radius: var(--radius-lg);
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-content .close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

.modal-content .close:hover {
  color: var(--text);
}

.modal-content h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

body.modal-open {
  overflow: hidden;
}

#editModal .modal-content,
#newModal .modal-content {
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content .save-btn {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

.modal-content .save-btn:hover {
  background: var(--primary-dark);
}

/* ==========================================
   TOAST
   ========================================== */
#toast.toast-container, .toast {
  position: fixed;
  bottom: 30px;
  right: 20px;
  left: 20px;
  max-width: 360px;
  margin: 0 auto;
  background: var(--text);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   STATUS & ACTION BUTTONS
   ========================================== */
.status-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.status-btn:hover {
  background: var(--surface-alt);
}

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.delete-btn:hover {
  opacity: 1;
}

.reset-btn {
  background: var(--warning);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
}

/* ==========================================
   FILTERS
   ========================================== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.filters label {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}

.filters select {
  width: auto;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 13px;
}

.filters button {
  padding: 6px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

/* ==========================================
   UTILITY
   ========================================== */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

.container-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.gap-2 { gap: 12px; }

/* ==========================================
   PAGE CONTENT WRAPPERS
   ========================================== */
.page-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px;
}

.page-content-wide {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* ==========================================
   FORM CARD
   ========================================== */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  border: 1px solid var(--border-light);
}

.form-card form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-card form button[type="submit"],
.form-card form input[type="submit"] {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  margin-top: 12px;
  transition: background 0.15s;
}

.form-card form button[type="submit"]:hover,
.form-card form input[type="submit"]:hover {
  background: var(--primary-dark);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 480px) {
  .top-bar {
    height: 54px;
    padding: 0 12px;
  }

  .top-bar .tcc-logo {
    height: 36px;
  }

  .top-bar .top-links a,
  .top-bar .top-links span {
    font-size: 12px;
    padding: 4px 6px;
  }

  .top-bar .top-links .user-name {
    display: none;
  }

  h1 { font-size: 20px; }

  .card {
    padding: 16px;
    border-radius: var(--radius-sm);
  }

  .container {
    padding: 12px;
  }
}
