@font-face {
  font-family: 'NaishoMoji';
  src: url('/fonts/NaishoMoji-Regular.otf');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0d12;
  --panel: #121621;
  --accent: #4da3ff;
  --muted: #9aa3b2;
  --border: #1d2333;
  --err: #ff5e5e;
}

html {
  width: 100%;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100%;
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-card {
  background: var(--panel);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

h2 {
  text-align: left;
  margin: 5px 0px 36px 0px;
  line-height: 30px;
  vertical-align: middle;
}

#companyLogo {
  vertical-align: middle;
  height: 30px;
  margin-right: 5px;
}

.form {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.form.active {
  display: flex;
}

input,
select,
button,
textarea {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #1b2130;
  color: #fff;
}
input[type='color'] {
  padding: 0px;
  border: none;
  vertical-align: middle;
  height: 35px;
}
button {
  background: var(--accent);
  cursor: pointer;
  border: none;
}

a {
  color: var(--accent);
  font-size: 0.9em;
}

.company-input {
  position: relative;
}

.auth-card input,
.auth-card select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: #fff;
}

/* Company input should also be full width */
#companyInput {
  display: block;
  width: 100%;
}

/* Suggestions dropdown should align with input */
#companySuggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-top: none;
  max-height: 160px;
  overflow-y: auto;
  background: var(--panel);
  position: absolute; /* ensures overlay below input */
  width: 100%; /* match the input width */
  z-index: 10;
  display: none;
}

#companySuggestions.show {
  display: block;
}

#companySuggestions li {
  padding: 8px 10px;
  cursor: pointer;
}

#companySuggestions li:hover {
  background: var(--accent);
  color: #fff;
}

#verifyForm p {
  text-align: center;
  margin-bottom: 12px;
}

#verifyForm button {
  margin-top: 8px;
}

.loading-overlay {
  display: none; /* hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 13, 18, 0.8); /* dimmed dark */
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1em;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

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

#homeScreen {
  display: none;
  width: 100%;
  height: 100vh;
}

.home-layout {
  display: flex;
  height: 100vh;
  width: 100%;
}

.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.sidebar-title {
  font-family: 'NaishoMoji';
  margin: 0 0 40px;
  font-size: 2em;
  text-align: center;
  color: var(--muted);
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.menu-list li {
  padding: 10px;
  margin-bottom: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}

.menu-list li:hover {
  background: #1b2130;
}

.menu-list li.active {
  background: var(--accent);
  color: #fff;
}

.user-info {
  font-size: 0.85em;
  color: var(--muted);
  margin: 10px 0;
  padding: 8px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.logout-btn {
  margin-top: auto;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: var(--err);
  color: #fff;
  cursor: pointer;
}

.logout-btn:hover {
  background: #d44;
}

.content-area {
  flex: 1;
  padding: 20px;
  background: var(--bg);
  overflow-y: auto;
}

/* Billing card container */
/*.billing-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  color: #fff;
  font-size: 14px;
}*/

/* Key-Value table */
/* Subscription + History table */
.kv-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}

.kv-table thead {
  background: #101420;
}

.kv-table thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.kv-table tbody tr {
  transition: background 0.15s ease;
}

.kv-table tbody tr:nth-child(odd) {
  background: #151a28;
}

.kv-table tbody tr:nth-child(even) {
  background: #121621;
}

.kv-table tbody tr:hover {
  background: #1d2333;
}

.kv-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: #e9eef7;
  vertical-align: middle;
  height: 40px;
  min-height: 40px;
}

.kv-table td code {
  color: var(--accent);
  font-family: monospace;
  font-size: 12px;
}

#analyticsTable.kv-table th:first-child,
#analyticsTable.kv-table td:first-child {
  min-width: 200px;
}

/* History section title */
#subscriptionSection h3,
#historySection h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
  padding-left: 6px;
}

/* Hint text */
.hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Mini buttons */
button.mini,
.btnOpenInvoice {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
}

