/* ============================================================
   DSX Panic Decoder — style.css
   ============================================================ */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;

  background: #0f1115;
  color: #e6e6e6;

  padding: 24px;

  min-height: 100vh;

  display: flex;
  flex-direction: column;
}

/* ============================================================
   APP
   ============================================================ */

#appContent {
  width: 100%;
}

#appContent .container {
  width: 100%;
}

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1 {
  font-size: 20px;
  margin-bottom: 4px;
}

p.sub {
  color: #999;
  font-size: 13px;
  margin-top: 0;
  margin-bottom: 20px;
}

/* ============================================================
   MAIN INPUT
   ============================================================ */

textarea#numInput {
  width: 100%;
  min-height: 160px;

  background: #1a1d24;
  color: #e6e6e6;

  border: 1px solid #2c2f38;
  border-radius: 8px;

  padding: 12px;

  font-family: "SF Mono", Consolas, monospace;
  font-size: 13px;

  resize: vertical;

  outline: none;
}

textarea#numInput:focus {
  border-color: #3b82f6;
}

/* ============================================================
   GENERAL ROW
   ============================================================ */

.row {
  display: flex;
  gap: 10px;
  align-items: center;

  margin-top: 12px;

  flex-wrap: wrap;
}

/* ============================================================
   OCR PROMPT
   ============================================================ */

.ocr-prompt {
  display: flex;
  flex-direction: column;

  gap: 8px;

  margin-top: 12px;
  padding: 12px;

  background: #1a1d24;

  border: 1px solid #2c2f38;
  border-radius: 8px;
}

.ocr-prompt-label {
  font-size: 13px;
  color: #cbd5e1;
}

.ocr-prompt-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ocr-choice-btn {
  width: 100%;

  padding: 10px 16px;

  border-radius: 8px;
  border: 1px solid #33415a;

  background: #2c2f38;
  color: #e6e6e6;

  font-size: 14px;

  cursor: pointer;
}

.ocr-choice-btn:hover {
  background: #383c48;
}

.ocr-choice-btn:active {
  background: #454a58;
}

@media (min-width: 600px) {
  .ocr-prompt {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .ocr-prompt-btns {
    flex-direction: row;
  }

  .ocr-choice-btn {
    width: auto;
  }
}

/* ============================================================
   FILE / BUTTONS
   ============================================================ */

input[type="file"] {
  display: none;
}

.file-label,
#convertBtn,
#clearBtn {
  cursor: pointer;

  border-radius: 8px;

  padding: 10px 16px;

  font-size: 14px;
  font-weight: 600;
}

.file-label {
  background: #2c2f38;
  color: #e6e6e6;

  border: none;
}

.file-label:hover {
  background: #383c48;
}

#convertBtn {
  background: #3b82f6;
  color: #fff;

  border: none;
}

#convertBtn:hover {
  background: #2563eb;
}

#clearBtn {
  background: transparent;
  color: #999;

  border: 1px solid #2c2f38;
}

#clearBtn:hover {
  color: #e6e6e6;
  border-color: #444;
}

#fileName {
  font-size: 12px;
  color: #999;
}

/* ============================================================
   IMAGE TYPE
   ============================================================ */

#imageType {
  background: #1a1d24;
  color: #e6e6e6;

  border: 1px solid #2c2f38;
  border-radius: 8px;

  padding: 8px 10px;

  font-size: 13px;
}

#ocrStatus {
  font-size: 12px;
  color: #7cb0ff;
}

#ocrStatus.error {
  color: #ef4444;
}

/* ============================================================
   DEVICE BADGE
   ============================================================ */

#deviceBadge {
  display: block;

  margin-bottom: 12px;
  padding-bottom: 10px;

  border-bottom: 1px solid #2c2f38;

  color: #7cb0ff;
  font-size: 13px;
}

#deviceBadge.hidden {
  display: none;
}

/* ============================================================
   EDIT TOGGLE
   ============================================================ */

#numInput.hidden {
  display: none;
}

