/* Mobile overrides for CLI-ABC (shared-safe) */

/* Base touch targets */
@media (max-width: 768px) {
  /* Show mobile-only elements */
  .mobile-only { display: block !important; }
  /* Navigation: hamburger toggle */
  #nav .nav-toggle { display:block !important; width:100%; background:#444; color:#fff; border:0; padding:10px 12px; text-align:left; font-size:16px; }
  #nav .ym-hlist ul { display:none; padding:8px 0; margin:0; }
  #nav .ym-hlist ul.open { display:block; }
  #nav .ym-hlist li { display:block; margin: 8px 0; }
  #nav .ym-hlist li a, #nav .ym-hlist li strong { display:block; padding:8px 10px; }
  /* Subpage list under active item on mobile */
  #nav .nav-subpages { margin: 6px 0 6px 16px; padding-left: 8px; border-left: 2px solid #555; }
  #nav .nav-subpages li { margin: 4px 0; }
  #nav .nav-subpages a { display:block; padding:6px 8px; font-size: 90%; color: #eee; }
  #nav .userinfo { float:none; display:block; text-align:center; padding:10px 0; }
  /* Remove global wrapper padding inside nav to avoid indentation */
  #nav .ym-wrapper { padding: 0 !important; }
  /* Tighter mobile button sizing; do not affect EasyUI linkbuttons */
  .btn {
    min-height: 24px;
    min-width: 24px;
    display: inline-block;
    line-height: 24px;
    text-align: center;
  }

  /* Layout adjustments for YAML grid */
  .ym-wrapper { max-width: 100% !important; padding: 0 10px; }
  .ym-col1, .ym-col3 { float: none !important; width: 100% !important; margin: 0 !important; }
  /* Container should not use table layout on mobile; it can expand width */
  .ym-column { margin: 0 !important; display: block; width: 100%; max-width: 100%; box-sizing: border-box; }
  .ym-column::after { content: ""; display: block; clear: both; }
  /* CLI-ABC index layout fixes */
  #main .ym-wrapper { max-width: 100% !important; }
  .rbox { padding: 10px; }
  .wenxintixingyu { position: static !important; max-width: 100% !important; display: block; margin-top: 8px; }
  #photo img { width: 100% !important; height: auto !important; max-width: 180px; }
  .zjdl { margin-left: 0 !important; }
  .zjdl li { width: 46% !important; margin: 6px 2% !important; float: left !important; }
  .zjdl li img { width: 100% !important; height: auto !important; max-width: 140px; }

  /* Typography & form controls */
  input, select, textarea { font-size: 16px; padding: 12px; width: 100%; box-sizing: border-box; }
  label { display: block; margin-bottom: 6px; }

  /* Registration page */
  #reg-form.reg-page {
    padding: 12px 0 28px;
  }
  #reg-form.reg-page .reg-form {
    width: auto !important;
    max-width: 100%;
    margin: 12px auto 24px;
    padding: 20px 16px !important;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e5e8ee;
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(22, 35, 61, 0.08);
  }
  #reg-form.reg-page .reg-form h4 {
    margin: 0 0 10px !important;
    font-size: 24px;
    line-height: 1.25;
  }
  #reg-form.reg-page .reg-form .tipfontfamily {
    margin-bottom: 18px !important;
    line-height: 1.6;
    color: #5f6b7a;
  }
  #reg-form.reg-page .ym-fbox-text,
  #reg-form.reg-page .ym-fbox-select {
    margin-bottom: 14px;
  }
  #reg-form.reg-page label {
    float: none;
    width: auto;
    margin: 0 0 8px;
    color: #2d3642;
    font-weight: 600;
  }
  #reg-form.reg-page input.input,
  #reg-form.reg-page select,
  #reg-form.reg-page textarea {
    width: 100% !important;
    min-height: 46px;
    border: 1px solid #cfd7e3;
    border-radius: 10px;
    background: #fff;
    box-sizing: border-box;
  }
  #reg-form.reg-page .reg-form__native-select {
    display: none;
  }
  #reg-form.reg-page .reg-form__choice-group {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  #reg-form.reg-page .reg-form__choice-group[data-target="group"] {
    grid-template-columns: 1fr;
  }
  #reg-form.reg-page .reg-form__choice {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid #cfd7e3;
    border-radius: 10px;
    background: #fff;
    color: #2d3642;
    font-size: 16px;
    line-height: 1.3;
    text-align: center;
    box-shadow: none;
  }
  #reg-form.reg-page .reg-form__choice.is-active {
    border-color: #7ea4e8;
    background: #edf4ff;
    color: #1d4f9c;
    font-weight: 600;
  }
  #reg-form.reg-page textarea {
    min-height: 110px;
    resize: vertical;
  }
  #reg-form.reg-page .reg-form__hint {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: #6d7885;
  }
  #reg-form.reg-page .reg-form__captcha {
    display: grid;
    grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
    grid-template-areas:
      "label label"
      "input actions";
    column-gap: 14px;
    row-gap: 12px;
    margin-top: 18px;
    padding: 16px 14px 14px !important;
    border: 1px solid #dbe4ef;
    border-radius: 16px;
    background: linear-gradient(180deg, #f4f8fc 0%, #edf3f9 100%) !important;
  }
  #reg-form.reg-page .reg-form__captcha label {
    grid-area: label;
    display: block !important;
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    line-height: 1.4;
  }
  #reg-form.reg-page .reg-form__captcha-input {
    grid-area: input;
    align-self: start;
    display: block;
    width: 100% !important;
    max-width: none;
    min-width: 0;
    margin: 0 !important;
  }
  #reg-form.reg-page .reg-form__captcha-actions {
    grid-area: actions;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    margin-top: 0;
    min-width: 0;
  }
  #reg-form.reg-page .reg-form__captcha-image {
    margin: 0 !important;
    width: 160px;
    max-width: 100%;
    height: 46px;
    border-radius: 8px;
    display: block;
  }
  #reg-form.reg-page .reg-form__captcha-refresh {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    color: #2f69c2;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
  }
  #reg-form.reg-page .reg-form__actions {
    width: 100% !important;
    margin-top: 24px;
    text-align: center;
  }
  #reg-form.reg-page .reg-form__actions input[type="submit"] {
    width: 100% !important;
    margin: 0 0 14px !important;
    min-height: 46px;
    border-radius: 10px;
  }
  #reg-form.reg-page .reg-form__back-link {
    display: inline-block;
    line-height: 1.5;
  }

  /* Tables & EasyUI datagrid */
  .datagrid { margin-top: 12px; }
  .datagrid .datagrid-view { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { white-space: nowrap; }

  /* Utility: mobile card alternative for wide records */
  .mobile-card { border: 1px solid #ddd; margin: 10px 0; padding: 15px; border-radius: 8px; background: #fff; }

  /* Dialogs */
  .panel.window { max-width: 95vw; }
  html, body { overflow-x: hidden; }
}