button.mini:hover {
  background: #357ed3; /* darker accent */
}

button.mini:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button.mini.btnManageHistory {
  width: 70px;
}

.analytics-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: #151a28;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 10px;
}

.analytics-filters label {
  font-size: 14px;
  color: var(--muted);
  margin-right: 10px;
}

.analytics-result {
  font-size: 13px;
  background: #121621;
  padding: 12px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.switch input {
  display: none;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #555; /* dark mode inactive */
  border-radius: 28px;
  transition: 0.4s;
}
.slider:before {
  position: absolute;
  content: '';
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}
input:checked + .slider {
  background-color: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Tabs */
.tab-header {
  display: flex;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 10px;
  list-style: none;
  padding-left: 0;
}
.tab-header li {
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: none;
  background: #151a28; /* inactive dark */
  margin-right: 4px;
  border-radius: 6px 6px 0 0;
  color: #ccc;
  transition:
    background 0.3s,
    color 0.3s;
}
.tab-header li.active {
  background: var(--accent); /* active dark */
  font-weight: bold;
  color: #fff;
}
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-content.active {
  display: block;
}

/* Fade animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Layout */
.form-preview-wrapper {
  display: flex;
  gap: 20px;
}
.form-side {
  flex: 1;
}
.preview-side {
  display: flex;
  justify-content: center;
}

/* Smartphone frame */
.smartphone-frame {
  width: 360px;
  height: 740px; /* approximate iPhone 16 Pro height ratio */
  border: 2px solid #444;
  border-radius: 36px;
  background: #111;
  background-size: 100% auto;
  position: relative;
  overflow: hidden;
}
.smartphone-bg {
  width: 100%;
  display: block;
}
.smartphone-content {
  padding: 16px;
  text-align: center;
  background: #1b1b1b;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}
.smartphone-banner {
  background: #000;
  padding: 0px 20px;
  margin: 0px;
}
.smartphone-banner a {
  text-decoration: none;
}
.banner-empty {
  display: block;
  height: 70px;
  line-height: 70px;
  text-align: center;
  background: #666;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
}
.smartphone-banner img {
  display: block;
  max-width: 100%;
}
.preview-comment {
  color: #fff;
  margin-bottom: 8px;
  font-size: 12px;
}
#buttonForm td:first-child,
#bannerForm td:first-child {
  width: 150px;
  min-width: 100px;
}
.preview-button {
  display: table;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  width: 100%;
  min-height: 50px;
}
.preview-button span {
  display: table-cell;
  padding: 10px 20px;
  vertical-align: middle;
}
.custom-input-wide {
  width: 80%;
  position: relative;
}
.custom-text-input,
.custom-text-area {
  width: 100%;
}
.custom-text-input.has-count,
.custom-text-area.has-count {
  margin-bottom: 20px;
}
.text-count {
  position: absolute;
  right: -20px;
  bottom: 0px;
}
.toggle-section {
  display: table;
  width: 100%;
  background: #151a28;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.toggle-section-inner {
  display: table-cell;
  vertical-align: middle;
  padding: 10px;
  font-size: 14px;
}
.toggle-section-inner .switch {
  vertical-align: middle;
  margin-left: 30px;
}
.button-holder {
  background: #000;
  padding: 10px;
  border-radius: 6px;
  text-align: right;
  border: 1px solid var(--border);
}
.medium {
  min-width: 100px;
}
.wide {
  min-width: 200px;
}
.material-symbols-rounded {
  font-variation-settings:
    'FILL' 1,
    /* 1 = filled, 0 = outline */ 'wght' 400,
    /* 100–700 */ 'GRAD' 0,
    'opsz' 24; /* optical size */
  font-size: 24px; /* icon size */
  vertical-align: middle;
  margin-right: 10px;
}

#analyticsChart {
  display: none;
  padding: 20px;
  background: #000;
  border-radius: 6px;
}

#historySection .kv-table td:last-child {
  width: 70px;
}
.center {
  text-align: center !important;
}
.right {
  text-align: right !important;
}
.subs-status {
  display: inline-block;
  min-width: 50px;
  padding: 3px 10px;
  background: #333;
  color: #fff;
  text-align: center;
  border-radius: 20px;
}
button.mini.deleteBtn {
  background: var(--err);
}
.copyright {
  font-size: 10px;
  text-align: center;
  margin-top: 10px;
}
#planSection {
  display: none;
  margin-bottom: 50px;
}
.plan-container {
  background: #121621;
  padding: 20px;
  border-radius: 10px;
  position: relative;
  min-width: 250px;
  margin-right: 10px;
}
.plan-container:last-child {
  margin-right: 0px;
}
.plan-container h3 {
  font-size: 20px;
  margin: 0px 0px 20px 0px;
}
.plan-desc {
  font-size: 14px;
  height: 70px;
}
.plan-price {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
}
.plan-duration {
  font-size: 14px;
}
.plan-container ul {
  padding: 0px;
  margin: 20px 0px;
  height: 150px;
}
.plan-container li {
  list-style: none;
  padding: 0px 0px 0px 20px;
  margin: 0px 0px 5px 0px;
  font-size: 12px;
  color: #fff;
  position: relative;
}
.plan-container li span {
  font-size: 14px;
  position: absolute;
  left: 0px;
  top: 2px;
}
#btnChangePlan {
  background-color: #ff9800;
}

