/* ==========================================================================
   NexCode — Custom skin overrides for Roundcube Elastic
   Scoped to specific .task-* bodies to avoid touching the webmail UI.
   ========================================================================== */

/* ===========================================================
   1) LOGIN PAGE  (body.task-login)
   =========================================================== */

body.task-login {
  background: #06070d !important;
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Animated gradient mesh */
body.task-login::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 600px at 18% 22%, rgba(124, 92, 255, 0.55), transparent 60%),
    radial-gradient(700px 500px at 82% 18%, rgba(34, 211, 238, 0.45), transparent 60%),
    radial-gradient(900px 600px at 70% 88%, rgba(255, 92, 246, 0.30), transparent 60%),
    radial-gradient(700px 600px at 12% 88%, rgba(92, 255, 177, 0.28), transparent 60%),
    #06070d;
  background-size: 200% 200%;
  animation: nx-mesh 22s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes nx-mesh {
  0%   { background-position:   0%   0%,   100% 0%,   80% 100%,   0% 100%, 0 0; }
  50%  { background-position:  20%  20%,    80% 30%,   60%  80%,  20%  90%, 0 0; }
  100% { background-position:  10%  30%,    90% 10%,   70%  70%,  10% 100%, 0 0; }
}

/* SVG noise + vignette overlay */
body.task-login::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(6,7,13,.85) 100%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: cover, 220px 220px;
  mix-blend-mode: normal;
}

/* Push real content above the overlays */
body.task-login #layout,
body.task-login #layout-content {
  position: relative;
  z-index: 2;
  background: transparent !important;
}

body.task-login #layout {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

body.task-login #layout-content {
  width: 100%;
  max-width: 460px;
  padding: 56px 44px 36px !important;
  margin: 24px;
  border-radius: 24px;
  background: rgba(13, 16, 30, 0.55);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  animation: nx-rise .85s cubic-bezier(.2,.8,.2,1) both;
  color: #e9ecf6;
}

@keyframes nx-rise {
  from { opacity: 0; transform: translateY(28px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Logo: replace the default Roundcube cube with a gradient mark */
body.task-login #logo {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 22px !important;
  border-radius: 18px;
  background:
    linear-gradient(135deg, #7c5cff 0%, #22d3ee 55%, #5cffb1 100%) !important;
  box-shadow:
    0 18px 40px -10px rgba(124, 92, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  position: relative;
  /* Hide original image */
  text-indent: -9999px;
  color: transparent;
  overflow: hidden;
}
body.task-login #logo::after {
  content: "";
  position: absolute;
  inset: 16px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2307070d' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M4 7l8-4 8 4-8 4z'/><path d='M4 17l8 4 8-4'/><path d='M4 12l8 4 8-4'/></svg>");
}

/* Add brand title before the form */
body.task-login #layout-content::before {
  content: "Bem-vindo de volta";
  display: block;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #c8b8ff 0%, #7cf3ff 60%, #b9ffd6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
}
body.task-login #layout-content::after {
  content: "Acesse seu workspace corporativo seguro";
  display: block;
  text-align: center;
  font-size: 13.5px;
  color: #9aa3bd;
  margin-bottom: 30px;
}

/* Form layout */
body.task-login #login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
body.task-login #login-form table,
body.task-login #login-form tbody,
body.task-login #login-form tr {
  display: block;
  width: 100%;
}
body.task-login #login-form td {
  display: block;
  width: 100% !important;
  padding: 0 !important;
  border: 0 !important;
}
body.task-login #login-form td.title,
body.task-login #login-form .input-group-prepend,
body.task-login #login-form .input-group-text {
  display: none !important;
}

/* Inputs */
body.task-login #login-form .input-group {
  display: block;
  width: 100%;
  margin-bottom: 14px;
  position: relative;
}

body.task-login #login-form input.form-control,
body.task-login #login-form input[type="text"],
body.task-login #login-form input[type="password"] {
  width: 100% !important;
  height: 50px !important;
  padding: 0 18px !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  color: #e9ecf6 !important;
  font-size: 15px !important;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: none !important;
}
body.task-login #login-form input.form-control::placeholder { color: #6b7395 !important; }
body.task-login #login-form input.form-control:focus,
body.task-login #login-form input.form-control:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(124, 92, 255, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18) !important;
  outline: none !important;
}

/* Autofill killer (Chrome) */
body.task-login #login-form input:-webkit-autofill,
body.task-login #login-form input:-webkit-autofill:hover,
body.task-login #login-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e9ecf6 !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(20, 22, 40, 0.95) inset !important;
  caret-color: #e9ecf6;
  border-color: rgba(124, 92, 255, 0.55) !important;
}

/* Submit button */
body.task-login #login-form button[type="submit"],
body.task-login #login-form input[type="submit"],
body.task-login #login-form .btn-primary {
  width: 100% !important;
  height: 52px !important;
  margin-top: 8px !important;
  border-radius: 12px !important;
  border: 0 !important;
  background: linear-gradient(135deg, #7c5cff 0%, #22d3ee 60%, #5cffb1 100%) !important;
  color: #07070d !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  letter-spacing: 0.01em !important;
  text-transform: none !important;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 18px 40px -12px rgba(124, 92, 255, 0.55) !important;
}
body.task-login #login-form button[type="submit"]:hover,
body.task-login #login-form input[type="submit"]:hover,
body.task-login #login-form .btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 28px 60px -14px rgba(124, 92, 255, 0.7) !important;
}

/* Footer */
body.task-login #login-footer {
  margin-top: 26px !important;
  padding-top: 22px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-size: 12px;
  color: #6b7395 !important;
}
body.task-login #login-footer a {
  color: #9aa3bd !important;
  text-decoration: none;
  transition: color .2s ease;
}
body.task-login #login-footer a:hover { color: #c8b8ff !important; }

/* "Powered by" line styled like a small badge */
body.task-login #login-footer::before {
  content: "Plataforma corporativa segura";
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5cffb1;
  opacity: .75;
}

/* Hide noscript warning visually but keep accessible */
body.task-login .noscriptwarning {
  margin-top: 18px;
  text-align: center;
  color: #ff9b9b;
  font-size: 12px;
}

/* Hide Roundcube top notification bar background on login */
body.task-login #messagestack {
  z-index: 5;
  position: fixed !important;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 420px;
}

/* Hide voice header */
body.task-login .voice { position: absolute; left: -9999px; }

/* Responsive */
@media (max-width: 520px) {
  body.task-login #layout-content {
    padding: 40px 26px 28px !important;
    margin: 14px;
    border-radius: 18px;
  }
  body.task-login #layout-content::before { font-size: 22px; }
}
