/**
 * Shared plugin UI styles.
 * Uses CSS variables defined by the main quote-web application (app.css).
 * Fallback values match the application's design tokens.
 *
 * Primary color:   hsl(218, 75%, 20%)  ≈ #0d2959
 * Border radius:   var(--radius)        = 0.5rem
 * Border color:    hsl(214.3, 31.8%, 91.4%)
 */

/* ===== BUTTONS ===== */

.plugin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  border-radius: var(--radius, 0.5rem);
  font-size: 14px;
  font-weight: 500;
  height: 36px;
  padding: 0 16px;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out, opacity 0.15s ease-in-out,
    border-color 0.15s ease-in-out;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
  box-sizing: border-box;
}

.plugin-btn:focus-visible {
  outline: 2px solid hsl(var(--ring, 218 75% 20%));
  outline-offset: 2px;
}

.plugin-btn:disabled,
.plugin-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary button — filled navy */
.plugin-btn-primary {
  background-color: hsl(var(--primary, 218, 75%, 20%));
  color: hsl(var(--primary-foreground, 210 40% 98%));
}

.plugin-btn-primary:not(:disabled):not([disabled]):hover {
  background-color: hsl(218, 75%, 16%);
}

/* Secondary button — light fill with border */
.plugin-btn-secondary {
  background-color: hsl(var(--secondary, 210 40% 96.1%));
  color: hsl(var(--secondary-foreground, 222.2 47.4% 11.2%));
  border: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));
}

.plugin-btn-secondary:not(:disabled):not([disabled]):hover {
  background-color: hsl(210, 40%, 91%);
}

/* Outline button — transparent bg */
.plugin-btn-outline {
  background-color: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--foreground, 222.2 84% 4.9%));
  border: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));
}

.plugin-btn-outline:not(:disabled):not([disabled]):hover {
  background-color: hsl(var(--accent, 210 40% 96.1%));
  color: hsl(var(--accent-foreground, 222.2 47.4% 11.2%));
}

/* Small size modifier */
.plugin-btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

/* ===== INPUT & SELECT ===== */

.plugin-input,
.plugin-select {
  height: 36px;
  border-radius: var(--radius, 0.5rem);
  border: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));
  background-color: hsl(var(--background, 0 0% 100%));
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  color: hsl(var(--foreground, 222.2 84% 4.9%));
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.plugin-input:focus,
.plugin-select:focus {
  border-color: hsl(var(--ring, 218 75% 20%));
  box-shadow: 0 0 0 2px hsl(218 75% 20% / 0.15);
}

.plugin-select {
  cursor: pointer;
  appearance: auto;
}

/* ===== LABEL ===== */

.plugin-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--foreground, 222.2 84% 4.9%));
}

.plugin-required {
  color: hsl(var(--destructive, 0 84.2% 60.2%));
  margin-left: 2px;
}

/* ===== PAGE HEADER (banner at top of plugin panel) ===== */

.plugin-page-header {
  background-color: hsl(var(--primary, 218, 75%, 20%));
  color: hsl(var(--primary-foreground, 210 40% 98%));
  padding: 10px 20px;
  margin: 0 0 20px 0;
  border-radius: var(--radius, 0.5rem);
  font-size: 18px;
  font-weight: 600;
}

.plugin-section-title {
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--foreground, 222.2 84% 4.9%));
  padding-bottom: 5px;
  margin: 0 0 4px 0;
}

/* ===== ALERT BOXES ===== */

.plugin-alert {
  padding: 10px 12px;
  border-radius: var(--radius, 0.5rem);
  margin-bottom: 16px;
  font-size: 14px;
}

.plugin-alert-error {
  color: hsl(var(--destructive, 0 84.2% 60.2%));
  border: 1px solid hsl(var(--destructive, 0 84.2% 60.2%));
  background-color: hsl(0 84.2% 60.2% / 0.08);
}

.plugin-alert-success {
  color: hsl(142.1 76.2% 30%);
  border: 1px solid hsl(142.1 76.2% 36.3%);
  background-color: hsl(142.1 76.2% 36.3% / 0.1);
}

/* ===== TOOLBAR ===== */

.plugin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ===== LOCKED OVERLAY ===== */