#editToggle {
  display: none;

  cursor: pointer;

  color: #7cb0ff;

  font-size: 13px;

  margin-bottom: 14px;

  text-decoration: underline;
}

#editToggle.show {
  display: inline-block;
}

/* ============================================================
   RESULT
   ============================================================ */

#resultWrapper {
  margin-top: 20px;

  background: #1a1d24;

  border: 1px solid #2c2f38;
  border-radius: 8px;

  padding: 14px;
}

#resultWrapper.hidden {
  display: none;
}

#result {
  white-space: pre-wrap;

  font-family: "SF Mono", Consolas, monospace;

  font-size: 13px;
  line-height: 1.6;

  color: #d6d6d6;
}

/* ============================================================
   LOADER
   ============================================================ */

.loader {
  display: inline-block;

  width: 12px;
  height: 12px;

  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;

  border-radius: 50%;

  animation: spin 0.7s linear infinite;

  margin-right: 6px;

  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.result-loader {
  display: flex;

  align-items: center;

  gap: 6px;

  color: #999;

  font-size: 13px;
}

.dot {
  width: 6px;
  height: 6px;

  background: #666;

  border-radius: 50%;

  animation: pulse 1s infinite ease-in-out;
}

.dot:nth-child(2) {
  animation-delay: 0.15s;
}

.dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }

  40% {
    opacity: 1;
  }
}

/* ============================================================
   LOGIN SCREEN
   ============================================================ */

#loginScreen {
  width: 100%;
  max-width: 380px;

  margin: 60px auto;

  background: #1a1d24;

  border: 1px solid #2c2f38;
  border-radius: 12px;

  padding: 24px;
}

#loginScreen h2 {
  font-size: 18px;

  margin: 0 0 6px;
}

#loginScreen p {
  color: #999;

  font-size: 13px;

  margin-top: 0;
}

/* ============================================================
   GENERIC LOGIN INPUT
   ============================================================ */

#loginScreen input {
  width: 100%;

  background: #0f1115;
  color: #e6e6e6;

  border: 1px solid #2c2f38;
  border-radius: 8px;

  padding: 12px;

  font-size: 15px;

  margin-top: 12px;

  outline: none;
}

#loginScreen input:focus {
  border-color: #3b82f6;
}

/* ============================================================
   PHONE ROW
   ============================================================ */

.phone-row {
  width: 100%;

  margin-top: 12px;

  position: relative;
}

/* ============================================================
   INTL TEL INPUT
   ============================================================ */

.phone-row .iti {
  width: 100% !important;

  display: block !important;

  position: relative !important;
}

/* ============================================================
   SINGLE PHONE CONTAINER
   ============================================================ */

#loginScreen .iti {
  width: 100% !important;
  height: 52px !important;

  position: relative !important;

  background: #0f1115 !important;

  border: 1px solid #2c2f38 !important;
  border-radius: 8px !important;

  overflow: visible !important;

  transition: border-color 0.15s ease;
}

/* ============================================================
   PHONE NUMBER INPUT
   ============================================================ */

#loginScreen .iti input,
#loginScreen .iti input[type="tel"] {
  width: 100% !important;

  height: 50px !important;

  margin: 0 !important;

  /*
     LEFT SPACE:
     flag + dial code + arrow
  */

  padding-top: 0 !important;
  padding-right: 12px !important;
  padding-bottom: 0 !important;
  padding-left: 92px !important;

  background: transparent !important;

  color: #e6e6e6 !important;

  border: none !important;

  outline: none !important;

  border-radius: 8px !important;

  font-size: 15px !important;

  /*
     Critical:
     keep text vertically centered
  */

  line-height: 50px !important;

  vertical-align: middle;
}

/* ============================================================
   PHONE PLACEHOLDER
   ============================================================ */

#loginScreen .iti input::placeholder {
  color: #777 !important;

  opacity: 1;
}

/* ============================================================
   COUNTRY SELECTOR
   ============================================================ */

