/* Sprintology customer backend pages */

.sp-backend-page {
  min-height: 100vh;
  background: #F5F3FF;
  font-family: 'Poppins', sans-serif;
  padding-bottom: 40px;
}

.sp-backend-header {
  background: #5B21B6;
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sp-backend-header a {
  color: #fff;
  text-decoration: none;
}
.sp-backend-header .logo {
  font-family: 'Starc Serif', serif;
  font-size: 1.5rem;
}
.sp-backend-header .nav a {
  margin-left: 20px;
  font-size: 0.9rem;
}

.sp-auth-container {
  max-width: 420px;
  margin: 60px auto;
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 10px 30px rgba(107, 33, 168, 0.12);
}
.sp-auth-container h1 {
  font-family: 'Starc Serif', serif;
  color: #5B21B6;
  margin: 0 0 8px;
  font-size: 1.75rem;
}
.sp-auth-container p {
  color: #6B7280;
  margin: 0 0 24px;
  font-size: 0.95rem;
}
.sp-form-group {
  margin-bottom: 18px;
}
.sp-form-group label {
  display: block;
  font-size: 0.85rem;
  color: #374151;
  margin-bottom: 6px;
  font-weight: 500;
}
.sp-form-group input,
.sp-form-group select,
.sp-form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  box-sizing: border-box;
}
.sp-form-group input:focus,
.sp-form-group select:focus,
.sp-form-group textarea:focus {
  outline: none;
  border-color: #5B21B6;
  box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.1);
}
.sp-btn {
  display: inline-block;
  background: #5B21B6;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.sp-btn:hover {
  background: #4C1D95;
}
.sp-btn-block {
  width: 100%;
}
.sp-btn-secondary {
  background: #fff;
  color: #5B21B6;
  border: 1px solid #5B21B6;
}
.sp-btn-secondary:hover {
  background: #F5F3FF;
}
.sp-btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}
.sp-error {
  background: #FEF3C7;
  color: #991B1B;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}
.sp-success {
  background: #D1FAE5;
  color: #065F46;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}
.sp-auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: #6B7280;
}
.sp-auth-footer a {
  color: #5B21B6;
  text-decoration: none;
  font-weight: 500;
}

.sp-dashboard {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 24px;
}
.sp-dashboard h1 {
  font-family: 'Starc Serif', serif;
  color: #111827;
  margin: 0 0 8px;
}
.sp-dashboard .subtitle {
  color: #6B7280;
  margin: 0 0 24px;
}

.sp-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #E5E7EB;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.sp-tab {
  background: none;
  border: none;
  padding: 12px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  color: #6B7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.sp-tab.active {
  color: #5B21B6;
  border-bottom-color: #5B21B6;
  font-weight: 600;
}

.sp-panel {
  display: none;
}
.sp-panel.active {
  display: block;
}

.sp-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}
.sp-card h2 {
  font-family: 'Starc Serif', serif;
  color: #5B21B6;
  margin: 0 0 16px;
  font-size: 1.25rem;
}

.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.sp-table-wrap {
  overflow-x: auto;
}
.sp-table th,
.sp-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #E5E7EB;
}
.sp-table th {
  color: #5B21B6;
  font-weight: 600;
}
.status-select {
  padding: 6px 10px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  background: #fff;
  color: #374151;
  cursor: pointer;
}
.status-select:focus {
  outline: none;
  border-color: #5B21B6;
}
.sp-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.sp-badge-pending { background: #FEF3C7; color: #92400E; }
.sp-badge-reviewing { background: #DBEAFE; color: #1E40AF; }
.sp-badge-approved { background: #D1FAE5; color: #065F46; }
.sp-badge-declined { background: #FEF3C7; color: #991B1B; }
.sp-badge-processing { background: #F5F3FF; color: #5B21B6; }
.sp-badge-shipped { background: #E0E7FF; color: #3730A3; }
.sp-badge-delivered { background: #D1FAE5; color: #065F46; }
.sp-badge-cancelled { background: #F3F4F6; color: #6B7280; }

.sp-address-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.sp-address-card {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 16px;
  position: relative;
}
.sp-address-card .default-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #5B21B6;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
}
.sp-address-actions {
  margin-top: 12px;
}

.sp-dropzone {
  border: 2px dashed #D1D5DB;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  color: #6B7280;
  cursor: pointer;
  transition: border-color 0.2s;
}
.sp-dropzone:hover,
.sp-dropzone.dragover {
  border-color: #5B21B6;
  color: #5B21B6;
}
.sp-dropzone input {
  display: none;
}

.sp-detail-row {
  padding: 10px 0;
  border-bottom: 1px solid #E5E7EB;
  color: #374151;
  font-size: 0.95rem;
}
.sp-detail-row strong {
  color: #5B21B6;
  display: inline-block;
  min-width: 100px;
}
.sp-order-card:hover {
  border-color: #5B21B6;
}

.sp-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.sp-section h2 {
  font-family: 'Starc Serif', serif;
  color: #5B21B6;
  margin: 0 0 12px;
  font-size: 1.1rem;
}

/* Chat, tags, and notes */
.sp-chat-section,
.sp-tags-section,
.sp-notes-section {
  font-size: 0.95rem;
}

.sp-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sp-chat-message {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.sp-chat-message.customer {
  align-self: flex-start;
}

.sp-chat-message.staff {
  align-self: flex-end;
  align-items: flex-end;
}

.sp-chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.sp-chat-message.customer .sp-chat-bubble {
  background: #fff;
  color: #111827;
  border: 1px solid #E5E7EB;
  border-bottom-left-radius: 4px;
}

.sp-chat-message.staff .sp-chat-bubble {
  background: #5B21B6;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.sp-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
}

.sp-tag-remove {
  opacity: 0.8;
}
.sp-tag-remove:hover {
  opacity: 1;
}

.sp-note p {
  margin: 0;
}

@media (max-width: 640px) {
  .sp-auth-container {
    margin: 24px 16px;
    padding: 24px;
  }
  .sp-dashboard {
    padding: 0 16px;
  }
  .sp-table {
    display: block;
    overflow-x: auto;
  }
  .sp-charts-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ------------------------------------------------------------------ */
/* Live dashboard                                                      */
/* ------------------------------------------------------------------ */
.stat-big {
  font-size: 2rem;
  font-weight: 700;
  color: #5B21B6;
  margin: 0;
}

#dashboard-connection {
  font-weight: 600;
  color: #16A34A;
}

.sp-feed-list {
  display: flex;
  flex-direction: column;
}
.sp-feed-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #F3F4F6;
  animation: sp-feed-flash 1.6s ease-out;
}
.sp-feed-item:last-child { border-bottom: none; }
.sp-feed-icon {
  font-size: 1.2rem;
  line-height: 1.4;
}
.sp-feed-body { flex: 1; }
.sp-feed-title {
  font-weight: 600;
  color: #111827;
  text-transform: capitalize;
}
.sp-feed-meta {
  font-size: 0.78rem;
  color: #9CA3AF;
  margin-top: 2px;
}
@keyframes sp-feed-flash {
  0% { background: #EDE9FE; }
  100% { background: transparent; }
}

/* Deadline / production-scheduling badges */
.sp-deadline-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.deadline-on_track { background: #DCFCE7; color: #166534; }
.deadline-at_risk  { background: #FEF3C7; color: #92400E; }
.deadline-overdue  { background: #FEE2E2; color: #991B1B; }
.deadline-paused   { background: #E5E7EB; color: #374151; }
.deadline-done     { background: #E0E7FF; color: #3730A3; }
.deadline-none     { background: #F3F4F6; color: #6B7280; }