.plugin-locked-overlay {
  position: absolute;
  z-index: 100;
  top: 100px;
  right: 0;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(200, 200, 200, 0.5);
}

.plugin-locked-message {
  padding: 12px 24px;
  color: hsl(var(--foreground, 222.2 84% 4.9%));
  font-size: 18px;
  font-weight: bold;
  background: hsl(var(--background, 0 0% 100%));
  border-radius: var(--radius, 0.5rem);
  border: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* ===== CARD / PANEL ===== */

.plugin-card {
  background-color: hsl(var(--muted, 210 40% 96.1%));
  border: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));
  border-left: 3px solid hsl(var(--primary, 218, 75%, 20%));
  border-radius: var(--radius, 0.5rem);
  padding: 20px;
  margin-bottom: 20px;
}

.plugin-card-title {
  margin: 0 0 15px 0;
  color: hsl(var(--primary, 218, 75%, 20%));
  font-size: 16px;
  font-weight: 600;
}

/* ===== PROGRESS OVERLAY ===== */

.plugin-progress-overlay {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.12);
  z-index: 50;
}

.plugin-progress-box {
  background: hsl(var(--background, 0 0% 100%));
  min-width: 220px;
  border: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));
  border-radius: var(--radius, 0.5rem);
  padding: 16px 20px;
  text-align: center;
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  font-size: 14px;
  color: hsl(var(--foreground, 222.2 84% 4.9%));
}

/* ===== DOWNLOAD LINK STYLED AS BUTTON ===== */

.plugin-download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius, 0.5rem);
  font-size: 14px;
  font-weight: 500;
  color: hsl(var(--primary, 218, 75%, 20%));
  background-color: hsl(var(--background, 0 0% 100%));
  border: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
  margin-bottom: 8px;
}

.plugin-download-link:hover {
  background-color: hsl(var(--accent, 210 40% 96.1%));
  border-color: hsl(var(--primary, 218, 75%, 20%));
  text-decoration: none;
}

/* ===== GRID TABLE ===== */

.plugin-grid-header-cell {
  padding: 6px 5px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: hsl(var(--foreground, 222.2 84% 4.9%));
  background-color: hsl(var(--muted, 210 40% 96.1%));
  border-bottom: 2px solid hsl(var(--border, 214.3 31.8% 91.4%));
  word-break: break-word;
  white-space: normal;
}

.plugin-grid-cell {
  padding: 5px;
  text-align: center;
  word-break: break-word;
  white-space: normal;
  font-size: 0.85em;
  color: hsl(var(--foreground, 222.2 84% 4.9%));
}

.plugin-grid-divider {
  width: 100%;
  border: none;
  border-top: 1px solid hsl(var(--border, 214.3 31.8% 91.4%));
  margin: 4px 0;
}

/* ===== RESTORE PLUGIN ===== */

.restore-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  font-family: system-ui, sans-serif;
}

.restore-header-container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.restore-title-container {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  align-items: baseline;
}

.restore-label-title {
  font-weight: 800;
  font-size: 1.5rem;
  color: hsl(var(--foreground, 222.2 84% 4.9%));
}

.restore-label-subtitle {
  text-align: center;
  border-radius: 50px;
  background: hsl(var(--primary, 218, 75%, 20%));
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--primary-foreground, 210 40% 98%));
  position: relative;
  top: -4px;
}

.restore-body-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-family: system-ui, sans-serif;
}

.restore-btn-container {
  width: 8rem;
  min-width: 0;
  height: 2.2rem;
  display: flex;
  align-items: center;
  text-align: center;
}

.restore-action-btn {
  min-width: 0;
  width: 8rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius, 0.5rem);
  border: 1px solid hsl(var(--primary, 218, 75%, 20%));
  background-color: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--primary, 218, 75%, 20%));
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.restore-action-btn:hover:not(:disabled) {
  background-color: hsl(var(--primary, 218, 75%, 20%));
  color: hsl(var(--primary-foreground, 210 40% 98%));
}

.restore-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.restore-status-restored {
  color: hsl(142.1 76.2% 30%);
  font-weight: 600;
  padding-left: 6px;
}

.restore-status-failed {
  color: hsl(var(--destructive, 0 84.2% 60.2%));
  font-weight: 600;
  padding-left: 6px;
}