#loginScreen .iti__selected-country {
  position: absolute !important;

  left: 0 !important;
  top: 0 !important;
  bottom: auto !important;

  width: auto !important;

  height: 50px !important;

  display: flex !important;

  align-items: center !important;

  justify-content: flex-start !important;

  padding: 0 12px !important;

  margin: 0 !important;

  border: none !important;

  border-radius: 8px 0 0 8px !important;

  background: transparent !important;

  z-index: 10 !important;

  box-shadow: none !important;
}

/* ============================================================
   COUNTRY FLAG
   ============================================================ */

#loginScreen .iti__selected-country .iti__flag {
  margin: 0 !important;

  flex-shrink: 0;
}

/* ============================================================
   DIAL CODE
   ============================================================ */

#loginScreen .iti__selected-dial-code {
  color: #e6e6e6 !important;

  font-size: 15px !important;

  font-weight: 600 !important;

  line-height: 1 !important;

  margin-left: 8px !important;

  white-space: nowrap !important;
}

/* ============================================================
   COUNTRY ARROW
   ============================================================ */

#loginScreen .iti__arrow {
  border: none !important;

  margin-left: 6px !important;

  flex-shrink: 0;

  opacity: 0.8;
}

/* ============================================================
   COUNTRY SELECTOR HOVER
   ============================================================ */

#loginScreen .iti__selected-country:hover {
  background: #1a1d24 !important;
}

/* ============================================================
   PHONE CONTAINER FOCUS
   ============================================================ */

#loginScreen .iti:focus-within {
  border-color: #3b82f6 !important;
}

/* ============================================================
   INTL TEL INPUT DARK THEME
   ============================================================ */

.iti {
  --iti-border-color: #2c2f38;
  --iti-dialcode-color: #999999;
  --iti-dropdown-bg: #1a1d24;
  --iti-arrow-color: #999999;
  --iti-hover-color: #262a33;
}

/* ============================================================
   COUNTRY DROPDOWN
   ============================================================ */

#loginScreen .iti__dropdown-content {
  background: #1a1d24 !important;

  border: 1px solid #2c2f38 !important;

  border-radius: 8px !important;

  color: #e6e6e6 !important;

  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.35) !important;

  z-index: 1000 !important;
}

#loginScreen .iti__country {
  color: #e6e6e6 !important;
}

#loginScreen .iti__country:hover {
  background: #262a33 !important;
}

#loginScreen .iti__country-name {
  color: #e6e6e6 !important;
}

#loginScreen .iti__dial-code {
  color: #999 !important;
}

/* ============================================================
   COUNTRY SEARCH
   ============================================================ */

#loginScreen .iti__search-input {
  width: 100% !important;

  margin: 0 !important;

  padding: 10px !important;

  background: #0f1115 !important;

  color: #e6e6e6 !important;

  border: 1px solid #2c2f38 !important;

  border-radius: 6px !important;

  outline: none !important;

  font-size: 14px !important;
}

#loginScreen .iti__search-input::placeholder {
  color: #777 !important;
}

/* ============================================================
   FALLBACK COUNTRY SELECT
   ============================================================ */

#fallbackCountryCode {
  height: 52px !important;

  background: #0f1115 !important;

  color: #e6e6e6 !important;

  border: 1px solid #2c2f38 !important;

  border-radius: 8px !important;

  padding: 12px 36px 12px 12px !important;

  font-size: 14px !important;

  max-width: 150px !important;

  flex: 0 0 auto !important;

  outline: none !important;
}

#fallbackCountryCode:focus {
  border-color: #3b82f6 !important;
}

/* ============================================================
   LOGIN BUTTON
   ============================================================ */

#loginScreen button {
  width: 100%;

  margin-top: 14px;

  padding: 12px;

  border: none;

  border-radius: 8px;

  background: #3b82f6;

  color: white;

  font-size: 14px;

  font-weight: 600;

  cursor: pointer;

  transition:
    background 0.15s ease,
    opacity 0.15s ease;
}

#loginScreen button:hover {
  background: #2563eb;
}

#loginScreen button:active {
  transform: translateY(1px);
}

#loginScreen button:disabled {
  background: #33415a;

  cursor: not-allowed;

  opacity: 0.8;
}

