/* ============================================================
 * kt-flipbook v2 viewer styles
 *
 * @file        kt-flipbook/assets/viewer.css
 * @loaded_by   wp_enqueue_style (kt-flipbook.php)
 * @created     2026-04-27
 * ============================================================ */

.kt-fb-wrap {
  position: relative;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", sans-serif;
  outline: none;
  width: 100%;
  margin: 16px 0;
}
.kt-fb-wrap:focus-within {
  box-shadow: 0 0 0 2px rgba(61, 122, 90, 0.3);
}

/* --- loading state --- */
.kt-fb-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #666;
  background: #fafafa;
  padding: 40px 16px;
}
.kt-fb-loading p {
  margin: 0;
  font-size: 13px;
  color: #888;
}
.kt-fb-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e0e0e0;
  border-top-color: #3d7a5a;
  border-radius: 50%;
  animation: kt-fb-spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes kt-fb-spin {
  to { transform: rotate(360deg); }
}

/* --- canvas viewport --- */
.kt-fb-canvas-area {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a2a;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}
.kt-fb-canvas {
  background: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- toolbar --- */
.kt-fb-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border-top: 1px solid #ddd;
  font-size: 14px;
  flex-wrap: wrap;
}
.kt-fb-btn {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 34px;
  height: 34px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  font-family: inherit;
}
.kt-fb-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}
.kt-fb-btn:active {
  background: #e8e8e8;
  transform: translateY(1px);
}
.kt-fb-btn:focus-visible {
  outline: 2px solid #3d7a5a;
  outline-offset: 1px;
}
.kt-fb-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.kt-fb-counter {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #555;
  min-width: 60px;
  text-align: center;
  padding: 0 4px;
}
.kt-fb-spacer {
  flex: 1;
  min-width: 8px;
}

/* --- error --- */
.kt-fb-error {
  padding: 24px;
  background: #fff3f3;
  color: #c33;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  margin: 16px 0;
}
.kt-fb-error small {
  display: block;
  margin-top: 8px;
  color: #966;
  font-size: 12px;
}

/* --- mobile --- */
@media (max-width: 640px) {
  .kt-fb-wrap {
    margin: 12px 0;
  }
  .kt-fb-toolbar {
    padding: 6px 8px;
    gap: 4px;
  }
  .kt-fb-btn {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  .kt-fb-counter {
    font-size: 12px;
    min-width: 48px;
  }
  .kt-fb-canvas-area {
    padding: 8px;
  }
}
