/**
 * LDCS Frontend Styles
 *
 * Styles for certificate status alerts, badges, and tables
 * displayed on LearnDash course and quiz pages.
 *
 * Uses the same design tokens as the admin panel for consistency.
 *
 * @package ldcs
 */

/* ===================================================================
 *  Design Tokens (frontend subset)
 * =================================================================== */

:root {
  --ldcs-green: #16a34a;
  --ldcs-green-bg: #f0fdf4;
  --ldcs-green-border: rgba(22, 163, 74, 0.2);

  --ldcs-amber: #d97706;
  --ldcs-amber-bg: #fffbeb;
  --ldcs-amber-border: rgba(217, 119, 6, 0.2);

  --ldcs-gray-50: #f9fafb;
  --ldcs-gray-100: #f3f4f6;
  --ldcs-gray-200: #e5e7eb;
  --ldcs-gray-400: #9ca3af;
  --ldcs-gray-500: #6b7280;
  --ldcs-gray-700: #374151;
  --ldcs-gray-800: #1f2937;
  --ldcs-gray-900: #111827;
  --ldcs-border: #e5e7eb;

  --ldcs-blue: #2563eb;
  --ldcs-blue-hover: #1d4ed8;

  --ldcs-radius-sm: 6px;
  --ldcs-radius: 8px;
  --ldcs-radius-pill: 9999px;
  --ldcs-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ===================================================================
 *  Alert boxes (course/quiz frontend)
 * =================================================================== */

.ldcs-front-alert {
  margin-bottom: 20px;
}

.ldcs-front-alert--signed .ld-alert-icon::before {
  color: var(--ldcs-green);
}

.ldcs-front-alert--waiting .ld-alert-icon::before {
  color: var(--ldcs-amber);
}

/* ===================================================================
 *  Status badges
 * =================================================================== */

.ldcs-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--ldcs-radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.ldcs-badge--signed {
  background: var(--ldcs-green-bg);
  color: var(--ldcs-green);
  border: 1px solid var(--ldcs-green-border);
}

.ldcs-badge--waiting {
  background: var(--ldcs-amber-bg);
  color: var(--ldcs-amber);
  border: 1px solid var(--ldcs-amber-border);
}

.ldcs-badge--incomplete {
  background: var(--ldcs-gray-100);
  color: var(--ldcs-gray-500);
  border: 1px solid var(--ldcs-gray-200);
}

/* ===================================================================
 *  Certificate table (course page - quiz cert summary)
 * =================================================================== */

.ldcs-course-cert-summary {
  margin-top: 24px;
}

.ldcs-cert-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin-top: 12px;
  font-size: 14px;
  border: 1px solid var(--ldcs-gray-200);
  border-radius: var(--ldcs-radius);
  overflow: hidden;
  box-shadow: var(--ldcs-shadow-sm);
}

.ldcs-cert-table th,
.ldcs-cert-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--ldcs-gray-200);
}

.ldcs-cert-table th {
  font-weight: 600;
  color: var(--ldcs-gray-900);
  background: var(--ldcs-gray-50);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ldcs-cert-table td {
  color: var(--ldcs-gray-700);
}

.ldcs-cert-table tr:last-child td {
  border-bottom: none;
}

.ldcs-cert-table tr:hover td {
  background: var(--ldcs-gray-50);
}

/* ===================================================================
 *  Admin hint (shown only to admins on frontend)
 * =================================================================== */

.ldcs-admin-hint {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ldcs-gray-500);
  font-style: italic;
}

.ldcs-admin-hint a {
  color: var(--ldcs-blue);
}

.ldcs-admin-hint a:hover {
  color: var(--ldcs-blue-hover);
}

/* ===================================================================
 *  Quiz result box - LDCS certificate alert
 * =================================================================== */

body .sfwd-quiz .learndash_content_wrap .ld-alert.ldcs-alert {
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
}

/* Small text used in admin hints within alerts */
.lcs-smalltext {
  font-size: 12px;
}

.lcs-text-alter {
  color: var(--ldcs-gray-500);
  font-style: italic;
}

/* ===================================================================
 *  "Czeka na podpis" badge (profile quiz-row CERTYFIKAT column)
 * =================================================================== */

.ldcs-cert-pending {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--ldcs-amber-bg);
  color: var(--ldcs-amber);
  border: 1px solid var(--ldcs-amber-border);
  border-radius: var(--ldcs-radius-pill);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
}

.ldcs-cert-pending-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><polyline points='12 6 12 12 16 14'/></svg>") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><polyline points='12 6 12 12 16 14'/></svg>") no-repeat center / contain;
}

/* ===================================================================
 *  Modal (reused from the LDCS admin panel)
 * =================================================================== */

body.ldcs-modal-open {
  overflow: hidden;
}

.ldcs-modal {
  position: fixed;
  inset: 0;
  z-index: 100100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ldcs-modal[aria-hidden="true"] {
  display: none;
}

.ldcs-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.ldcs-modal-dialog {
  position: relative;
  width: 640px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  background: #fff;
  border-radius: var(--ldcs-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ldcs-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ldcs-border);
}

.ldcs-modal-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ldcs-gray-800);
}

.ldcs-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--ldcs-gray-400);
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}

.ldcs-modal-close:hover,
.ldcs-modal-close:focus-visible {
  color: var(--ldcs-gray-700);
  background: var(--ldcs-gray-100);
}

.ldcs-modal-close:disabled {
  cursor: default;
  opacity: 0.4;
}

.ldcs-modal-body {
  padding: 20px;
  overflow-y: auto;
}

