/* ============================================
   Selection — Desktop (original layout)
   ============================================ */
html.selection-page-root,
body.selection-page {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body.selection-page {
  background: url("../images/main.gif") no-repeat center center;
  background-size: 100% 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  position: relative;
  font-family: 'Cynetiq', sans-serif;
}

body.selection-page #cropmap_btn,
body.selection-page #remotesensing_btn,
body.selection-page #year.yearpicker.form-control,
body.selection-page .cm-topbar-btn,
body.selection-page .cm-user-panel,
body.selection-page .cm-notif-panel,
body.selection-page .cm-toast {
  font-family: 'Cynetiq', sans-serif;
}

.selection-shell {
  display: contents;
}

.selection-mobile-head,
.selection-year-label {
  display: none;
}

#cropmap_btn {
  height: 35px;
  width: 130px;
  background-color: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
  border-radius: 5px;
  outline: none;
  position: absolute;
  left: 65%;
  top: 80%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  font-size: 14px;
  padding: 0 8px;
  z-index: 2;
}

#remotesensing_btn {
  height: 35px;
  width: 130px;
  background-color: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
  border-radius: 5px;
  outline: none;
  position: absolute;
  left: 75%;
  top: 80%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  font-size: 14px;
  padding: 0 8px;
  z-index: 2;
}

#remotesensing_btn:hover,
#cropmap_btn:hover {
  background-color: var(--cm-primary);
  color: #fff;
  border-color: var(--cm-primary);
}

[data-theme="dark"] #remotesensing_btn:hover,
[data-theme="dark"] #cropmap_btn:hover {
  color: #0b1f14;
}

/* Year input — same width as .yearpicker-container dropdown */
body.selection-page #year.yearpicker.form-control {
  display: block;
  position: absolute;
  left: 65px;
  top: 310px;
  margin: 0;
  padding: 0.5rem;
  width: 200px;
  text-align: center;
  box-sizing: border-box;
  background: var(--cm-surface);
  color: var(--cm-text);
  border: 1px solid var(--border-color, var(--cm-border));
  border-radius: 3px;
  cursor: pointer;
  z-index: 2;
}

body.selection-page .yearpicker-container {
  width: 200px;
  box-sizing: border-box;
}

/* ============================================
   Selection — Mobile (single-screen card)
   ============================================ */
@media (max-width: 768px) {
  html.selection-page-root,
  body.selection-page {
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
  }

  body.selection-page {
    background: linear-gradient(160deg, var(--cm-primary) 0%, var(--cm-accent-start) 45%, var(--cm-accent-end) 100%);
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
      max(12px, env(safe-area-inset-top))
      16px
      max(72px, calc(60px + env(safe-area-inset-bottom)));
    box-sizing: border-box;
  }

  .selection-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 400px;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(72px, calc(60px + env(safe-area-inset-bottom))) - 8px);
    background: var(--cm-surface);
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    padding: 20px 18px 18px;
    box-sizing: border-box;
    gap: 10px;
    overflow: hidden;
    flex-shrink: 1;
  }

  .selection-mobile-head {
    display: block;
    text-align: center;
    margin-bottom: 4px;
    flex-shrink: 0;
  }

  .selection-brand-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 10px;
    border-radius: 14px;
    background: url('../images/logo.png') center / cover no-repeat;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  }

  .selection-mobile-head h1 {
    margin: 0 0 4px;
    font-size: 21px;
    color: var(--cm-text);
  }

  .selection-brand-line {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--cm-primary);
    letter-spacing: 0.01em;
  }

  .selection-brand-line a {
    color: inherit !important;
    text-decoration: none !important;
    cursor: pointer;
  }

  .selection-mobile-head p:not(.selection-brand-line) {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--cm-text-muted);
  }

  .selection-year-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cm-text-muted);
    margin: 0;
    flex-shrink: 0;
  }

  body.selection-page #year.yearpicker.form-control {
    position: static;
    left: auto;
    top: auto;
    width: 100%;
    max-width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 12px;
    font-size: 17px;
    border-radius: 12px;
    background: var(--cm-surface-2);
    border: 1px solid var(--cm-border);
    color: var(--cm-text);
    flex-shrink: 0;
  }

  body.selection-page #cropmap_btn,
  body.selection-page #remotesensing_btn {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    width: 100%;
    height: 48px;
    margin: 0;
    font-size: 15px;
    border-radius: 12px;
    background: var(--cm-surface);
    color: var(--cm-text);
    border: 1px solid var(--cm-border);
    flex-shrink: 0;
  }

  #cropmap_btn::before {
    content: '\f279';
    font-family: FontAwesome;
    margin-right: 10px;
  }

  #remotesensing_btn::before {
    content: '\f0ac';
    font-family: FontAwesome;
    margin-right: 10px;
  }

  #remotesensing_btn:hover,
  #cropmap_btn:hover {
    background-color: var(--cm-primary);
    color: white;
    border-color: var(--cm-primary);
  }
}

@media (max-width: 380px) {
  .selection-shell {
    padding: 16px 14px 14px;
    border-radius: 14px;
    gap: 8px;
  }

  .selection-mobile-head h1 {
    font-size: 19px;
  }

  .selection-mobile-head p {
    font-size: 12px;
  }

  body.selection-page #year.yearpicker.form-control,
  body.selection-page #cropmap_btn,
  body.selection-page #remotesensing_btn {
    height: 44px;
    font-size: 14px;
  }
}
