/* Layui message panel + layout compatibility for Blade frontend */

@keyframes mk-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
  20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.mk-shake {
  animation: mk-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.layui-layer .layui-layer-close {
  top: 4px !important;
  right: 10px !important;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  color: transparent;
  overflow: hidden;
}

.layui-layer .layui-layer-close::before {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M11 0.7H13V23.3H11z' transform='rotate(-45.001 12 12)'/><path fill='black' d='M0.7 11H23.3V13H0.7z' transform='rotate(-45.001 12 12)'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  position: absolute;
  top: 0;
  left: 0;
}

/* Dialog / panel content only — do not apply to layer.msg toasts */
.layui-layer:not(.layui-layer-msg):not(.layui-layer-hui) > .layui-layer-content {
  background-color: #f5f8fa !important;
  color: #333 !important;
}

/* Toast (layer.msg): dark shell + white text (override #f5f8fa leak) */
.layui-layer.layui-layer-msg,
.layui-layer.layui-layer-hui {
  background-color: rgba(0, 0, 0, 0.78) !important;
  color: #fff !important;
  border: none !important;
}

.layui-layer.layui-layer-msg .layui-layer-content,
.layui-layer.layui-layer-hui .layui-layer-content {
  background-color: transparent !important;
  color: #fff !important;
}

.layui-layer-title {
  background-color: #fff !important;
}

.layui-layer-btn {
  background-color: #fff !important;
}

/* Full-screen notifications / messages panel */
.custom-message-skin.layui-layer {
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  border-radius: 0 !important;
  box-sizing: border-box !important;
}

.custom-message-skin .layui-layer-content {
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #fff !important;
  box-sizing: border-box !important;
}

.mk-message-panel {
  --mk-msg-header-h: 48px;
  --mk-msg-composer-h: 56px;
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: #fff;
  overflow: hidden;
}

.mk-message-panel__header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 12px 48px 12px 16px;
  background: #1a5c3a;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  box-sizing: border-box;
}

.mk-message-panel__messages {
  position: fixed;
  top: var(--mk-msg-header-h);
  bottom: var(--mk-msg-composer-h);
  left: 0;
  right: 0;
  z-index: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #f5f8fa;
  box-sizing: border-box;
}

.mk-message-panel__composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 8px 12px;
  border-top: 1px solid #e8e8e8;
  background: #fff;
  box-sizing: border-box;
}

.mk-message-panel__form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mk-message-panel__tool {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
}

.mk-message-panel__file-input {
  display: none;
}

.mk-message-panel__input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.mk-message-panel__input {
  width: 100%;
  box-sizing: border-box;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.mk-message-panel__emoji-picker {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: min(250px, calc(100vw - 32px));
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

.mk-message-panel__send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: #1a5c3a;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.user-message img {
  width: 35px !important;
  height: 33px !important;
  padding-left: 2px !important;
}

.loan-apply-page__terms-grid .loan-apply-page__term-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.loan-apply-page__terms-grid label.loan-apply-page__term {
  display: block;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  text-align: center;
}

.loan-apply-page__terms-grid .loan-apply-page__term-input:checked + label.loan-apply-page__term {
  border-color: #1faa6e;
  background: #e8f8ef;
  color: #1a5c3a;
}

.loan-contract-document {
  max-width: 400px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

.loan-contract-document__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: var(--mk-primary-dark);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

.loan-contract-document__paper {
  padding: 16px;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  line-height: 1.55;
  color: #333;
  text-align: left;
}

.loan-contract-document__header {
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.loan-contract-document__logo {
  max-width: 160px;
  height: auto;
  margin: 0 auto 8px;
  display: block;
}

.loan-contract-document__title {
  margin: 8px 0 4px;
  font-size: 18px;
  font-weight: 800;
  text-transform: uppercase;
}

.loan-contract-document__section-title {
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.loan-contract-document__highlight {
  margin: 10px 0;
  padding: 10px;
  border-radius: 8px;
  background: #f7fbf8;
}

.loan-contract-document__signatures {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
}

.loan-contract-document__signature-box {
  flex: 1 1 140px;
}

.loan-contract-document__signature-box img {
  max-width: 120px;
  margin-top: 8px;
}

.layui-laydate,
.layui-laydate-main {
  z-index: 99999999 !important;
}

.profile-page__card--static {
  cursor: default;
}

.profile-page__card--static .profile-page__card-arrow {
  display: none;
}

.mobile-shell .bg-primary,
.mobile-shell .btn-primary,
.mobile-shell .btn-success {
  background: var(--mk-primary) !important;
  border-color: var(--mk-primary) !important;
}
