/* Lenspire component audit — shared interaction, sizing, and state rules. */
:root {
  --component-control-height: 44px;
  --component-compact-height: 40px;
  --component-control-radius: 12px;
  --component-card-radius: 16px;
  --component-panel-radius: 20px;
  --component-border: #ded6e6;
  --component-border-strong: #c9b9da;
  --component-focus: #7546ad;
  --component-muted: #756b7e;
  --component-disabled-bg: #eee9f2;
  --component-disabled-text: #81778a;
  --component-card-shadow: 0 10px 24px rgb(57 32 84 / 5%);
  --component-panel-shadow: 0 18px 42px rgb(57 32 84 / 7%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
[role="button"],
input[type="submit"] {
  touch-action: manipulation;
}

button:not(:disabled),
[role="button"]:not([aria-disabled="true"]),
input[type="submit"]:not(:disabled),
select:not(:disabled),
input[type="checkbox"]:not(:disabled),
input[type="radio"]:not(:disabled) {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 1;
}

button:not(:disabled):active,
[role="button"]:not([aria-disabled="true"]):active,
input[type="submit"]:not(:disabled):active {
  transform: translateY(1px);
}

/* Text fields and dropdowns */
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]),
select,
textarea {
  min-height: var(--component-control-height);
  border-color: var(--component-border);
  border-radius: var(--component-control-radius);
  background-color: #fff;
  color: #2d2535;
  line-height: 1.35;
}

input::placeholder,
textarea::placeholder {
  color: #8b8193;
  opacity: 1;
}

select {
  padding-right: 36px;
  text-overflow: ellipsis;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: var(--component-border-strong);
}

input:user-invalid,
select:user-invalid,
textarea:user-invalid {
  border-color: #bd5267;
  box-shadow: 0 0 0 3px rgb(189 82 103 / 12%);
}

/* Native selection controls */
input[type="checkbox"],
input[type="radio"] {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin: 0;
  accent-color: var(--component-focus);
}

label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
  cursor: pointer;
}

label:has(input[type="checkbox"]:focus-visible),
label:has(input[type="radio"]:focus-visible) {
  outline: 3px solid rgb(117 70 173 / 22%);
  outline-offset: 3px;
}

/* Navigation and compact icon controls */
.ls-nav a,
.studio-nav a,
.legal-nav a {
  text-underline-offset: 4px;
}

.ls-desktop-nav > a,
.ls-desktop-nav > details > summary,
.studio-workspace .studio-nav-link,
.studio-nav-actions > a {
  min-height: var(--component-control-height);
  display: inline-flex;
  align-items: center;
}

.ls-mobile-toggle,
.ls-mobile-close,
.studio-nav-toggle {
  min-width: var(--component-control-height);
  min-height: var(--component-control-height);
}

.event-icon-button,
.password-toggle {
  min-width: var(--component-compact-height);
  min-height: var(--component-compact-height);
  display: inline-grid;
  place-items: center;
}

/* Tab systems */
[role="tablist"] {
  max-width: 100%;
}