/* ============================================================
   LOGIN STATUS
   ============================================================ */

#loginStatus {
  font-size: 13px;

  margin-top: 12px;

  color: #7cb0ff;
}

#loginStatus.error {
  color: #ef4444;
}

/* ============================================================
   OTP
   ============================================================ */

#otpInput {
  margin-top: 12px !important;

  text-align: center;

  letter-spacing: 4px;

  font-family: "SF Mono", Consolas, monospace;
}

/* ============================================================
   OTP LINKS
   ============================================================ */

#resendOtp {
  display: inline-block;

  margin-top: 10px;

  font-size: 12px;

  color: #7cb0ff;

  cursor: pointer;

  text-decoration: underline;
}

#resendOtp.disabled {
  color: #555;

  cursor: not-allowed;

  text-decoration: none;
}

#changeNumber {
  display: inline-block;

  margin-top: 10px;

  margin-left: 12px;

  font-size: 12px;

  color: #999;

  cursor: pointer;

  text-decoration: underline;
}

#changeNumber:hover {
  color: #e6e6e6;
}

/* ============================================================
   VISIBILITY
   ============================================================ */

#appContent.hidden,
#loginScreen.hidden {
  display: none;
}

/* /* /* ============================================================
   LOGOUT — TOP RIGHT 
   ============================================================ */

#logoutBar {
  width: 100%;
  max-width: 760px;

  margin: 0 auto 10px;

  display: flex;
  justify-content: flex-end;
  align-items: center;

  text-align: right;
}

#logoutBar a {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;

  color: #8b919c;

  font-size: 12px;
  font-weight: 500;

  border: 1px solid transparent;
  border-radius: 6px;

  cursor: pointer;
  text-decoration: none;

  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

#logoutBar a::before {
  content: "↪";
  font-size: 14px;
  line-height: 1;
}

#logoutBar a:hover {
  color: #ef6b6b;
  background: rgba(239, 107, 107, 0.08);
  border-color: rgba(239, 107, 107, 0.18);
}

#logoutBar a:active {
  background: rgba(239, 107, 107, 0.14);
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 599px) {
  body {
    padding: 16px;
  }

  #loginScreen {
    width: 100%;
    max-width: 380px;

    margin: 60px auto 0;

    padding: 24px;
  }

  /* PHONE */

  #loginScreen .iti {
    height: 52px !important;
  }

  #loginScreen .iti input,
  #loginScreen .iti input[type="tel"] {
    height: 50px !important;

    padding-top: 0 !important;
    padding-right: 10px !important;
    padding-bottom: 0 !important;
    padding-left: 92px !important;

    font-size: 15px !important;

    line-height: 50px !important;
  }

  #loginScreen .iti__selected-country {
    height: 50px !important;

    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  #loginScreen .iti__selected-dial-code {
    font-size: 15px !important;

    margin-left: 7px !important;
  }

  #loginScreen .iti__arrow {
    margin-left: 5px !important;
  }
}

/* ============================================================
   SMALL MOBILE
   ============================================================ */

@media (max-width: 380px) {
  body {
    padding: 12px;
  }

  #loginScreen {
    padding: 20px;
  }

  #loginScreen .iti input,
  #loginScreen .iti input[type="tel"] {
    padding-left: 88px !important;
  }

  #loginScreen .iti__selected-country {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  #loginScreen .iti__selected-dial-code {
    margin-left: 6px !important;
  }
}

/* /* ============================================================
   FOOTER
   ============================================================ */

footer {
  width: 100%;
  max-width: 760px;

  margin: 24px auto 0;
  padding: 10px 0 4px;

  text-align: center;

  color: #5b6472;

  font-size: 12px;
  line-height: 1.4;

  flex-shrink: 0;
}

footer a {
  color: #5b6472;
  text-decoration: none;
}

footer a:hover {
  color: #7cb0ff;
}

/* ============================================================
   MOBILE FOOTER
   ============================================================ */

@media (max-width: 599px) {
  footer {
    margin-top: 20px;
    padding: 8px 0 4px;

    font-size: 12px;
  }
}