/* ============================================================
 * K-code App Common CSS
 * ------------------------------------------------------------
 * Purpose:
 * - Standalone K-code web apps such as /masume-app/ can use the
 *   same app button design as the WordPress site without loading
 *   the full custom_main.css.
 * - Keep this file limited to app-common UI parts.
 *
 * Source basis:
 * - Extracted and minimized from custom_main.css button definitions.
 * - Added shared appbar utility buttons for Help / About.
 * ============================================================ */

:root {
  /* Color */
  --kc-color-primary: #ff8400;
  --kc-color-primary-hover: #ffc88c;
  --kc-color-primary-light: #ff9d33;
  --kc-color-text-link-hover: #9d342b;

  /* Button */
  --kc-color-primary-text: #ffffff;
  --kc-color-secondary: #ffffff;
  --kc-color-secondary-text: #333333;
  --kc-btn-shadow: 0px 3px 8px rgba(255, 132, 0, 0.35);

  /* App utility */
  --kc-appbar-btn-bg: #fefefe;
  --kc-appbar-btn-hover-bg: #fff8f0;
  --kc-appbar-btn-border: rgba(255, 132, 0, 0.35);
}

/* ------------------------------------------------------------
 * Form / button inheritance
 * ------------------------------------------------------------ */
input,
button,
textarea,
select {
  font-family: inherit;
  letter-spacing: inherit;
  color: inherit;
}

/* Keyboard focus */
body button:focus-visible,
body a:focus-visible {
  outline: none;
  border: 3px solid #ffae59 !important;
  box-shadow: 0 0 2px 1px rgb(255 132 0 / 28%) !important;
}

/* ============================================================
 * K-code button base
 * ============================================================ */
.kc-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  position: relative;

  border-radius: 999px;
  font-weight: bold;
  line-height: 1.4;
  transition: all 0.3s ease-in-out;
  cursor: pointer;
  box-sizing: border-box;
  text-decoration: none;

  min-width: 110px;
  gap: 0.6em;
}

body a.kc-btn:hover {
  text-decoration: none !important;
  opacity: 1;
}

/* App button size: used by Play / Clear / PDF etc. */
.kc-btn--app {
  padding: 0.2em 0.6em;
  font-size: 1em !important;
  min-width: 100px;
  gap: 0.2em;
}

/* App button icon vertical adjustment */
.kc-btn--app i,
.kc-btn--app svg {
  position: relative;
  top: 1px;
}

/* ============================================================
 * Primary button
 * ============================================================ */
.kc-btn--primary {
  background-color: var(--kc-color-primary);
  color: var(--kc-color-primary-text);
  border: 2px solid var(--kc-color-primary);
}

body :is(a, button).kc-btn--primary:hover {
  color: var(--kc-color-primary-text) !important;
  background-color: var(--kc-color-primary-light);
  border-color: var(--kc-color-primary-light) !important;
  box-shadow: var(--kc-btn-shadow) !important;
  transform: translateY(-2px);
}

body :is(a, button).kc-btn--primary:active {
  transform: translateY(1.5px) !important;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3) !important;
  background-color: #e67700 !important;
  border-color: #e67700 !important;
  transition: all 0.05s ease-out !important;
}

/* App buttons should not float upward on hover. */
body :is(a, button).kc-btn--primary.kc-btn--app:hover {
  transform: none !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

body :is(a, button).kc-btn--primary.kc-btn--app:active {
  transform: translateY(1.5px) !important;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3) !important;
  background-color: #e67700 !important;
  border-color: #e67700 !important;
  transition: all 0.05s ease-out !important;
}

/* ============================================================
 * Secondary button
 * ============================================================ */
.kc-btn--secondary {
  background-color: var(--kc-color-secondary);
  color: var(--kc-color-secondary-text);
  border: 1.5px solid #e0e0e0;
}

/* App secondary button: orange outline */
.kc-btn--app.kc-btn--secondary {
  color: var(--kc-color-primary);
  border-color: var(--kc-color-primary);
}

body :is(a, button).kc-btn--secondary:hover {
  background-color: var(--kc-color-primary);
  color: #fff !important;
  border-color: var(--kc-color-primary) !important;
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1) !important;
  fill: #fff;
}

body :is(a, button).kc-btn--secondary:hover i,
body :is(a, button).kc-btn--secondary:hover svg {
  color: #fff !important;
}

body :is(a, button).kc-btn--secondary:active {
  transform: translateY(1px) !important;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3) !important;
  background-color: #e67700 !important;
  border-color: #e67700 !important;
  color: #fff !important;
  transition: all 0.05s ease-out !important;
}

/* ============================================================
 * Disabled state
 * ============================================================ */
button.kc-btn:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;

  background-color: #f5f5f5 !important;
  color: #9a9a9a !important;
  border-color: #d9d9d9 !important;

  box-shadow: none !important;
  transform: none !important;
}

button.kc-btn:disabled:hover {
  background-color: #f5f5f5 !important;
  color: #9a9a9a !important;
  border-color: #d9d9d9 !important;
  transform: none !important;
  box-shadow: none !important;
}

button.kc-btn--secondary:disabled i,
button.kc-btn--secondary:disabled svg {
  color: #9a9a9a !important;
}

/* ============================================================
 * K-code button inline SVG helpers
 * ============================================================ */
.kc-btn__svg-icon {
  display: block;
  width: 1em;
  height: 1em;
  color: currentColor;
  fill: currentColor;
  line-height: 1;
}

.kc-btn__svg-icon--pencil {
  width: 21px;
  height: 21px;
}

/* ============================================================
 * Appbar utility buttons
 * Help / Aboutなど、アプリ右上の小型操作ボタン用
 * ============================================================ */
.kc-appbar-circle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--kc-appbar-btn-border);
  background: var(--kc-appbar-btn-bg);
  color: var(--kc-color-primary);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.05s ease;
  white-space: nowrap;
}

.kc-appbar-circle-btn:hover {
  background: var(--kc-appbar-btn-hover-bg);
  color: var(--kc-color-primary);
}

.kc-appbar-circle-btn:active {
  transform: translateY(1px);
}

.kc-appbar-circle-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.kc-appbar-icon-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--kc-color-primary);
  color: #fefefe;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  flex-shrink: 0;
}

/* =========================================
   K-code app button: inline SVG icon
========================================= */

.kc-btn__app-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
  color: currentColor;
  stroke: currentColor;
  vertical-align: -0.12em;
}

/* Clear / PDFなど、アプリ操作ボタン内のアイコン位置を微調整 */
.kc-btn--app .kc-btn__app-icon {
  position: relative;
  top: 0.03em;
}

/* Tablet and mobile: show only icons for Help / About. */
@media (max-width: 549.98px) {
  .kc-appbar-btn-text {
    display: none;
  }

  .kc-appbar-circle-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-color: transparent;
  }

  .kc-appbar-circle-btn svg,
  .kc-appbar-icon-q {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 420px) {
  .kc-appbar-circle-btn {
    width: 28px;
    height: 28px;
  }

  .kc-appbar-circle-btn svg,
  .kc-appbar-icon-q {
    width: 18px;
    height: 18px;
  }
}

/* Reduce motion for users who request it. */
@media (prefers-reduced-motion: reduce) {
  .kc-btn,
  .kc-appbar-circle-btn {
    transition: none !important;
  }
}