[role="tab"] {
  min-height: var(--component-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.ls-experience-tabs [role="tab"] {
  min-height: var(--component-control-height);
}

[role="tab"][aria-selected="true"] {
  color: #643396;
}

[role="tabpanel"]:focus-visible {
  outline: 3px solid rgb(117 70 173 / 20%);
  outline-offset: 4px;
}

/* Badges and status labels */
.pill,
.event-photo-badges > span,
.status-paid,
.status-created,
.status-failed,
.status-refunded,
.status-captured,
.subscription-plan-tag,
.public-plan > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  line-height: 1.2;
  white-space: normal;
}

/* Existing cards keep their design but share structural safeguards. */
.account-card,
.access-card,
.event-action,
.event-organize-card,
.event-photo,
.guest-search-card,
.guest-pin-card,
.guest-result-card,
.plan-card,
.public-plan,
.platform-create-card,
.subscription-history-table {
  min-width: 0;
  border-radius: var(--component-card-radius);
}

/* Surface roles: compact cards and larger workspace panels stay predictable. */
.studio-app :is(
  .studio-dashboard-card,
  .studio-kpis article,
  .studio-event-card,
  .event-kpis article,
  .event-photo,
  .subscription-plan
),
.pricing-site .public-plan {
  border-radius: var(--component-card-radius);
  box-shadow: var(--component-card-shadow);
}

.studio-app :is(
  .account-card,
  .access-card,
  .event-action,
  .event-organize-card,
  .event-settings-card,
  .event-settings-tool,
  .checkout-card,
  .guest-pin-card,
  .guest-search-card,
  .platform-create-card
) {
  border-radius: var(--component-panel-radius);
  box-shadow: var(--component-panel-shadow);
}

.event-photo,
.guest-result-card,
.public-plan,
.plan-card {
  overflow: hidden;
}

.public-plan a {
  width: 100%;
  min-height: var(--component-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  border: 1px solid #d5c5e3;
  border-radius: var(--component-control-radius);
  padding: 10px 14px;
  text-align: center;
}

.public-plan a:hover {
  border-color: #9a72bd;
  background: #f6f0fb;
}

/* Preserve a clear, accessible primary-action target across account flows. */
.login-page .login-submit,
.studio-app .subscription-plan button,
.studio-app .event-action button,
.studio-app .event-action-cta,
.pricing-site .public-plan a {
  min-height: var(--component-control-height);
}

/* Div-based history tables: semantic roles are added in the templates. */
.subscription-history-table[role="table"] {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.subscription-history-row[role="row"] {
  min-width: 520px;
}

.subscription-history-row [role="columnheader"] {
  font-weight: 800;
}

.subscription-history-row [role="cell"],
.subscription-history-row [role="columnheader"] {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Native dialogs and future local modals. Razorpay's hosted modal is external. */
dialog,
.modal,
[role="dialog"]:not(.ls-mobile-menu) {
  max-width: min(560px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  border: 1px solid var(--component-border);
  border-radius: var(--component-card-radius);
  background: #fff;
  box-shadow: 0 24px 70px rgb(45 27 64 / 22%);
}

dialog::backdrop {
  background: rgb(35 24 45 / 52%);
  backdrop-filter: blur(3px);
}

/* Responsive component behavior */
@media (max-width: 760px) {
  [role="tablist"] {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  [role="tablist"]::-webkit-scrollbar {
    display: none;
  }

  [role="tab"] {
    flex: 0 0 auto;
  }

  .ls-mobile-menu[role="dialog"] {
    min-height: 100dvh;
  }

  .subscription-history-table[role="table"] {
    border-radius: 14px;
  }
}

@media (max-width: 900px) {
  .studio-app .subscription-history {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  .studio-app .subscription-history > * {
    min-width: 0;
  }
}

@media (max-width: 600px) {
  .subscription-history-table[role="table"] {
    display: grid;
    gap: var(--space-3);
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .subscription-history-row.subscription-history-head[role="row"] {
    display: none;
  }

  .studio-app .subscription-history-row[role="row"]:not(.subscription-history-head) {
    min-width: 0;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--component-border);
    border-radius: 14px;
    background: #fff;
  }

  .studio-app .subscription-history-row[role="row"] > [role="cell"] {
    display: grid;
    min-width: 0;
    gap: 4px;
    overflow: visible;
    color: #4e4359;
    line-height: 1.45;
    text-align: left;
    text-overflow: clip;
    white-space: normal;
  }

  .studio-app .subscription-history-row[role="row"] > [role="cell"]:nth-child(2) {
    grid-column: 1 / -1;
  }

  .studio-app .subscription-history-row[role="row"] > [role="cell"]:nth-child(4) {
    display: grid;
  }

  .studio-app .subscription-history-row[role="row"] > [role="cell"]::before {
    color: #8b8093;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .65px;
    text-transform: uppercase;
  }

  .studio-app .subscription-history-row[role="row"] > [role="cell"]:nth-child(1)::before { content: "Date"; }
  .studio-app .subscription-history-row[role="row"] > [role="cell"]:nth-child(2)::before { content: "Details"; }
  .studio-app .subscription-history-row[role="row"] > [role="cell"]:nth-child(3)::before { content: "Status / change"; }
  .studio-app .subscription-history-row[role="row"] > [role="cell"]:nth-child(4)::before { content: "Amount / balance"; }
}

@media (prefers-reduced-motion: reduce) {
  button,
  [role="button"],
  input,
  select,
  textarea {
    scroll-behavior: auto;
    transition-duration: 0.01ms !important;
  }
}
