/* Principal Project BMS — visual language aligned with crm.stocktontownfc.com */

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

html,
body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f7fa;
  color: #2c3e50;
  min-height: 100vh;
}

a {
  color: #3498db;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ========== Auth / login (CRM style) ========== */
body.auth-body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  min-height: 100vh;
}

body.auth-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 0;
}

.login-container {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 30px 24px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: slideUp 0.45s ease-out;
  opacity: 1;
}

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

.logo-section {
  text-align: center;
  margin-bottom: 28px;
}

.logo-section h1 {
  color: #333;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.logo-section p {
  color: #666;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: #333;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea,
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
  color: #2c3e50;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.form-group textarea,
.field textarea {
  min-height: 130px;
  resize: vertical;
}

.login-button,
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-button:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
  text-decoration: none;
  color: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  width: auto;
  padding: 10px 18px;
  font-size: 14px;
}

.btn-secondary {
  background: #3498db;
  color: #fff;
}

.btn-secondary:hover {
  background: #2980b9;
  color: #fff;
  text-decoration: none;
}

.btn-success {
  background: #27ae60;
  color: #fff;
}

.btn-danger {
  background: #e74c3c;
  color: #fff;
}

.btn-ghost {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  color: #2c3e50;
}

.btn-ghost:hover {
  background: #e9ecef;
  text-decoration: none;
}

.footer-text {
  text-align: center;
  margin-top: 22px;
  color: #999;
  font-size: 12px;
}

.error-message,
.flash-error {
  background: #fee;
  color: #c33;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.flash-success {
  background: #e8f8ef;
  color: #1e7e46;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

/* ========== App shell (CRM sidebar) ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  left: 0;
  top: 0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
  padding: 24px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.sidebar-header p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 14px 20px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: all 0.25s ease;
  border-left: 3px solid transparent;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: #3498db;
  color: white;
  text-decoration: none;
}

.menu-item.active {
  background: rgba(255, 255, 255, 0.15);
  border-left-color: #3498db;
  color: white;
  font-weight: 600;
}

.menu-item i {
  margin-right: 12px;
  width: 22px;
  display: inline-block;
}

.menu-section {
  padding: 12px 20px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 700;
}

.user-info {
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info p {
  font-size: 13px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.9);
}

.logout-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: rgba(231, 76, 60, 0.2);
  color: #ff6b6b;
  text-align: center;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(231, 76, 60, 0.35);
}

.logout-btn:hover {
  background: rgba(231, 76, 60, 0.35);
  text-decoration: none;
  color: #fff;
}

.mobile-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1100;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.main-content {
  margin-left: 260px;
  padding: 28px 32px 40px;
  width: calc(100% - 260px);
  min-height: 100vh;
}

.welcome-section {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

.welcome-section h1 {
  color: #2c3e50;
  font-size: 30px;
  margin-bottom: 8px;
}

.welcome-section p {
  color: #7f8c8d;
  font-size: 15px;
  line-height: 1.6;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: inherit;
  display: block;
}

a.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.stat-card h3 {
  color: #7f8c8d;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-card .value {
  color: #2c3e50;
  font-size: 30px;
  font-weight: 700;
}

.stat-card.success .value {
  color: #27ae60;
}

.stat-card.warning .value {
  color: #f39c12;
}

.stat-card.danger .value {
  color: #e74c3c;
}

.dashboard-card,
.panel {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.dashboard-card h2,
.panel h2 {
  color: #2c3e50;
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f0;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.quick-action-btn {
  padding: 12px 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.quick-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.35);
  text-decoration: none;
  color: #fff;
}

.quick-action-btn.secondary {
  background: #3498db;
}

.quick-action-btn.success {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: #083344;
}

.filters,
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.quick-links a {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 999px;
  color: #2c3e50;
  font-size: 13px;
  font-weight: 600;
}

.quick-links a.active,
.quick-links a:hover {
  background: #3498db;
  border-color: #3498db;
  color: #fff;
  text-decoration: none;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #7f8c8d;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #ecf0f1;
  color: #2c3e50;
}

.badge-new,
.badge-open {
  background: #d6eaf8;
  color: #1a5276;
}

.badge-urgent,
.badge-high {
  background: #fdebd0;
  color: #9a3412;
}

.badge-resolved,
.badge-closed {
  background: #d5f5e3;
  color: #196f3d;
}

.badge-awaiting_customer,
.badge-awaiting_internal {
  background: #fcf3cf;
  color: #7d6608;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #2c3e50;
  font-size: 14px;
}

.ticket-layout {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
}

.meta-list {
  display: grid;
  gap: 10px;
}

.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.meta-list dt {
  color: #7f8c8d;
  font-weight: 600;
}

.meta-list dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
}

.thread {
  display: grid;
  gap: 12px;
}

.note {
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}

.note.internal {
  background: #f8f9fa;
  border-left: 4px solid #95a5a6;
}

.note.customer,
.note.reply {
  border-left: 4px solid #3498db;
}

.note.system {
  border-left: 4px solid #f39c12;
  background: #fffaf0;
}

.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #7f8c8d;
  font-size: 12px;
  margin-bottom: 8px;
}

.muted {
  color: #7f8c8d;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.public-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.public-header {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.public-header h1 {
  color: #2c3e50;
  margin-bottom: 6px;
}

.tv-body {
  background: #1a252f;
  color: #ecf0f1;
}

.tv-body .main-content {
  margin-left: 0;
  width: 100%;
}

.tv-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 18px;
}

.tv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.tv-stat {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 18px;
}

.tv-stat .label {
  color: #95a5a6;
  font-weight: 600;
  font-size: 13px;
}

.tv-stat .value {
  display: block;
  margin-top: 6px;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: #fff;
}

@media (max-width: 1024px) {
  .mobile-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-110%);
    transition: transform 0.25s ease;
  }

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

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

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

  .form-grid,
  .ticket-layout,
  .tv-grid {
    grid-template-columns: 1fr;
  }
}