#planSection.plan-dialog {
  display: block;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.8);
}

.plan-dialog .plan-inner {
  background: var(--bg);
  padding: 20px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.plan-text {
  font-size: 14px;
}

.plan-change-mode-selector {
  font-size: 14px;
}

.plan-change-title {
  display: none;
}

.plan-dialog .plan-title,
.plan-dialog .plan-btn {
  display: none;
}

.plan-dialog .plan-change-title {
  display: block;
}
.plan-radio {
  display: none;
}
.plan-radio:checked + .plan-change:not(.selected) {
  background: var(--accent);
}
.plan-change {
  display: block;
  background: #607d8b;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  color: #fff;
  cursor: pointer;
  cursor: hand;
}
.plan-change.selected {
  background-color: #ff9800;
  cursor: pointer;
  cursor: default;
}
.plan-name-label-selected,
.plan-change.selected .plan-name-label,
.plan-change.selected input {
  display: none;
}
.plan-change.selected .plan-name-label-selected {
  display: block;
}
.plan-change .material-symbols-rounded {
  display: none;
}
.plan-radio:checked + .plan-change:not(.selected) .material-symbols-rounded {
  display: inline-block;
}
.change-plan-button {
  margin-left: 10px;
}
.plan-change-mode-selector {
  padding-left: 30px;
}
.change-plan-button {
  width: 100px;
}
.change-plan-button.cancel {
  background: var(--err);
}

/* INVOICE */
.invoice {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.8);
}

.invoice-inner {
  background: var(--bg);
  padding: 20px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
  border-radius: 10px;
  border: 1px solid var(--border);
  width: 800px;
}

.invoice h2 {
  margin-bottom: 0;
}

.invoice-note {
  font-size: 14px;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.invoice-table th,
.invoice-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  text-align: left;
}

.invoice-table th {
  background: #151a28;
  font-weight: 600;
}

.invoice-summary {
  max-width: 400px;
  margin-left: auto;
  font-size: 14px;
  margin-bottom: 30px;
}

.invoice-summary div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.invoice-summary .remaining {
  font-weight: bold;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 8px;
}

.avg-wrap {
  display: inline-block;
  background: #151a28;
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 10px;
  margin-bottom: 10px;
}
.stars-avg {
  position: relative;
  display: inline-block;
  font-size: 24px;
  line-height: 1;
}
.stars-avg .stars-base {
  color: #d1d5db;
}
.stars-avg .stars-fill {
  color: #f59e0b;
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  overflow: hidden;
}
.avg-text {
  font-size: 14px;
}
