/* ==========================================================================
   Widget Transcription — IntelliSoins
   Styles for the transcription iframe widget embedded in Element Web.
   ========================================================================== */

/* -- Custom properties --------------------------------------------------- */
:root {
  --color-primary: #1a73e8;
  --color-primary-dark: #1557b0;
  --color-primary-light: #e8f0fe;
  --color-danger: #d93025;
  --color-danger-dark: #b3261e;
  --color-success: #1e8e3e;
  --color-warning: #f9ab00;
  --color-text: #202124;
  --color-text-secondary: #5f6368;
  --color-bg: #ffffff;
  --color-bg-subtle: #f8f9fa;
  --color-border: #dadce0;
  --color-header-bg: #1a2332;
  --color-header-text: #ffffff;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
  --transition: 200ms ease;
}

/* -- Reset --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

/* -- Header -------------------------------------------------------------- */
.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--color-header-bg);
  color: var(--color-header-text);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-icon {
  font-size: 18px;
}

.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 12px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* -- Footer -------------------------------------------------------------- */
.widget-footer {
  padding: 8px 16px;
  text-align: center;
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-bg-subtle);
}

.widget-footer small {
  font-size: 11px;
}

/* -- Main / States ------------------------------------------------------- */
#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.state.hidden {
  display: none;
}

.state-content {
  width: 100%;
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.state-icon {
  font-size: 40px;
  line-height: 1;
}

.state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.state-description {
  font-size: 13px;
  color: var(--color-text-secondary);
  max-width: 280px;
}

.state-hint {
  font-size: 11px;
  color: var(--color-text-secondary);
  opacity: 0.8;
}

/* -- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
  min-width: 160px;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary:hover {
  background: var(--color-bg-subtle);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--color-danger-dark);
  box-shadow: var(--shadow-sm);
}

/* -- Consent list -------------------------------------------------------- */
.consent-timer {
  font-size: 12px;
  color: var(--color-warning);
  font-weight: 500;
}

.consent-list {
  list-style: none;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.consent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

.consent-item:last-child {
  border-bottom: none;
}

.consent-item-name {
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.consent-status {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Consent status variants */
.consent-status--pending {
  color: var(--color-text-secondary);
  animation: spin 1s linear infinite;
}

.consent-status--accepted {
  color: var(--color-success);
}

.consent-status--refused {
  color: var(--color-danger);
}

/* -- Consent notice ------------------------------------------------------ */
.consent-notice {
  font-size: 11px;
  color: var(--color-text-secondary);
  max-width: 280px;
  margin-top: 4px;
  font-style: italic;
}

/* -- Recording indicator ------------------------------------------------- */
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-danger);
  animation: pulse 1.2s ease-in-out infinite;
}

.rec-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-danger);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.recording-timer {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* -- Spinner ------------------------------------------------------------- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* -- Error --------------------------------------------------------------- */
.error-text {
  color: var(--color-danger);
}

.error-icon {
  font-size: 36px;
}

.success-icon {
  font-size: 36px;
}

/* -- Animations ---------------------------------------------------------- */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* -- Responsive ---------------------------------------------------------- */
@media (max-width: 320px) {
  .state {
    padding: 16px 12px;
  }

  .recording-timer {
    font-size: 28px;
  }

  .btn {
    min-width: 140px;
    padding: 8px 16px;
    font-size: 13px;
  }

  .state-title {
    font-size: 16px;
  }
}
